https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70211
Bug ID: 70211 Summary: gcc-6-20160306 fails to build on ARM Linux with in tree ISL due to undefined GMP symbol __gmpn_invert_limb in isl_test Product: gcc Version: 6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: bootstrap Assignee: unassigned at gcc dot gnu.org Reporter: andrewm.roberts at sky dot com Target Milestone: --- Build of gcc-6-20160306 fails on ARM Linux when building in tree ISL due to undefined GMP symbol __gmpn_invert_limb when building isl_test This failure dates back to at least 2013 as Linux From Scratch references it here: https://sourceware.org/bugzilla/attachment.cgi?id=6807 # PiLFS Build Script SVN-20130102 v1.0 ... # Workaround for a problem introduced with GMP 5.1.0. # If configured by gcc with the "none" host & target, it will result in undefined references to '__gmpn_invert_limb' during linking. # Should be fixed by next version of gcc, but let me know if you have any more ideas on this. sed -i 's/none-/armv6l-/' Makefile Make Error: ... /bin/sh ./libtool --tag=CC --mode=link armv7l-unknown-linux-gnueabihf-gcc -O2 -march=armv7-a -pipe -static-libstdc++ -static-libgcc -o isl_test isl_test.o libisl.la /home/alarm/gcc/gcc-build/./gmp/libgmp.la libtool: link: armv7l-unknown-linux-gnueabihf-gcc -O2 -march=armv7-a -pipe -static-libstdc++ -static-libgcc -o isl_test isl_test.o ./.libs/libisl.a /home/alarm/gcc/gcc-build/./gmp/.libs/libgmp.a /home/alarm/gcc/gcc-build/./gmp/.libs/libgmp.a(divrem_1.o): In function `__gmpn_divrem_1': divrem_1.c:(.text+0xb0): undefined reference to `__gmpn_invert_limb' divrem_1.c:(.text+0x1d4): undefined reference to `__gmpn_invert_limb' /home/alarm/gcc/gcc-build/./gmp/.libs/libgmp.a(mod_1.o): In function `__gmpn_mod_1': mod_1.c:(.text+0x60): undefined reference to `__gmpn_invert_limb' mod_1.c:(.text+0x170): undefined reference to `__gmpn_invert_limb' /home/alarm/gcc/gcc-build/./gmp/.libs/libgmp.a(div_q.o): In function `__gmpn_div_q': div_q.c:(.text+0x174): undefined reference to `__gmpn_invert_limb' /home/alarm/gcc/gcc-build/./gmp/.libs/libgmp.a(div_q.o):div_q.c:(.text+0x460): more undefined references to `__gmpn_invert_limb' follow collect2: error: ld returned 1 exit status Makefile:1276: recipe for target 'isl_test' failed The failure is due to --host=none-... and --target=none-... appearing the gcc-build/gcc/Makefile for the configure-gmp target after configure. This happens on (at least) armv6l (Raspberry Pi) and armv7l (Raspberry Pi 3) Editing the makefile to replace 'none-' with 'armv6l-' or 'armv7l-' allows the build to complete. Built Using: tar -xjf gcc-6-20160306.tar.bz2 mv gcc-6-20160306 gcc-6.0.0 cd gcc-6.0.0 # From ftp://gcc.gnu.org/pub/gcc/infrastructure/ tar -xjf isl-0.16.1.tar.bz ln -sf isl-0.16.1 isl cd isl # This version of ISL is using older version of automake, needs reconfigure autoreconf cd .. # From MPFR website tar -xjf mpfr-3.1.4.tar.bz2 ln -sf mpfr-3.1.4 mpfr # From MPC website tar -xzf mpc-1.0.3.tar.gz ln -sf mpc-1.0.3 mpc # From GMP website tar -xjf gmp-6.1.0.tar.bz2 ln -sf gmp-6.1.0 gmp cd .. mkdir gcc-build cd gcc-build ../gcc-6.0.0/configure --prefix=/usr/local/gcc-6.0.0 --program-suffix= \ --enable-languages=c,c++,fortran --enable-shared --enable-threads=posix \ --with-system-zlib --with-isl --enable-__cxa_atexit \ --disable-libunwind-exceptions --enable-clocale=gnu --disable-libstdcxx-pch \ --disable-libssp --enable-gnu-unique-object --enable-linker-build-id \ --enable-lto --enable-plugin --enable-install-libiberty \ --with-linker-hash-style=gnu --enable-gnu-indirect-function \ --disable-multilib --disable-werror --enable-checking=release \ --host=armv7l-unknown-linux-gnueabihf --build=armv7l-unknown-linux-gnueabihf \ --target=armv7l-unknown-linux-gnueabihf --with-arch=armv7-a \ --with-float=hard --with-fpu=vfpv3-d16 --disable-bootstrap # then run make Resulting Makefile: ... .PHONY: configure-gmp maybe-configure-gmp maybe-configure-gmp: maybe-configure-gmp: configure-gmp configure-gmp: ... $(SHELL) \ $$s/$$module_srcdir/configure \ --srcdir=$${topdir}/$$module_srcdir \ $(HOST_CONFIGARGS) --build=${build_alias} --host=none-${host_vendor}-$ {host_os} \ --target=none-${host_vendor}-${host_os} --disable-shared LEX="touch le x.yy.c" \ || exit 1 ... The --host=none- --target=none- cause the build of intree ISL to fail: Built on Arch Linux Arm: uname -a Linux alarmpi 4.1.19-4-ARCH #1 SMP Wed Mar 9 18:23:02 MST 2016 armv7l GNU/Linux Using tools: automake: 1.15-1 autoconf 2.69-2 libtool: 2.4.6-4 binutils: 2.26-3 m4 1.4.17-1 Using in tree libraries: isl-0.16.1 (need to run autoreconf in isl directory before configuring) mpfr-3.1.4 mpc-1.0.3 gmp-6.1.0 Host gcc: gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/lib/gcc/armv7l-unknown-linux-gnueabihf/5.3.0/lto-wrapper Target: armv7l-unknown-linux-gnueabihf Configured with: /build/gcc/src/gcc-5-20160209/configure --prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=https://github.com/archlinuxarm/PKGBUILDs/issues --enable-languages=c,c++,fortran,go,lto,objc,obj-c++ --enable-shared --enable-threads=posix --with-system-zlib --with-isl --enable-__cxa_atexit --disable-libunwind-exceptions --enable-clocale=gnu --disable-libstdcxx-pch --disable-libssp --enable-gnu-unique-object --enable-linker-build-id --enable-lto --enable-plugin --enable-install-libiberty --with-linker-hash-style=gnu --enable-gnu-indirect-function --disable-multilib --disable-werror --enable-checking=release --host=armv7l-unknown-linux-gnueabihf --build=armv7l-unknown-linux-gnueabihf --with-arch=armv7-a --with-float=hard --with-fpu=vfpv3-d16 Thread model: posix gcc version 5.3.0 (GCC)