GHC target : x86_64-unknown-linux configure: Building in-tree ghc-pwd /usr/lib/gcc/x86_64-pc-linux-gnu/6.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: utils/ghc-pwd/dist-boot/Main.o: relocation R_X86_64_32S against `.text' can not be used when making a shared object; recompile with -fPIC utils/ghc-pwd/dist-boot/Main.o: error adding symbols: Bad value collect2: error: ld returned 1 exit status configure: error: Building ghc-pwd failed ----------------------------------------------------------------- This is an unstable amd64 chroot image (named hardened-unstable_20170120-150937) at a hardened host acting as a tinderbox. ----------------------------------------------------------------- gcc-config -l: [1] x86_64-pc-linux-gnu-6.3.0 * llvm-config --version: 3.9.1 Available Python interpreters, in order of preference: [1] python3.4 [2] python2.7 (fallback) Available Ruby profiles: [1] ruby21 (with Rubygems) * java-config: -----------------------------------------------------------------
Created attachment 460780 [details] emerge-info.txt
Created attachment 460782 [details] config.log
Created attachment 460784 [details] dev-lang:ghc-7.10.3:20170121-045138.log
Created attachment 460786 [details] emerge-history.txt
Created attachment 460788 [details] environment
Created attachment 460790 [details] etc.portage.tbz2
It's not very clear what USEs were used for gcc-6.3.0. It's USE=pie, right?
(In reply to Sergei Trofimovich from comment #7) yes, the attached emerge-info.txt rukes, and etc.portage.tbz21 would contain an appropriate package.use/<foo> file otherwise, but here explicitely: ================================================================= Package Settings ================================================================= sys-devel/gcc-6.3.0::gentoo was built with the following: USE="cxx hardened (multilib) nls nptl openmp (pie) (ssp) vtv (-altivec) (-awt) -cilk -debug -doc (-fixed-point) -fortran (-gcj) -go -graphite (-jit) (-libssp) -mpx -objc -objc++ -objc-gc (-pch) -regression-test (-sanitize) -vanilla" ABI_X86="64" CXXFLAGS="-O2 -pipe -march=native"
I have the same problem here running gcc-6.3.0, as well. I see symbols like mkstemps@@GLIBC_2.11 which don't occur on my system (I have glibc-2.24) After unpacking there is a directory /var/tmp/Big_Tmp/portage/dev-lang/ghc-7.10.3/work/usr/lib64/ghc-7.10.3 which contains old libraries (from a foreign system) which cause this error. How can I rebuild this libraries i.e. how can I bootstrap ghc on my system? Thanks, Helmut
(In reply to Helmut Jarausch from comment #9) > I have the same problem here running gcc-6.3.0, as well. > > I see symbols like mkstemps@@GLIBC_2.11 which don't occur on my system (I > have glibc-2.24) That is unexpected. $ readelf -a /lib/libc-2.24.so | grep mkstemps 1635: 00000034192e1940 36 FUNC WEAK DEFAULT 12 mkstemps64@@GLIBC_2.11 1797: 00000034192e1940 36 FUNC GLOBAL DEFAULT 12 mkstemps@@GLIBC_2.11
ghc cannot be build with gcc-6.3.0 . (Stepping back to 5.4.0 via gcc-config does build ghc) Even version 8.0.2 fails with (LOTS of errors like) utils/ghc-pwd/dist-boot/Main.o: relocation R_X86_64_32S against `.text' can not be used when making a shared object; recompile with -fPIC It looks like the prebuilt libraries should be compiled with -fPIC. I don't think this would be harmful. But I cannot do it myself. Any hints how to recompile these are much appreciated.
(In reply to Helmut Jarausch from comment #11) > ghc cannot be build with gcc-6.3.0 . > > (Stepping back to 5.4.0 via gcc-config does build ghc) > > Even version 8.0.2 fails with (LOTS of errors like) > utils/ghc-pwd/dist-boot/Main.o: relocation R_X86_64_32S against `.text' can > not be used when making a shared object; recompile with -fPIC > > It looks like the prebuilt libraries should be compiled with -fPIC. > > I don't think this would be harmful. But I cannot do it myself. > Any hints how to recompile these are much appreciated. Can you provide a build.log and emerge --info so I could reproduce an error? 8.0.2 is supposed to just work on hardened.
Finally reproduced it as: $ USE=pie emerge -1 gcc $ USE=-ghcbootstrap emerge -1 =ghc-8.0.2 GHC build : x86_64-unknown-linux GHC host : x86_64-unknown-linux GHC target : x86_64-unknown-linux configure: Building in-tree ghc-pwd /usr/lib/gcc/x86_64-pc-linux-gnu/6.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: utils/ghc-pwd/dist-boot/Main.o: relocation R_X86_64_32S against `.text' can not be used when making a shared object; recompile with -fPIC /usr/lib/gcc/x86_64-pc-linux-gnu/6.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: /dev/shm/portage/dev-lang/ghc-8.0.2/work/usr/lib64/ghc-8.0.2/directory-1.3.0.0/libHSdirectory-1.3.0.0.a(Directory__307.o): relocation R_X86_64_32 against symbol `directoryzm1zi3zi0zi0_SystemziDirectory_getCurrentDirectory2_closure' can not be used when making a shared object; recompile with -fPIC /usr/lib/gcc/x86_64-pc-linux-gnu/6.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: /dev/shm/portage/dev-lang/ghc-8.0.2/work/usr/lib64/ghc-8.0.2/directory-1.3.0.0/libHSdirectory-1.3.0.0.a(Directory__302.o): relocation R_X86_64_32 against symbol `directoryzm1zi3zi0zi0_SystemziDirectory_getCurrentDirectory7_closure' can not be used when making a shared object; recompile with -fPIC ...
The workaround is to use 'LDFLAGS=-no-pie' as: LDFLAGS=-no-pie emerge -1 =ghc-8.0.2 I'll add is to the ebuild based on gcc version switch as we did with hardened/-nopie.
(In reply to Sergei Trofimovich from comment #14) > The workaround is to use 'LDFLAGS=-no-pie' as: > LDFLAGS=-no-pie emerge -1 =ghc-8.0.2 > > I'll add is to the ebuild based on gcc version switch as we did with > hardened/-nopie. Pushed hopefully working fix as: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8274b84fb061ddcb1318f1ba5625b41b197e6987 Thanks everyone!