Helloworld fails to link on Debian

Johannes Pfau via D.gnu d.gnu at puremagic.com
Thu Dec 22 11:06:58 PST 2016


Am Thu, 22 Dec 2016 18:39:42 +0000
schrieb Sebastien Alaiwan <ace17 at free.fr>:

> $ cat hello.d
> import std.stdio;
> 
> int main()
> {
>    writefln("Hello, world");
>    return 0;
> }
> 
> $ gdc hello.d
> /usr/bin/ld: /tmp/cc03E6ZO.o: relocation R_X86_64_PC32 against 
> symbol 
> `_D3std6format18__T10FormatSpecTaZ10FormatSpec6__ctorMFNaNbNcNiNfxAaZS3std6format18__T10FormatSpecTaZ10FormatSpec'
> can not be used when making a shared object; recompile with
> -fPIC /usr/bin/ld: final link failed: Bad value collect2: error: ld
> returned 1 exit status $
> 
> Workaround #1: add "-no-pie" to the command line
> Workaround #2: add "-funittest" to the command line (!)
> 
> It seems that libphobos isn't compiled with options (-fPIC) 
> compatible with default binutils linker requirements.

Known issue & fixed upstream:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=845377#32
https://github.com/D-Programming-GDC/GDC/pull/261


More information about the D.gnu mailing list