Helloworld fails to link on Debian

Sebastien Alaiwan via D.gnu d.gnu at puremagic.com
Thu Dec 22 10:39:42 PST 2016


$ 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.


More information about the D.gnu mailing list