Hi,
I am using g++-14 from mingw64 from MSYS2 on Windows.
I am trying to discover the location of C and C++ standard libraries by
using command `gcc -print-file-name=libstdc++-6.dll`, but it just prints
the library filename without an absolute path.

My program:

$ cat hello.cpp
#include <iostream>
int main(){
  std::cout << "hello\n";
}

Compile:
$ x86_64-w64-mingw32-g++ -o hello.exe hello.cpp

Inspect library dependencies:

$ ldd hello.exe
        ntdll.dll => /c/WINDOWS/SYSTEM32/ntdll.dll (0x7ffdf6410000)
        KERNEL32.DLL => /c/WINDOWS/System32/KERNEL32.DLL (0x7ffdf4f20000)
        KERNELBASE.dll => /c/WINDOWS/System32/KERNELBASE.dll
(0x7ffdf3a20000)
        msvcrt.dll => /c/WINDOWS/System32/msvcrt.dll (0x7ffdf4490000)
        libstdc++-6.dll => /mingw64/bin/libstdc++-6.dll (0x7ffde3280000)
        libgcc_s_seh-1.dll => /mingw64/bin/libgcc_s_seh-1.dll
(0x7ffde6da0000)
        libwinpthread-1.dll => /mingw64/bin/libwinpthread-1.dll
(0x7ffdeeba0000)

Query the location of the library file:
$ x86_64-w64-mingw32-g++ -print-file-name=libstdc++-6.dll
libstdc++-6.dll
$ x86_64-w64-mingw32-g++ -print-file-name=libgcc_s_seh-1.dll
libgcc_s_seh-1.dll
$ x86_64-w64-mingw32-g++ -print-file-name=libwinpthread-1.dll
libwinpthread-1.dll

GCC-13 used to print the absolute path, but GCC-14/Mingw does not anymore.
Native GCC-14 on Linux (Fedora, Ubuntu, Debian) prints the absolute path,
but not the GCC-14/Mingw build.

*Is there an alternative way to figure out the location of the libraries
used by GCC-14/Mingw?*

Within MSYS2 ldd is actually helpful in displaying what the library loading
will load, but it is not available when cross-compiling on Fedora which
ships mingw-gcc-14 (Ubuntu and Debian ship gcc-13/mingw, which does not
have this problem). On Linux I use objcdump to inspect the dependencies,
but it does not print the absolute path.

-- 
Marius

_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to