Thread overview | |||||
---|---|---|---|---|---|
|
October 30, 2016 strange -fPIC compilation error | ||||
---|---|---|---|---|
| ||||
dmd --version DMD64 D Compiler v2.071.2 Copyright (c) 1999-2015 by Digital Mars written by Walter Bright on debian testing. dub is installed via apt-get. Should I revert to an earlier version? Or what? The program: import std.stdio; void main() { //int[] t1; //t1 ~= 1; //t1 ~= 2; //writeln ("t1 = ", t1); } fails with the 442 lines of error: /usr/bin/ld: test.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: /usr/lib/x86_64-linux-gnu/libphobos2.a(exception_224_3b4.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: /usr/lib/x86_64-linux-gnu/libphobos2.a(exception_227_4a2.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: /usr/lib/x86_64-linux-gnu/libphobos2.a(exception_229_5cc.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: /usr/lib/x86_64-linux-gnu/libphobos2.a(dmain2_626_47b.o): relocation R_X86_64_32 against symbol `_D6object9Throwable7__ClassZ' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/lib/x86_64-linux-gnu/libphobos2.a(dmain2_628_776.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: /usr/lib/x86_64-linux-gnu/libphobos2.a(dwarfeh_62b_6b9.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: /usr/lib/x86_64-linux-gnu/libphobos2.a(aaA_51a_53e.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 --- errorlevel 1 |
October 30, 2016 Re: strange -fPIC compilation error | ||||
---|---|---|---|---|
| ||||
Posted in reply to Charles Hixson | On Sunday, 30 October 2016 at 18:02:28 UTC, Charles Hixson wrote:
> dmd --version
> DMD64 D Compiler v2.071.2
> Copyright (c) 1999-2015 by Digital Mars written by Walter Bright
> on debian testing.
>
> dub is installed via apt-get.
>
> Should I revert to an earlier version? Or what?
>
> The program:
>
>
> import std.stdio;
>
> void main()
> { //int[] t1;
>
> //t1 ~= 1;
> //t1 ~= 2;
> //writeln ("t1 = ", t1);
> }
>
> fails with the 442 lines of error:
>
> /usr/bin/ld: test.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: /usr/lib/x86_64-linux-gnu/libphobos2.a(exception_224_3b4.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: /usr/lib/x86_64-linux-gnu/libphobos2.a(exception_227_4a2.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: /usr/lib/x86_64-linux-gnu/libphobos2.a(exception_229_5cc.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: /usr/lib/x86_64-linux-gnu/libphobos2.a(dmain2_626_47b.o): relocation R_X86_64_32 against symbol `_D6object9Throwable7__ClassZ' can not be used when making a shared object; recompile with -fPIC
> /usr/bin/ld: /usr/lib/x86_64-linux-gnu/libphobos2.a(dmain2_628_776.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: /usr/lib/x86_64-linux-gnu/libphobos2.a(dwarfeh_62b_6b9.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: /usr/lib/x86_64-linux-gnu/libphobos2.a(aaA_51a_53e.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
> --- errorlevel 1
Are you on Ubuntu 16.10, or some other system with an hardened toolchain? If that's the case, you should compile with `-fPIC -defaultlib=libphobos2.so`. You can put those options in your dmd.conf configuration file, so that you don't have to type them every time.
|
October 30, 2016 Re: strange -fPIC compilation error | ||||
---|---|---|---|---|
| ||||
Posted in reply to Lodovico Giaretta |
On 10/30/2016 04:03 PM, Lodovico Giaretta via Digitalmars-d-learn wrote:
> On Sunday, 30 October 2016 at 18:02:28 UTC, Charles Hixson wrote:
>> dmd --version
>> DMD64 D Compiler v2.071.2
>> Copyright (c) 1999-2015 by Digital Mars written by Walter Bright
>> on debian testing.
>>
>> dub is installed via apt-get.
>>
>> Should I revert to an earlier version? Or what?
>>
>> The program:
>>
>>
>> import std.stdio;
>>
>> void main()
>> { //int[] t1;
>>
>> //t1 ~= 1;
>> //t1 ~= 2;
>> //writeln ("t1 = ", t1);
>> }
>>
>> fails with the 442 lines of error:
>>
>> /usr/bin/ld: test.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: /usr/lib/x86_64-linux-gnu/libphobos2.a(exception_224_3b4.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: /usr/lib/x86_64-linux-gnu/libphobos2.a(exception_227_4a2.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: /usr/lib/x86_64-linux-gnu/libphobos2.a(exception_229_5cc.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: /usr/lib/x86_64-linux-gnu/libphobos2.a(dmain2_626_47b.o): relocation R_X86_64_32 against symbol `_D6object9Throwable7__ClassZ' can not be used when making a shared object; recompile with -fPIC
>> /usr/bin/ld: /usr/lib/x86_64-linux-gnu/libphobos2.a(dmain2_628_776.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: /usr/lib/x86_64-linux-gnu/libphobos2.a(dwarfeh_62b_6b9.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: /usr/lib/x86_64-linux-gnu/libphobos2.a(aaA_51a_53e.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
>> --- errorlevel 1
>
> Are you on Ubuntu 16.10, or some other system with an hardened toolchain? If that's the case, you should compile with `-fPIC -defaultlib=libphobos2.so`. You can put those options in your dmd.conf configuration file, so that you don't have to type them every time.
>
Well, I'm using debian, but I've never had to do anything of that nature before. OTOH, it's been a couple of months if this is a new change.
|
Copyright © 1999-2021 by the D Language Foundation