[sdc] linker problems when building programs with sdc
Marco Leise via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sun Oct 18 10:43:38 PDT 2015
Am Sun, 18 Oct 2015 11:35:16 +0200
schrieb Joseph Rushton Wakeling via Digitalmars-d-learn
<digitalmars-d-learn at puremagic.com>:
> 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
Maybe you should have started with `return 42;`? :D
writeln is not a light-weight in terms of exercised compiler
features. I didn't even know that it compiles yet. Last time I
heard it was not usable.
--
Marco
More information about the Digitalmars-d-learn
mailing list