Error message when trying to link single D file to produce exe

kinke noone at nowhere.com
Sat Jun 10 14:06:46 UTC 2023


On Saturday, 10 June 2023 at 12:55:10 UTC, Cecil Ward wrote:
> I am still at a loss as to where to find a linker. What am I 
> supposed to be looking for and do I have to download the llvm c 
> compiler to get a linker included in that package?

Don't use `-link-internally` for non-Windows targets unless you 
know exactly what you are doing. See 
https://github.com/ldc-developers/ldc/issues/2717 and 
https://github.com/ldc-developers/ldc/pull/2203#issuecomment-339167131 for reasons, further links and cmdline examples. E.g., the `-arch` for the internal linker (an ld64-compatible LLD) would need to be specified as `-L-arch -Larm64` in the LDC cmdline.

Linking for Posix targets is normally done through the C compiler 
(`cc`), which adds lots of cmdline options for the underlying 
linker (Apple: `ld64`), so that it finds the required C libs etc. 
I don't use Apple, but I guess an Xcode installation is required 
to have a C compiler (Apple clang) and Apple's ld64 linker.

Use `-v` in the LDC cmdline to print the 'linker' command 
executed by LDC. Additionally use `-Xcc=-v` (without 
`-link-internally`) to make the C compiler print the actual 
linker cmdline (which would approximately be the one you'd need 
when linking with `-link-internally`).


More information about the digitalmars-d-ldc mailing list