www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - dmd or phobos were broken in ubuntu 16.10 d-apt

reply mogu <mogucpp 163.com> writes:
$ dmd hello.d
/usr/bin/ld: hello.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(dwarfeh_62d_56a.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_62e_811.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_632_2c9.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_633_6e0.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(lifetime_647_482.o): 
relocation R_X86_64_32 against symbol `__dmd_personality_v0' can 
not be used when making a shared object; recompile with -fPIC
...
Oct 20 2016
next sibling parent reply tcak <1ltkrs+3wyh1ow7kzn1k sharklasers.com> writes:
On Friday, 21 October 2016 at 04:16:38 UTC, mogu wrote:
 [...]
Yes, we (I and one another person on this forum) have the same problem. As a temporary solution, while compiling your program, add -defaultlib=libphobos2.so -fPIC This solved my problem on Ubuntu 16.10. But with one problem. Now, while you are copying your executable to another computer, you need to copy libphobos2.so (in my case libphobos2.so.17) to that computer's /usr/lib as well.
Oct 21 2016
parent reply Daniel Kozak via Digitalmars-d <digitalmars-d puremagic.com> writes:
Dne 21.10.2016 v 10:02 tcak via Digitalmars-d napsal(a):

 On Friday, 21 October 2016 at 04:16:38 UTC, mogu wrote:
 [...]
Yes, we (I and one another person on this forum) have the same problem. As a temporary solution, while compiling your program, add -defaultlib=libphobos2.so -fPIC This solved my problem on Ubuntu 16.10. But with one problem. Now, while you are copying your executable to another computer, you need to copy libphobos2.so (in my case libphobos2.so.17) to that computer's /usr/lib as well.
Or you can build your own version of dmd with PIC enabled and add -fPIC to /etc/dmd.conf
Oct 21 2016
parent reply mogu <mogucpp 163.com> writes:
On Friday, 21 October 2016 at 10:05:40 UTC, Daniel Kozak wrote:
 Or you can build your own version of dmd with PIC enabled and 
 add -fPIC to /etc/dmd.conf
I rebuilded phobos and druntime with -fPIC and replaced the static libphobos2.a. Now it works well. But I have to specified -fPIC to dmd each time to build. Should dmd make -fPIC the default?
Oct 21 2016
next sibling parent Daniel Kozak via Digitalmars-d <digitalmars-d puremagic.com> writes:
Dne 21.10.2016 v 12:53 mogu via Digitalmars-d napsal(a):
 On Friday, 21 October 2016 at 10:05:40 UTC, Daniel Kozak wrote:
 Or you can build your own version of dmd with PIC enabled and add 
 -fPIC to /etc/dmd.conf
I rebuilded phobos and druntime with -fPIC and replaced the static libphobos2.a. Now it works well. But I have to specified -fPIC to dmd each time to build. Should dmd make -fPIC the default?
read my message again: add -fPIC to /etc/dmd.conf this should help
Oct 21 2016
prev sibling parent Daniel Kozak via Digitalmars-d <digitalmars-d puremagic.com> writes:
Dne 21.10.2016 v 12:59 Daniel Kozak napsal(a):

 Dne 21.10.2016 v 12:53 mogu via Digitalmars-d napsal(a):
 On Friday, 21 October 2016 at 10:05:40 UTC, Daniel Kozak wrote:
 Or you can build your own version of dmd with PIC enabled and add 
 -fPIC to /etc/dmd.conf
I rebuilded phobos and druntime with -fPIC and replaced the static libphobos2.a. Now it works well. But I have to specified -fPIC to dmd each time to build. Should dmd make -fPIC the default?
read my message again: add -fPIC to /etc/dmd.conf this should help
or maybe there is another one dmd.conf somewhere in dmd source (in place where your new dmd binary is)
Oct 21 2016
prev sibling parent Martin Nowak <code dawg.eu> writes:
On Friday, 21 October 2016 at 04:16:38 UTC, mogu wrote:
 $ dmd hello.d
Just for future reference, PIE support was fixed with 2.072.2. http://dlang.org/changelog/2.072.2.html https://issues.dlang.org/show_bug.cgi?id=16794
Jan 10