Further investigation reveals this is specific to bulding gccjit - the
rest is compiling without issue.
Looks like https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64296
The suggested workaround - adding --with-pic to configure - seems to work.
However, --with-pic is not documented in
https://gcc.gnu.org/install/configure.html or in the output of
./configure --help
On 03/06/2016 09:09 PM, Daniel Letai wrote:
Hi,
I'm trying to build a gcc-5.3 package for rhel 6 x64 (based on
gcc-5.3.1 from koji) with the prerequisites in tree, as if after using
the contrib/download_prerequisites but with newer versions of those
libraries.
The exact error:
/opt/gnu/binutils/2.26/bin/ld:
/home/rpmbuild/BUILD/gcc-5.3.1-20160212/obj-x86_64-redhat-linux/objlibgccjit/./isl/.libs/libisl.a(isl_val_gmp.o):
relocation R_X86_64_32 against `.rodata.str1.1' can not be used when
making a shared object; recompile with -fPIC
/home/rpmbuild/BUILD/gcc-5.3.1-20160212/obj-x86_64-redhat-linux/objlibgccjit/./isl/.libs/libisl.a:
error adding symbols: Bad value
collect2: error: ld returned 1 exit status
make[1]: *** [libgccjit.so.0.0.1] Error 1
make[1]: *** Waiting for unfinished jobs....
rm gcov-tool.pod gcov.pod cpp.pod gfdl.pod fsf-funding.pod gcc.pod
make[1]: Leaving directory
`/home/rpmbuild/BUILD/gcc-5.3.1-20160212/obj-x86_64-redhat-linux/objlibgccjit/gcc'
make: *** [all-gcc] Error 2
error: Bad exit status from /var/tmp/rpm-tmp.Qe5BHa (%build)
RPM build errors:
Bad exit status from /var/tmp/rpm-tmp.Qe5BHa (%build)
Since gcc/configure doesn't accept -fPIC, I'm not sure how to proceed
- How do I tell gcc configure to pass -fPIC to just the isl library,
and only when building objlibgccjit?
Any help would be appreciated, thanks.
I'd like to mention that the installation failed with the versions
from contrib too
My current environment:
RHEL 6.7 x64
binutils 2.26 (compiled from source)
GMP 6.1.0
MPFR 3.1.3 (with latest "allpatches" applied)
MPC 1.0.3
ISL 0.16
My configure looks like:
+ CC=gcc
+ CXX=g++
++ echo -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions
-fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic
++ sed -e 's/\(-Wp,\)\?-D_FORTIFY_SOURCE=[12]//g'
+ OPT_FLAGS='-O2 -g -pipe -Wall -fexceptions -fstack-protector
--param=ssp-buffer-size=4 -m64 -mtune=generic'
++ echo -O2 -g -pipe -Wall -fexceptions -fstack-protector
--param=ssp-buffer-size=4 -m64 -mtune=generic
++ sed -e 's/-m64//g;s/-m32//g;s/-m31//g'
+ OPT_FLAGS='-O2 -g -pipe -Wall -fexceptions -fstack-protector
--param=ssp-buffer-size=4 -mtune=generic'
++ echo -O2 -g -pipe -Wall -fexceptions -fstack-protector
--param=ssp-buffer-size=4 -mtune=generic
++ sed -e 's/-mfpmath=sse/-mfpmath=sse -msse2/g'
+ OPT_FLAGS='-O2 -g -pipe -Wall -fexceptions -fstack-protector
--param=ssp-buffer-size=4 -mtune=generic'
++ echo -O2 -g -pipe -Wall -fexceptions -fstack-protector
--param=ssp-buffer-size=4 -mtune=generic
++ sed -e 's/ -pipe / /g'
+ OPT_FLAGS='-O2 -g -Wall -fexceptions -fstack-protector
--param=ssp-buffer-size=4 -mtune=generic'
++ echo '-O2 -g -Wall -fexceptions -fstack-protector
--param=ssp-buffer-size=4 -mtune=generic'
++ sed -e 's/[[:blank:]]\+/ /g'
+ OPT_FLAGS='-O2 -g -Wall -fexceptions -fstack-protector
--param=ssp-buffer-size=4 -mtune=generic'
+ case "$OPT_FLAGS" in
+ enablelgo=
+ enablelada=
+ CONFIGURE_OPTS=' --prefix=/opt/gnu/gcc/5.3.1
--mandir=/opt/gnu/gcc/5.3.1/share/man
--infodir=/opt/gnu/gcc/5.3.1/share/info
--with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared
--enable-threads=posix --enable-checking=release --enable-multilib
--with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions --enable-gnu-unique-object
--enable-linker-build-id --with-linker-hash-style=gnu --enable-plugin
--enable-initfini-array --disable-libgcj
--with-default-libstdcxx-abi=gcc4-compatible --with-isl
--enable-libmpx --with-tune=generic --with-arch_32=i686
--build=x86_64-redhat-linux '
+ CC=gcc
+ CXX=g++
+ CFLAGS='-O2 -g -Wall -fexceptions -fstack-protector
--param=ssp-buffer-size=4 -mtune=generic'
++ echo ' -O2 -g -Wall -fexceptions -fstack-protector
--param=ssp-buffer-size=4 -mtune=generic '
++ sed 's/ -Wall / /g;s/ -fexceptions / /g'
++ sed 's/ -Werror=format-security / -Wformat -Werror=format-security /'
+ CXXFLAGS=' -O2 -g -fstack-protector --param=ssp-buffer-size=4
-mtune=generic '
+ XCFLAGS='-O2 -g -Wall -fexceptions -fstack-protector
--param=ssp-buffer-size=4 -mtune=generic'
+ TCFLAGS='-O2 -g -Wall -fexceptions -fstack-protector
--param=ssp-buffer-size=4 -mtune=generic'
+ ../configure --enable-bootstrap
--enable-languages=c,c++,objc,obj-c++,fortran,lto
--prefix=/opt/gnu/gcc/5.3.1 --mandir=/opt/gnu/gcc/5.3.1/share/man
--infodir=/opt/gnu/gcc/5.3.1/share/info
--with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared
--enable-threads=posix --enable-checking=release --enable-multilib
--with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions --enable-gnu-unique-object
--enable-linker-build-id --with-linker-hash-style=gnu --enable-plugin
--enable-initfini-array --disable-libgcj
--with-default-libstdcxx-abi=gcc4-compatible --with-isl
--enable-libmpx --with-tune=generic --with-arch_32=i686
--build=x86_64-redhat-linux