www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Building with dub fails on Ubuntu 16.10.

reply Vlasov Roman <vlasovroman.ru yandex.ru> writes:
Hello, guys.
I tried to build HelloWorld with dub, but i got strange linker 
error:


Performing "debug" build using dmd for x86_64.
test ~master: building configuration "application"...
Linking...
/usr/bin/ld: 
.dub/build/application-debug-linux.posix-x86_64-dmd_2071-0D6D3AB638EA28C55CFA
41FFD9CA209/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(object_15_594.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_223_55a.o): 
relocation R_X86_64_32 against symbol `__dmd_personality_v0' can 
not be used when making a shared object; recompile with -fPIC
....
//manyStringsLater
....
/usr/bin/ld: 
/usr/lib/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
--- errorlevel 1
dmd failed with exit code 1.

ld --version = 2.27
dmd --version = 2.071.1
dub --version = 1.0.0
Ubuntu 16.10 daily

On previously versions of Ubuntu all work fine.

What is the problem? Does anybody have any idea?
Sep 10 2016
parent reply moe <none available.com> writes:
On Sunday, 11 September 2016 at 02:17:21 UTC, Vlasov Roman wrote:
 Hello, guys.
 I tried to build HelloWorld with dub, but i got strange linker 
 error:

 [...]
I just switched from Windows to linux (arch) and got the exact same problem. Did you resolve this yet? I'm not very experienced with development on linux any hint here would be welcome.
Dec 03 2016
next sibling parent moe <none available.com> writes:
On Saturday, 3 December 2016 at 16:07:47 UTC, moe wrote:
 On Sunday, 11 September 2016 at 02:17:21 UTC, Vlasov Roman 
 wrote:
 Hello, guys.
 I tried to build HelloWorld with dub, but i got strange linker 
 error:

 [...]
I just switched from Windows to linux (arch) and got the exact same problem. Did you resolve this yet? I'm not very experienced with development on linux any hint here would be welcome.
Never mind, I just found in the arch-wiki that on arch dmd and libphobos are build without PIC support. Which seams to be causing the problem. The easiest way is to compile using clang instead. CC=/usr/bin/clang dub Alternatively get gdc with PIC support. Sorry for the necromancy. I have been searching for a solution for a couple hours. Did not expect to find something shortly after posting...
Dec 03 2016
prev sibling parent reply Daniel Kozak <kozzi11 gmail.com> writes:
On Saturday, 3 December 2016 at 16:07:47 UTC, moe wrote:
 On Sunday, 11 September 2016 at 02:17:21 UTC, Vlasov Roman 
 wrote:
 Hello, guys.
 I tried to build HelloWorld with dub, but i got strange linker 
 error:

 [...]
I just switched from Windows to linux (arch) and got the exact same problem. Did you resolve this yet? I'm not very experienced with development on linux any hint here would be welcome.
On arch linux there should not be any issue. Archlinux does not use fPIC by default so, this error seems like you have something wrong with your Archlinux installation.
Dec 04 2016
parent moe <none available.com> writes:
On Monday, 5 December 2016 at 07:32:21 UTC, Daniel Kozak wrote:
 On Saturday, 3 December 2016 at 16:07:47 UTC, moe wrote:
 On Sunday, 11 September 2016 at 02:17:21 UTC, Vlasov Roman 
 wrote:
 Hello, guys.
 I tried to build HelloWorld with dub, but i got strange 
 linker error:

 [...]
I just switched from Windows to linux (arch) and got the exact same problem. Did you resolve this yet? I'm not very experienced with development on linux any hint here would be welcome.
On arch linux there should not be any issue. Archlinux does not use fPIC by default so, this error seems like you have something wrong with your Archlinux installation.
Thanks for the tip. I haven't done a lot of development on linux so I messed quite a bit with my arch install. It's very well possible that I messed something up. I am planing to reinstall in a few weeks anyway :) Having said that, from the arch wiki: https://wiki.archlinux.org/index.php/D_(programming_language) Looks like there is a hardening-wrapper which forces PIC by default. As clang worked just fine I assumed that was the actual problem. I will look into it again once I reinstalled my system.
Dec 05 2016