| Thread overview | |||||
|---|---|---|---|---|---|
|
December 22, 2016 Helloworld fails to link on Debian | ||||
|---|---|---|---|---|
| ||||
$ 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.
| ||||
December 22, 2016 Re: Helloworld fails to link on Debian | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Sebastien Alaiwan | Just to show that my compiler is up-to-date: $ dpkg -l | grep "gdc\|phobos" ii gdc 4:6.2.1-1 amd64 D compiler (language version 2), based on the GCC backend ii gdc-6 6.2.1-5 amd64 GNU D compiler (version 2) ii libgphobos-6-dev:amd64 6.2.1-5 amd64 Phobos D standard library ii libgphobos-dev 6.2.1-1 amd64 Phobos D standard library ii libgphobos68:amd64 6.2.1-5 amd64 Phobos D standard library (runtime library) $ gdc --version gdc (Debian 6.2.1-5) 6.2.1 20161124 Copyright (C) 2016 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | |||
December 22, 2016 Re: Helloworld fails to link on Debian | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Sebastien Alaiwan | Am Thu, 22 Dec 2016 18:39:42 +0000 schrieb Sebastien Alaiwan <ace17@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 | |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply