fPIC Error
Dlang User via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Wed Nov 2 22:16:11 PDT 2016
I am running Debian Testing and I think I have run into the
recent fPIC issue. This is the source code for the test project
I am using:
import std.stdio;
void main()
{
writeln("Edit source/app.d to start your project.");
readln();
}
When I try to compile a project, I get the following errors
(truncated for brevity):
/usr/bin/ld:
/usr/lib/gcc/x86_64-linux-gnu/6/../../../x86_64-linux-gnu/libphobos2.a(thread_26c_155.o): relocation R_X86_64_32 against symbol `__dmd_personality_v0' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Nonrepresentable section on output
collect2: error: ld returned 1 exit status
dmd failed with exit code 1.
Exit code 2
Build complete -- 1 error, 0 warnings
I followed the advice to add "-defaultlib=libphobos2.so -fPIC" to
my dmd.conf file as a workaround.
This causes it to build without errors, but now the resulting
executable is marked as a shared library:
Output of the file command:
fpictest: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV),
dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for
GNU/Linux 2.6.32,
BuildID[sha1]=e83ac1d5dea9e78912a6175d3c1c54b50b4e29cd, not
stripped
Is this a known issue with this workaround or is there some other
setting that I need to change?
More information about the Digitalmars-d-learn
mailing list