digitalmars.D.learn - -fPIC related error compiling hello_world.d with dmd
- Alessandro (19/19) Nov 18 2016 Hi everyone,
- rikki cattermole (4/22) Nov 18 2016 Yup lots of posts about this problem lately.
- Alessandro (11/44) Nov 18 2016 Thank you for your support Rikki!
- rikki cattermole (3/39) Nov 18 2016 No problem, its Ubuntu/Debian has moved over to a hardened mode fairly
- Alessandro (14/16) Nov 18 2016 I see.
- Alessandro (5/22) Nov 18 2016 Ok, I figured it out.
Hi everyone, I'm almost ashamed to ask help on this... I used dmd/dub on an arch linux machine for some time in the past without any problem. Now I'm experiencing a strange problem after switching to a debian jessie (testing) machine when compiling even the simplest hello_world application :( !! After successfully compiling the source file, I get hundreds of linker error messages of the form: /usr/bin/ld: /usr/lib/x86_64-linux-gnu/libphobos2.a(aaA_52e_53e.o): relocation R_X86_64_32 against symbol `__dmd_personality_v0' can not be used when making a shared object; recompile with -fPIC It looks like the linker cannot link together phobos library modules into the final binary or something like that. I'm using the official package dmd_2.072.0-0_amd64.deb from dlang website, but also the package in debian repositories (version 2.071.2) does the same. Any idea what the problem might be?
Nov 18 2016
On 19/11/2016 2:09 AM, Alessandro wrote:Hi everyone, I'm almost ashamed to ask help on this... I used dmd/dub on an arch linux machine for some time in the past without any problem. Now I'm experiencing a strange problem after switching to a debian jessie (testing) machine when compiling even the simplest hello_world application :( !! After successfully compiling the source file, I get hundreds of linker error messages of the form: /usr/bin/ld: /usr/lib/x86_64-linux-gnu/libphobos2.a(aaA_52e_53e.o): relocation R_X86_64_32 against symbol `__dmd_personality_v0' can not be used when making a shared object; recompile with -fPIC It looks like the linker cannot link together phobos library modules into the final binary or something like that. I'm using the official package dmd_2.072.0-0_amd64.deb from dlang website, but also the package in debian repositories (version 2.071.2) does the same. Any idea what the problem might be?Yup lots of posts about this problem lately. Here's my answer to an identical question[0]. [0] http://forum.dlang.org/post/nvekf6$1pvb$1 digitalmars.com
Nov 18 2016
On Friday, 18 November 2016 at 13:12:14 UTC, rikki cattermole wrote:On 19/11/2016 2:09 AM, Alessandro wrote:Thank you for your support Rikki! Indeed, modifying dmd.conf as you suggested solved the problem. Sorry for duplicating posts on this: I searched for fPIC problems beforehand but somehow didn't find that previous post. Is this problem affecting debian users only? Or maybe just those using testing? Would it be an option to modify the configuration of the official .deb package accordingly? Thank you again!Hi everyone, I'm almost ashamed to ask help on this... I used dmd/dub on an arch linux machine for some time in the past without any problem. Now I'm experiencing a strange problem after switching to a debian jessie (testing) machine when compiling even the simplest hello_world application :( !! After successfully compiling the source file, I get hundreds of linker error messages of the form: /usr/bin/ld: /usr/lib/x86_64-linux-gnu/libphobos2.a(aaA_52e_53e.o): relocation R_X86_64_32 against symbol `__dmd_personality_v0' can not be used when making a shared object; recompile with -fPIC It looks like the linker cannot link together phobos library modules into the final binary or something like that. I'm using the official package dmd_2.072.0-0_amd64.deb from dlang website, but also the package in debian repositories (version 2.071.2) does the same. Any idea what the problem might be?Yup lots of posts about this problem lately. Here's my answer to an identical question[0]. [0] http://forum.dlang.org/post/nvekf6$1pvb$1 digitalmars.com
Nov 18 2016
On 19/11/2016 3:05 AM, Alessandro wrote:On Friday, 18 November 2016 at 13:12:14 UTC, rikki cattermole wrote:No problem, its Ubuntu/Debian has moved over to a hardened mode fairly recently and we haven't updated to match it yet.On 19/11/2016 2:09 AM, Alessandro wrote:Thank you for your support Rikki! Indeed, modifying dmd.conf as you suggested solved the problem. Sorry for duplicating posts on this: I searched for fPIC problems beforehand but somehow didn't find that previous post. Is this problem affecting debian users only? Or maybe just those using testing? Would it be an option to modify the configuration of the official .deb package accordingly? Thank you again!Hi everyone, I'm almost ashamed to ask help on this... I used dmd/dub on an arch linux machine for some time in the past without any problem. Now I'm experiencing a strange problem after switching to a debian jessie (testing) machine when compiling even the simplest hello_world application :( !! After successfully compiling the source file, I get hundreds of linker error messages of the form: /usr/bin/ld: /usr/lib/x86_64-linux-gnu/libphobos2.a(aaA_52e_53e.o): relocation R_X86_64_32 against symbol `__dmd_personality_v0' can not be used when making a shared object; recompile with -fPIC It looks like the linker cannot link together phobos library modules into the final binary or something like that. I'm using the official package dmd_2.072.0-0_amd64.deb from dlang website, but also the package in debian repositories (version 2.071.2) does the same. Any idea what the problem might be?Yup lots of posts about this problem lately. Here's my answer to an identical question[0]. [0] http://forum.dlang.org/post/nvekf6$1pvb$1 digitalmars.com
Nov 18 2016
On Friday, 18 November 2016 at 14:10:43 UTC, rikki cattermole wrote:No problem, its Ubuntu/Debian has moved over to a hardened mode fairly recently and we haven't updated to match it yet.I see. I'm happy to hear things will settle again when the .deb package will be update. By the way, I just realized the problem is still there when using dub to build my project. I added: "dflags": [ "-fPIC", "-defaultlib=libphobos2.so" ] to the dub.json file, but it still doesn't work. Also tried a couple of variants of this setting with no luck. Any suggestion?
Nov 18 2016
On Friday, 18 November 2016 at 14:54:29 UTC, Alessandro wrote:On Friday, 18 November 2016 at 14:10:43 UTC, rikki cattermole wrote:Ok, I figured it out. I forgot to build --force the whole project so that all libraries could get fPIC. Thanks a lot again!No problem, its Ubuntu/Debian has moved over to a hardened mode fairly recently and we haven't updated to match it yet.I see. I'm happy to hear things will settle again when the .deb package will be update. By the way, I just realized the problem is still there when using dub to build my project. I added: "dflags": [ "-fPIC", "-defaultlib=libphobos2.so" ] to the dub.json file, but it still doesn't work. Also tried a couple of variants of this setting with no luck. Any suggestion?
Nov 18 2016