在 2024-10-08 23:00, Marius Mikučionis 写道:
Yes, but it does not specify how linked: statically or dynamically. It is 
useful in both cases.
This feature is important when diagnosing the build system (which library exactly the compiler is picking?), especially if multiple -isystem and -L arguments are provided -- it can get pretty messy.

The cause of this issue is that DLL isn't actually 'linked'; it's the import library (.dll.a) that is linked by the linker, and the DLL is loaded by the operating system which GCC has no idea about. The DLL doesn't have to exist (like in the Debian case) and it doesn't affect linking.

However the import library only provides the file name of the DLL, rather than an absolute path; so there is no way to get that information.


Yes, but I'd rather not mess with the installation (which also assumes root and it would make everything even more confusing).

    On Debian/Ubuntu/Mint, this DLL is installed to
    `/usr/lib/gcc/x86_64-w64-mingw32/13-win32/libstdc++-6.dll` for GCC 13 the 
win32 thread model (there
is another one for the posix thread model), but it is not a standard DLL directory.

Note the version of your gcc is 13, so it should be fine.

I was not suggesting you do it. It was a bad example to describe something 
which 'works by accident'.

It's not because it's GCC 13; it's because the DLL happens to be in the same directory with the import library, where GCC searches for libraries.

In this case it's possible to print non-libraries in that directory:

   $ x86_64-w64-mingw32-g++ -print-file-name=g++-mapper-server
   /usr/lib/gcc/x86_64-w64-mingw32/13-win32/g++-mapper-server


dlltool attempts to create a dll from static library, I get permission denied 
error on Ubuntu:
x86_64-w64-mingw32-dlltool: Can't create .lib file: /usr/lib/gcc/x86_64-w64-mingw32/13-posix/ libstdc++-6.dll: Permission denied

Did you mistake `-l` (lower L) for `-I` (capital I)?  (I made this mistake too.)


I can see the workaround, but that is heuristic and I would still not know what path the compiler is actually choosing/finding. I would have to recreate the library search algorithm embedded in the compiler, which may change and thus the solution is brittle.

As explained in the first paragraph, the linker doesn't actually use the DLL.

There may be changes in GCC that have altered this behavior; I suggest you have 
a look at GCC git log.



--
Best regards,
LIU Hao

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature

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

Reply via email to