[sdc] linker problems when building programs with sdc
Joseph Rushton Wakeling via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sun Oct 18 02:35:16 PDT 2015
Hello all,
I recently decided to have another play with sdc to see how it's doing. Since
my dmd is installed in /opt/dmd/ I had to do a couple of tricks to get sdc
itself to build:
(i) put a dlang.conf in /etc/ld.so.conf.d/ containing the /opt/dmd/lib64 path;
(ii) call 'make LD_PATH=/opt/dmd/lib64' when building sdc
sdc itself then builds successfully, and I wind up with a bin/ directory
containing sdc and sdc.conf (which contains includePath and libPath options) and
a lib/ directory containing libd.a, libd-llvm.a, libphobos.a and libsdrt.a.
However, when I try to build any program, even a simple hello-world, I get a
linker error:
$ ./sdc hello.d
hello.o: In function `_D5hello4mainFMZv':
hello.d:(.text+0x1c): undefined reference to `_D3std5stdio7writelnFMAyaZv'
collect2: error: ld returned 1 exit status
To solve this, I tried adding in a library-path flag, but this simply resulted
in an exception being thrown by sdc's options parsing:
$ ./sdc -L$MYHOMEDIR/code/D/sdc/lib hello.d
std.getopt.GetOptException@/opt/dmd/bin/../import/std/getopt.d(604):
Unrecognized option -L$MYHOMEDIR/code/D/sdc/lib
[cut great big backtrace]
Can anyone advise what's missing in my setup? I did also try adding
$MYHOMEDIR/code/D/sdc/lib to the /etc/ld.so.conf.d/dlang.conf file, and
re-running ldconfig, but that didn't seem to make any difference.
Thanks & best wishes,
-- Joe
More information about the Digitalmars-d-learn
mailing list