easybuilders / easybuild-easyconfigs

A collection of easyconfig files that describe which software to build using which build options with EasyBuild.
https://easybuild.io
GNU General Public License v2.0
374 stars 700 forks source link

Linking problem with binutils-2.26 for intel-2016b, related to zlib? #3815

Closed verdurin closed 6 months ago

verdurin commented 7 years ago

Trying to build Relion for intel-2016b:

/bin/sh ./libtool --tag=CC   --mode=link gcc -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Werror -I/camp/apps/eb/software/zlib/1.2.8/include -g -O2 -fPIC  -release `cat libtool-soversion`   -o libbfd.la -rpath /camp/apps/eb/software/binutils/2.26/lib archive.lo archures.lo bfd.lo bfdio.lo bfdwin.lo cache.lo coff-bfd.lo compress.lo corefile.lo format.lo hash.lo init.lo libbfd.lo linker.lo merge.lo opncls.lo reloc.lo section.lo simple.lo stab-syms.lo stabs.lo syms.lo targets.lo binary.lo ihex.lo srec.lo tekhex.lo verilog.lo `cat ofiles` -L/camp/apps/eb/build/binutils/2.26/dummy-/binutils-2.26/bfd/../libiberty/pic -liberty -Wl,-lc,--as-needed,-lm,--no-as-needed -ldl /camp/apps/eb/software/zlib/1.2.8/lib/libz.a -ldl -Wl,-rpath=/usr/lib -Wl,-rpath=/usr/lib64 

*** Warning: Linking the shared library libbfd.la against the 
*** static library /camp/apps/eb/software/zlib/1.2.8/lib/libz.a is not portable!                                                                                                    

libtool: link: gcc -shared  -fPIC -DPIC  .libs/archive.o .libs/archures.o .libs/bfd.o .libs/bfdio.o .libs/bfdwin.o .libs/cache.o .libs/coff-bfd.o .libs/compress.o .libs/corefile.o .libs/format.o .libs/hash.o .libs/init.o .libs/libbfd.o .libs/linker.o .libs/merge.o .libs/opncls.o .libs/reloc.o .libs/section.o .libs/simple.o .libs/stab-syms.o .libs/stabs.o .libs/syms.o .libs/targets.o .libs/binary.o .libs/ihex.o .libs/srec.o .libs/tekhex.o .libs/verilog.o .libs/elf64-x86-64.o .libs/elf-ifunc.o .libs/elf-nacl.o .libs/elf64.o .libs/elf.o .libs/elflink.o .libs/elf-attrs.o .libs/elf-strtab.o .libs/elf-eh-frame.o .libs/dwarf1.o .libs/dwarf2.o .libs/elf32-i386.o .libs/elf-vxworks.o .libs/elf32.o .libs/i386linux.o .libs/aout32.o .libs/pei-i386.o .libs/peigen.o .libs/cofflink.o .libs/coffgen.o .libs/pei-x86_64.o .libs/pex64igen.o .libs/elf64-gen.o .libs/elf32-gen.o .libs/plugin.o .libs/cpu-i386.o .libs/cpu-iamcu.o .libs/cpu-l1om.o .libs/cpu-k1om.o .libs/cpu-plugin.o .libs/archive64.o   -L/camp/apps/eb/build/binutils/2.26/dummy-/binutils-2.26/bfd/../libiberty/pic -liberty /camp/apps/eb/software/zlib/1.2.8/lib/libz.a -ldl  -Wl,-lc -Wl,--as-needed -Wl,-lm -Wl,--no-as-needed -Wl,-rpath=/usr/lib -Wl,-rpath=/usr/lib64   -Wl,-soname -Wl,libbfd-2.26.20160125.so -o .libs/libbfd-2.26.20160125.so 
/usr/bin/ld: /camp/apps/eb/software/zlib/1.2.8/lib/libz.a(inflate.o): unrecognized relocation (0x2a) in section `.text'
/usr/bin/ld: final link failed: Bad value
collect2: error: ld returned 1 exit status
make[4]: *** [libbfd.la] Error 1
make[4]: Leaving directory `/camp/apps/eb/build/binutils/2.26/dummy-/binutils-2.26/bfd'                                                                                             make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory `/camp/apps/eb/build/binutils/2.26/dummy-/binutils-2.26/bfd'
make[2]: *** [all] Error 2
make[2]: Leaving directory `/camp/apps/eb/build/binutils/2.26/dummy-/binutils-2.26/bfd' 
make[1]: *** [all-bfd] Error 2 
make[1]: Leaving directory `/camp/apps/eb/build/binutils/2.26/dummy-/binutils-2.26' 
make: *** [all] Error 2
(at easybuild/tools/run.py:438 in parse_cmd_output)                                                                                                                                == 2016-11-16 23:10:28,045 easyblock.py:2498 WARNING build failed (first 300 chars): cmd " env LIBS='-Wl,-rpath=/usr/lib -Wl,-rpath=/usr/lib64'  make -j 4  CFLAGS="-g -O2 -fPIC" " exited with exitcode 2 and output:

This is with minimal-toolchains enabled, in case that's relevant.

verdurin commented 7 years ago

This is the system binutils:

rpm -q binutils
binutils-2.23.52.0.1-55.el7.x86_64
verdurin commented 7 years ago

With minimal-toolchains disabled it gets further, until it hits #3800

boegel commented 7 years ago

@verdurin was this zlib built with -fPIC?

Also, I'm not sure how --minimal-toolchains can help here, you still need that binutils?

verdurin commented 7 years ago

@boegel - yes, it was

Only mentioned minimal-toolchains in case it was relevant. It's enabled by default at our site.

It also happens with foss-2016b.

verdurin commented 7 years ago

Sort of related, but I can't build this for foss on a Fedora 25 system either, owing to the native GCC 6.

See https://sourceware.org/bugzilla/show_bug.cgi?id=19751

Do I need to use the newer toolchains including binutils-2.27 on systems with that OS?

flakrat commented 7 years ago

I'm encountering this as well, unable to build binutils-2.26.eb (originally was trying to build R-3.3.1-foss-2016b.eb)

What ended up working for me was to remove zlib/1.2.8 (and its module file) followed by rebuilding it, then binutils-2.26.eb built successfully

bin/ld: /share/apps/rc/software/zlib/1.2.8/lib/libz.a(inflate.o): relocation R_X86_64_32S against `zcfree' can not be used when making a shared object; recompile with -fPIC
/share/apps/rc/software/zlib/1.2.8/lib/libz.a: could not read symbols: Bad value
boegel commented 7 years ago

@flakrat In your case, that's probably because you had an old installation of zlib/1.2.8 in place that was not built with -fPIC (that was changed in Sept'16, see https://github.com/hpcugent/easybuild-easyconfigs/pull/3586, included in EasyBuild v2.9.0)

boegel commented 7 years ago

@verdurin You can't build a binutils that is older than the one your OS is using, in my experience.

Did you ever figure out a solution for the original issue reported here? I wonder what the /usr/bin/ld: /camp/apps/eb/software/zlib/1.2.8/lib/libz.a(inflate.o): unrecognized relocation (0x2a) in section '.text' error is about if that zlib installation was done with -fPIC...

boegel commented 7 years ago

@verdurin any updates?

Micket commented 6 months ago

Looks like the classic older-binutils-than-OS at play here and probably nothing else (and if it was, it's long since outdated). Closing.