digitalmars.D.learn - Cannot link with libphobos2.a with GCC 6.2 on Ubuntu 16.10
- =?UTF-8?B?Tm9yZGzDtnc=?= (12/12) Oct 13 2016 I just upgraded my Ubuntu to 16.10 and now my rebuilding of dmd
- =?UTF-8?B?Tm9yZGzDtnc=?= (4/6) Oct 13 2016 Compiling DMD with GCC 5 as
- Matthias Klumpp (4/11) Oct 13 2016 The new toolchains of Ubuntu (and Debian soon too) default to PIE
- =?UTF-8?B?Tm9yZGzDtnc=?= (6/9) Oct 13 2016 So how do I do this?
- =?UTF-8?B?Tm9yZGzDtnc=?= (2/4) Oct 13 2016 Is this what AUTO_BOOTSTRAP=1 is for and what does it do?
- Martin Nowak (4/7) Oct 17 2016 Please update the bug report.
- Martin Nowak (3/5) Oct 24 2016 Updated, but do I seriously have to do everything? I'm not even
- Adam D. Ruppe (3/3) Oct 13 2016 Try `-defaultlib=libphobos2.so` with your dmd command line. The
- =?UTF-8?B?Tm9yZGzDtnc=?= (4/6) Oct 13 2016 Building DMD fails to how do I modify the call
- =?UTF-8?B?Tm9yZGzDtnc=?= (30/33) Oct 14 2016 I don't know how to do that from the command line. I don't want
- tcak (13/26) Oct 16 2016 I have upgraded my Ubuntu to 16.10 yesterday as well, and I am
- tcak (4/20) Oct 16 2016 Hmm. As the error message says, I compiled the program by adding
- =?UTF-8?B?Tm9yZGzDtnc=?= (2/5) Oct 16 2016 Which flag(s) in `src/posix.mak` did you change?
- =?UTF-8?B?Tm9yZGzDtnc=?= (6/7) Oct 16 2016 Does
- tcak (9/16) Oct 16 2016 Well, I haven't made any changes anywhere at all. I always
- =?UTF-8?B?Tm9yZGzDtnc=?= (13/15) Oct 17 2016 Where did you add it?
- =?UTF-8?B?Tm9yZGzDtnc=?= (2/4) Oct 17 2016 It's the target `idgen` that fails for me.
- Jacob Carlborg (5/6) Oct 17 2016 "idgen" is a separate target [1]. It's a tool that generates some code.
I just upgraded my Ubuntu to 16.10 and now my rebuilding of dmd from git master fails as /usr/bin/ld: idgen.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_a_66e.o): relocation R_X86_64_32 against symbol `__dmd_personality_v0' can not be used when making a shared object; recompile with -fPIC What's wrong? Am I using the wrong GCC version? Should I use GCC 5 instead? GCC 6.2 is default on 16.10.
Oct 13 2016
On Thursday, 13 October 2016 at 17:02:32 UTC, Nordlöw wrote:Am I using the wrong GCC version? Should I use GCC 5 instead? GCC 6.2 is default on 16.10.Compiling DMD with GCC 5 as make -f posix.mak HOST_CXX=g++-5 also fails with same errors.
Oct 13 2016
On Thursday, 13 October 2016 at 17:07:19 UTC, Nordlöw wrote:On Thursday, 13 October 2016 at 17:02:32 UTC, Nordlöw wrote:The new toolchains of Ubuntu (and Debian soon too) default to PIE code, so in order to link correctly, the project needs to be compiled with PIE/PIC to work.Am I using the wrong GCC version? Should I use GCC 5 instead? GCC 6.2 is default on 16.10.Compiling DMD with GCC 5 as make -f posix.mak HOST_CXX=g++-5 also fails with same errors.
Oct 13 2016
On Thursday, 13 October 2016 at 18:35:43 UTC, Matthias Klumpp wrote:The new toolchains of Ubuntu (and Debian soon too) default to PIE code, so in order to link correctly, the project needs to be compiled with PIE/PIC to work.So how do I do this? Instructions? Can I bootstrap DMD or do I need to cross-compile to the new PIE/PIC?
Oct 13 2016
On Thursday, 13 October 2016 at 19:01:55 UTC, Nordlöw wrote:Can I bootstrap DMD or do I need to cross-compile to the new PIE/PIC?Is this what AUTO_BOOTSTRAP=1 is for and what does it do?
Oct 13 2016
On Thursday, 13 October 2016 at 18:35:43 UTC, Matthias Klumpp wrote:The new toolchains of Ubuntu (and Debian soon too) default to PIE code, so in order to link correctly, the project needs to be compiled with PIE/PIC to work.Please update the bug report. https://issues.dlang.org/show_bug.cgi?id=5278
Oct 17 2016
On Monday, 17 October 2016 at 11:55:03 UTC, Martin Nowak wrote:Please update the bug report. https://issues.dlang.org/show_bug.cgi?id=5278Updated, but do I seriously have to do everything? I'm not even an Ubuntu user.
Oct 24 2016
Try `-defaultlib=libphobos2.so` with your dmd command line. The .so version is pic compiled. Or you can recompile the whole lib.
Oct 13 2016
On Thursday, 13 October 2016 at 19:11:36 UTC, Adam D. Ruppe wrote:Try `-defaultlib=libphobos2.so` with your dmd command line. The .so version is pic compiled.Building DMD fails to how do I modify the call make -f posix.mak under the dmd checkout?
Oct 13 2016
On Thursday, 13 October 2016 at 19:11:36 UTC, Adam D. Ruppe wrote:Try `-defaultlib=libphobos2.so` with your dmd command line. The .so version is pic compiled. Or you can recompile the whole lib.I don't know how to do that from the command line. I don't want to hand modify the Makefile because I want this automatic. Instead I tried make -f posix.mak AUTO_BOOTSTRAP=1 but that fails as ++ -c -Wno-deprecated -Wstrict-aliasing -fno-exceptions -fno-rtti -D__pascal= -DMARS=1 -DTARGET_LINUX=1 -DDM_TARGET_CPU_X86=1 -m64 -Iroot -Itk -Ibackend -I. -DDMDV2=1 -MMD -MF cgsched.deps backend/cgsched.c backend/cg87.c: In function ‘unsigned char loadconst(elem*, int)’: backend/cg87.c:716:46: error: narrowing conversion of ‘238’ from ‘int’ to ‘char’ inside { } [-Wnarrowing] {0xEE,0xE8,0xEB,0xE9,0xEA,0xEC,0xED,0}; ^ backend/cg87.c:716:46: error: narrowing conversion of ‘232’ from ‘int’ to ‘char’ inside { } [-Wnarrowing] backend/cg87.c:716:46: error: narrowing conversion of ‘235’ from ‘int’ to ‘char’ inside { } [-Wnarrowing] backend/cg87.c:716:46: error: narrowing conversion of ‘233’ from ‘int’ to ‘char’ inside { } [-Wnarrowing] backend/cg87.c:716:46: error: narrowing conversion of ‘234’ from ‘int’ to ‘char’ inside { } [-Wnarrowing] backend/cg87.c:716:46: error: narrowing conversion of ‘236’ from ‘int’ to ‘char’ inside { } [-Wnarrowing] backend/cg87.c:716:46: error: narrowing conversion of ‘237’ from ‘int’ to ‘char’ inside { } [-Wnarrowing] posix.mak:446: receptet för målet ”cg87.o” misslyckades on Ubuntu 16.10. It seems we need fix the implicit conversion in cg87.c to match stricter type-checking in GCC 6.2.
Oct 14 2016
On Thursday, 13 October 2016 at 17:02:32 UTC, Nordlöw wrote:I just upgraded my Ubuntu to 16.10 and now my rebuilding of dmd from git master fails as /usr/bin/ld: idgen.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_a_66e.o): relocation R_X86_64_32 against symbol `__dmd_personality_v0' can not be used when making a shared object; recompile with -fPIC What's wrong? Am I using the wrong GCC version? Should I use GCC 5 instead? GCC 6.2 is default on 16.10.I have upgraded my Ubuntu to 16.10 yesterday as well, and I am getting following error: /usr/bin/ld: obj/Debug/program.o: relocation R_X86_64_32 against symbol `_D9Exception7__ClassZ' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/lib/x86_64-linux-gnu/libphobos2.a(object_1_257.o): relocation R_X86_64_32 against symbol `__dmd_personality_v0' can not be used when making a shared object; recompile with -fPIC ... I guess the problem is same. Even though I have added "-defaultlib=libphobos2.so" to compiler options, problem persists.
Oct 16 2016
On Sunday, 16 October 2016 at 17:42:44 UTC, tcak wrote:On Thursday, 13 October 2016 at 17:02:32 UTC, Nordlöw wrote:Hmm. As the error message says, I compiled the program by adding "-fPIC", it really has stopped giving error messages. That came to me weird.[...]I have upgraded my Ubuntu to 16.10 yesterday as well, and I am getting following error: /usr/bin/ld: obj/Debug/program.o: relocation R_X86_64_32 against symbol `_D9Exception7__ClassZ' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/lib/x86_64-linux-gnu/libphobos2.a(object_1_257.o): relocation R_X86_64_32 against symbol `__dmd_personality_v0' can not be used when making a shared object; recompile with -fPIC ... I guess the problem is same. Even though I have added "-defaultlib=libphobos2.so" to compiler options, problem persists.
Oct 16 2016
On Sunday, 16 October 2016 at 20:01:21 UTC, tcak wrote:Hmm. As the error message says, I compiled the program by adding "-fPIC", it really has stopped giving error messages. That came to me weird.Which flag(s) in `src/posix.mak` did you change?
Oct 16 2016
On Sunday, 16 October 2016 at 22:00:48 UTC, Nordlöw wrote:Which flag(s) in `src/posix.mak` did you change?Does make -f posix.mak MODEL_FLAG=-fPIC work? I'm sitting on a 16.04 system right now (which I don't dare to upgrade until this is fixed) so I'm just guessing.
Oct 16 2016
On Sunday, 16 October 2016 at 22:36:15 UTC, Nordlöw wrote:On Sunday, 16 October 2016 at 22:00:48 UTC, Nordlöw wrote:Well, I haven't made any changes anywhere at all. I always download the deb file and install it. My program was compiling on 16.04, and wasn't compiling on 16.10. So, I added -defaultlib=libphobos2.so -fPIC while compiling. That's it. But as you can guess, now I have to copy the libphobos on other computers as well as the executable. (libphotos2.so.0.71 is 9 MiB)Which flag(s) in `src/posix.mak` did you change?Does make -f posix.mak MODEL_FLAG=-fPIC work? I'm sitting on a 16.04 system right now (which I don't dare to upgrade until this is fixed) so I'm just guessing.
Oct 16 2016
On Monday, 17 October 2016 at 05:55:55 UTC, tcak wrote:So, I added -defaultlib=libphobos2.so -fPICWhere did you add it? To the command-line or Makefile? And which Make variable did you change? I've tried make -f posix.mak MODEL_FLAG="-fPIC" but C++ compilations still fail with complaining about libphobos2.a not being compiled with -fPIC flag. -defaultlib is a DMD flag so that has not effect with the C++ compilations. This must be fixed in the DMD Makefiles! I you only tell me what to do I can make a PR to DMD that fixes these things.
Oct 17 2016
On Monday, 17 October 2016 at 08:39:55 UTC, Nordlöw wrote:I you only tell me what to do I can make a PR to DMD that fixes these things.It's the target `idgen` that fails for me.
Oct 17 2016
On 2016-10-17 10:55, Nordlöw wrote:It's the target `idgen` that fails for me."idgen" is a separate target [1]. It's a tool that generates some code. [1] https://github.com/dlang/dmd/blob/master/src/posix.mak#L389 -- /Jacob Carlborg
Oct 17 2016