fastq-tools icon indicating copy to clipboard operation
fastq-tools copied to clipboard

Linking failure with gold

Open verdurin opened this issue 8 years ago • 4 comments

I'm building an EasyBuild module for fastq-tools.

Compilation fails because a spurious linker option is used:

== 2016-05-08 08:08:13,937 build_log.py:152 ERROR cmd " make -j 4 LIBTOOL=libtool" exited with exitcode 2 and output:
Making all in src
make[1]: Entering directory '/home/adam/.local/easybuild/build/fastqtools/0.8/foss-2016a/fastq-tools-0.8/src'
  CC       fastq-grep.o
  CC       common.o
  CC       parse.o
  CC       fastq-kmers.o
  CC       fastq-match.o
  CC       sw.o
  CC       fastq-uniq.o
  CC       hash_table.o
  CC       fastq-qual.o
  CC       fastq-sample.o
  CC       rng.o
  CC       fastq-qualadj.o
  CC       fastq-sort.o
fastq-sort.c: In function ‘seq_array_dump’:
fastq-sort.c:402:5: warning: implicit declaration of function ‘mktemp’ [-Wimplicit-function-declaration]
     if (mktemp(fn) == NULL) {
     ^
fastq-sort.c:402:20: warning: comparison between pointer and integer
     if (mktemp(fn) == NULL) {
                    ^
  CC       fastq-qscale.o
  CCLD     fastq-grep
fastq-qscale.c: In function ‘fastq_qualscale’:
fastq-qscale.c:61:21: warning: ‘compat_scales’ may be used uninitialized in this function [-Wmaybe-uninitialized]
     return x && !(x & (x - 1));
                     ^
fastq-qscale.c:89:14: note: ‘compat_scales’ was declared here
     uint32_t compat_scales;
              ^
  CCLD     fastq-kmers
  CCLD     fastq-match
/home/adam/.local/easybuild/software/binutils/2.25-GCCcore-4.9.3/bin/ld.gold: error: cannot find -lpthread-lm
collect2: error: ld returned 1 exit status
Makefile:444: recipe for target 'fastq-grep' failed
make[1]: *** [fastq-grep] Error 1
make[1]: *** Waiting for unfinished jobs....
/home/adam/.local/easybuild/software/binutils/2.25-GCCcore-4.9.3/bin/ld.gold: error: cannot find -lpthread-lm
collect2: error: ld returned 1 exit status
Makefile:448: recipe for target 'fastq-kmers' failed
make[1]: *** [fastq-kmers] Error 1
/home/adam/.local/easybuild/software/binutils/2.25-GCCcore-4.9.3/bin/ld.gold: error: cannot find -lpthread-lm
collect2: error: ld returned 1 exit status
Makefile:452: recipe for target 'fastq-match' failed
make[1]: *** [fastq-match] Error 1
make[1]: Leaving directory '/home/adam/.local/easybuild/build/fastqtools/0.8/foss-2016a/fastq-tools-0.8/src'
Makefile:376: recipe for target 'all-recursive' failed
make: *** [all-recursive] Error 1

If I compile on the same system using the native toolchain, rather than the EasyBuild one, it works.

The config.log between the two attempts differs here:

-ac_cv_env_LDFLAGS_set=set
-ac_cv_env_LDFLAGS_value='-L/home/adam/.local/easybuild/software/GCCcore/4.9.3/lib64 -L/home/adam/.local/easybuild/software/GCCcore/4.9.3/lib -L/home/adam/.local/easybuild/software/OpenBLAS/0.2.15-GCC-4.9.3-2.25-LAPACK-3.6.0/lib -L/home/a
dam/.local/easybuild/software/ScaLAPACK/2.0.2-gompi-2016a-OpenBLAS-0.2.15-LAPACK-3.6.0/lib -L/home/adam/.local/easybuild/software/FFTW/3.3.4-gompi-2016a/lib -L/home/adam/.local/easybuild/software/PCRE/8.38-foss-2016a/lib -L/home/adam/.loc
al/easybuild/software/zlib/1.2.8-foss-2016a/lib -L/home/adam/.local/easybuild/software/libtool/2.4.6-foss-2016a/lib'
-ac_cv_env_LIBS_set=set
-ac_cv_env_LIBS_value='-lm -lpthread'
+ac_cv_env_LDFLAGS_set=
+ac_cv_env_LDFLAGS_value=
+ac_cv_env_LIBS_set=
+ac_cv_env_LIBS_value=

with the second output being the working one.

Other differences:

-gcc (GCC) 4.9.3
+gcc (GCC) 5.3.1 20160406 (Red Hat 5.3.1-6)
-COLLECT_GCC=gcc
-COLLECT_LTO_WRAPPER=/home/adam/.local/easybuild/software/GCCcore/4.9.3/libexec/gcc/x86_64-unknown-linux-gnu/4.9.3/lto-wrapper
-Target: x86_64-unknown-linux-gnu
-Configured with: ../configure --enable-languages=c,c++,fortran --enable-lto --enable-checking=release --disable-multilib --enable-shared=yes --enable-static=yes --enable-threads=posix --enable-gold=default --enable-plugins --enable-ld --with-plugin-ld=ld.gold --enable-bootstrap --prefix=/home/adam/.local/easybuild/software/GCCcore/4.9.3 --with-local-prefix=/home/adam/.local/easybuild/software/GCCcore/4.9.3
+COLLECT_GCC=/usr/bin/gcc
+COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/5.3.1/lto-wrapper
+Target: x86_64-redhat-linux
+Configured with: ../configure --enable-bootstrap --enable-languages=c,c++,objc,obj-c++,fortran,ada,go,lto --prefix=/usr --mandir=/usr/share/man --infodir=/usr/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-isl --enable-libmpx --enable-gnu-indirect-function --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux

Is this a problem with the EasyBuild toolchain, or something that can be fixed in fastq-tools?

verdurin avatar May 08 '16 07:05 verdurin

Further to this, EasyBuild sets the following:

export LIBS="-lm -lpthread"

which looks fine to me, implying that the problem does lie with fastq-tools.

Is there a missing space somewhere, leading to the garbled linker line?

verdurin avatar May 08 '16 21:05 verdurin

Looking at this again, I see in the config.log output:

LIBS='-lm -lpthread-lm'

so it looks like a spurious -lm is being added to the EasyBuild value, without a space.

verdurin avatar Jul 27 '16 09:07 verdurin

@verdurin The problem is this line https://github.com/dcjones/fastq-tools/blob/master/configure.ac#L56 which just adds -lm to LIBS. I created an issue for that: https://github.com/dcjones/fastq-tools/issues/20. And we now got a working EasyConfig for fastq-tools: https://github.com/easybuilders/easybuild-easyconfigs/pull/5396. The issue https://github.com/easybuilders/easybuild-easyconfigs/issues/3011 can also be closed?

SethosII avatar Jun 29 '18 05:06 SethosII

@SethosII yes, it can. Thanks for the update.

verdurin avatar Jun 29 '18 06:06 verdurin