Linking with MSVC built static library

kinke noone at nowhere.com
Sat Mar 16 14:27:55 UTC 2019


On Saturday, 16 March 2019 at 12:03:03 UTC, Mihails wrote:
> Can't spot anything meaningful in the build log myself :(

Me neither, so I cloned your repo and checked it locally.

1) It works in a VS command prompt, i.e., when using the MS 
linker and libs. The failure is related to the 'internal' 
toolchain with LLD and the MinGW-based libs.
2) The 'unknown file type .obj' error is apparently related to 
the used /GL (whole-program optimization) compile option. LLD 
doesn't support link.exe's /LTCG switch for link-time code 
generation.
3) After removing /GL, there are linker errors wrt. 
__security_cookie etc., as the MinGW-based libs don't contain 
these. This requires disabling the security checks via /GS-. 
Linking then finally works.
4) I recommend using /ZI (omit default library name) and /MT 
(static release runtime) so that the C(++) libs link without 
warnings against D code, regardless of the used -mscrtlib option.


More information about the digitalmars-d-ldc mailing list