Error message when trying to link single D file to produce exe
Cecil Ward
cecil at cecilward.com
Sat Jun 10 12:55:10 UTC 2023
On Saturday, 10 June 2023 at 03:24:51 UTC, Cecil Ward wrote:
> I’ve just downloaded ldc and I can successfully generate either
> an object file or asm output file from a single .d source. I’ve
> no idea where to find a suitable linker ( or make ) with which
> I can either link in object files from d- and non-d language
> sources or even just generate an exe from a single hello world
> .d -> .exe first.
>
> 1. I got an error message below.
> 2. I’ve run ldc on linux before, but osx is new to me. Where do
> I find a suitable linker and what is it called ?
>
> I’m running on osx ventura Aarch64 targeting self, not
> cross-compiling.
>
> Here’s what happened
>
> cecil at Mac-mini ~ % ./ldc mac_hex_5.d --link-internally
> lld: error: must specify -arch
> Error: linking with LLD failed
> The file "./ldc" is just a tiny one-line bash script that adds
> flags "-O3 -release -mcpu=native" and provides the path to the
> compiler.
I’ve since fixed one of the problems, that of being able to
compile a single .d file to an exe. That now works because I did
a new download of ldc from a different source, and the new
package is perhaps more complete. Before I downloaded the
compiler from the LDC website in a .tar.xz file (or similar) and
then just untar-ed them into a subdirectory below my home
directory. After that I had the error message and didn’t know how
to make a .exe from a single .d.
Now I did a "brew install ldc2" (or similar) using the homebrew
package manager for osx. I now get an exe (which has bugs in it,
but that’s probably my fault, it used to work though.)
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?
More information about the digitalmars-d-ldc
mailing list