nygenome/lancet

built error: ld returned 1 exit status

axiba053 opened this issue · 7 comments

Hello,
I get errors when make lancet. I was wondering if you could help me with this issue.Thanks in advanced!

Version information:

cmake version 3.13.4
GNU Make 4.2.1
gcc version 8.3.0 (Debian 8.3.0-6)

Entire log :

mkdir /biosoft/lancet/bamtools-2.5.1/build; cd /biosoft/lancet/bamtools-2.5.1/build; cmake -DCMAKE_INSTALL_PREFIX=../ ..; make; make install; cd ../../
mkdir: cannot create directory ‘/biosoft/lancet/bamtools-2.5.1/build’: File exists
CMake Deprecation Warning at CMakeLists.txt:20 (cmake_policy):
  The OLD behavior for policy CMP0042 will be removed from a future version
  of CMake.

  The cmake-policies(7) manual explains that the OLD behaviors of all
  policies are deprecated and that a policy should be set to OLD only under
  specific short-term circumstances.  Projects should be ported to the NEW
  behavior and not rely on setting a policy to OLD.


-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29") 
-- Checking for one of the modules 'jsoncpp>=1'
Did NOT find system JsonCpp, instead using bundled version
-- Configuring done
-- Generating done
-- Build files have been written to: /biosoft/lancet/bamtools-2.5.1/build
make[1]: Entering directory '/biosoft/lancet/bamtools-2.5.1/build'
make[2]: Entering directory '/biosoft/lancet/bamtools-2.5.1/build'
make[3]: Entering directory '/biosoft/lancet/bamtools-2.5.1/build'
make[3]: Leaving directory '/biosoft/lancet/bamtools-2.5.1/build'
make[3]: Entering directory '/biosoft/lancet/bamtools-2.5.1/build'
make[3]: Leaving directory '/biosoft/lancet/bamtools-2.5.1/build'
[  0%] Built target SharedHeaders
make[3]: Entering directory '/biosoft/lancet/bamtools-2.5.1/build'
make[3]: Leaving directory '/biosoft/lancet/bamtools-2.5.1/build'
make[3]: Entering directory '/biosoft/lancet/bamtools-2.5.1/build'
make[3]: Leaving directory '/biosoft/lancet/bamtools-2.5.1/build'
[  0%] Built target APIHeaders
make[3]: Entering directory '/biosoft/lancet/bamtools-2.5.1/build'
make[3]: Leaving directory '/biosoft/lancet/bamtools-2.5.1/build'
[ 63%] Built target BamTools
make[3]: Entering directory '/biosoft/lancet/bamtools-2.5.1/build'
make[3]: Leaving directory '/biosoft/lancet/bamtools-2.5.1/build'
make[3]: Entering directory '/biosoft/lancet/bamtools-2.5.1/build'
make[3]: Leaving directory '/biosoft/lancet/bamtools-2.5.1/build'
[ 63%] Built target AlgorithmsHeaders
make[3]: Entering directory '/biosoft/lancet/bamtools-2.5.1/build'
make[3]: Leaving directory '/biosoft/lancet/bamtools-2.5.1/build'
[ 67%] Built target jsoncpp
make[3]: Entering directory '/biosoft/lancet/bamtools-2.5.1/build'
make[3]: Leaving directory '/biosoft/lancet/bamtools-2.5.1/build'
[ 75%] Built target BamTools-utils
make[3]: Entering directory '/biosoft/lancet/bamtools-2.5.1/build'
make[3]: Leaving directory '/biosoft/lancet/bamtools-2.5.1/build'
[100%] Built target bamtools_cmd
make[2]: Leaving directory '/biosoft/lancet/bamtools-2.5.1/build'
make[1]: Leaving directory '/biosoft/lancet/bamtools-2.5.1/build'
make[1]: Entering directory '/biosoft/lancet/bamtools-2.5.1/build'
make[2]: Entering directory '/biosoft/lancet/bamtools-2.5.1/build'
make[3]: Entering directory '/biosoft/lancet/bamtools-2.5.1/build'
make[3]: Leaving directory '/biosoft/lancet/bamtools-2.5.1/build'
make[3]: Entering directory '/biosoft/lancet/bamtools-2.5.1/build'
make[3]: Leaving directory '/biosoft/lancet/bamtools-2.5.1/build'
[  0%] Built target SharedHeaders
make[3]: Entering directory '/biosoft/lancet/bamtools-2.5.1/build'
make[3]: Leaving directory '/biosoft/lancet/bamtools-2.5.1/build'
make[3]: Entering directory '/biosoft/lancet/bamtools-2.5.1/build'
make[3]: Leaving directory '/biosoft/lancet/bamtools-2.5.1/build'
[  0%] Built target APIHeaders
make[3]: Entering directory '/biosoft/lancet/bamtools-2.5.1/build'
make[3]: Leaving directory '/biosoft/lancet/bamtools-2.5.1/build'
[ 63%] Built target BamTools
make[3]: Entering directory '/biosoft/lancet/bamtools-2.5.1/build'
make[3]: Leaving directory '/biosoft/lancet/bamtools-2.5.1/build'
make[3]: Entering directory '/biosoft/lancet/bamtools-2.5.1/build'
make[3]: Leaving directory '/biosoft/lancet/bamtools-2.5.1/build'
[ 63%] Built target AlgorithmsHeaders
make[3]: Entering directory '/biosoft/lancet/bamtools-2.5.1/build'
make[3]: Leaving directory '/biosoft/lancet/bamtools-2.5.1/build'
[ 67%] Built target jsoncpp
make[3]: Entering directory '/biosoft/lancet/bamtools-2.5.1/build'
make[3]: Leaving directory '/biosoft/lancet/bamtools-2.5.1/build'
[ 75%] Built target BamTools-utils
make[3]: Entering directory '/biosoft/lancet/bamtools-2.5.1/build'
make[3]: Leaving directory '/biosoft/lancet/bamtools-2.5.1/build'
[100%] Built target bamtools_cmd
make[2]: Leaving directory '/biosoft/lancet/bamtools-2.5.1/build'
Install the project...
-- Install configuration: "Release"
-- Up-to-date: /biosoft/lancet/bamtools-2.5.1/include/bamtools/shared/bamtools_global.h
-- Up-to-date: /biosoft/lancet/bamtools-2.5.1/lib/pkgconfig/bamtools-1.pc
-- Up-to-date: /biosoft/lancet/bamtools-2.5.1/lib/libbamtools.a
-- Up-to-date: /biosoft/lancet/bamtools-2.5.1/include/bamtools/api/api_global.h
-- Up-to-date: /biosoft/lancet/bamtools-2.5.1/include/bamtools/api/BamAlgorithms.h
-- Up-to-date: /biosoft/lancet/bamtools-2.5.1/include/bamtools/api/BamAlignment.h
-- Up-to-date: /biosoft/lancet/bamtools-2.5.1/include/bamtools/api/BamAux.h
-- Up-to-date: /biosoft/lancet/bamtools-2.5.1/include/bamtools/api/BamConstants.h
-- Up-to-date: /biosoft/lancet/bamtools-2.5.1/include/bamtools/api/BamIndex.h
-- Up-to-date: /biosoft/lancet/bamtools-2.5.1/include/bamtools/api/BamMultiReader.h
-- Up-to-date: /biosoft/lancet/bamtools-2.5.1/include/bamtools/api/BamReader.h
-- Up-to-date: /biosoft/lancet/bamtools-2.5.1/include/bamtools/api/BamWriter.h
-- Up-to-date: /biosoft/lancet/bamtools-2.5.1/include/bamtools/api/IBamIODevice.h
-- Up-to-date: /biosoft/lancet/bamtools-2.5.1/include/bamtools/api/SamConstants.h
-- Up-to-date: /biosoft/lancet/bamtools-2.5.1/include/bamtools/api/SamHeader.h
-- Up-to-date: /biosoft/lancet/bamtools-2.5.1/include/bamtools/api/SamProgram.h
-- Up-to-date: /biosoft/lancet/bamtools-2.5.1/include/bamtools/api/SamProgramChain.h
-- Up-to-date: /biosoft/lancet/bamtools-2.5.1/include/bamtools/api/SamReadGroup.h
-- Up-to-date: /biosoft/lancet/bamtools-2.5.1/include/bamtools/api/SamReadGroupDictionary.h
-- Up-to-date: /biosoft/lancet/bamtools-2.5.1/include/bamtools/api/SamSequence.h
-- Up-to-date: /biosoft/lancet/bamtools-2.5.1/include/bamtools/api/SamSequenceDictionary.h
-- Up-to-date: /biosoft/lancet/bamtools-2.5.1/include/bamtools/api/algorithms/Sort.h
-- Installing: /biosoft/lancet/bamtools-2.5.1/bin/bamtools
make[1]: Leaving directory '/biosoft/lancet/bamtools-2.5.1/build'
cd /biosoft/lancet/htslib-1.8; ./configure; make; cd ../
checking for gcc... /opt/conda/bin/x86_64-conda_cos6-linux-gnu-cc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether /opt/conda/bin/x86_64-conda_cos6-linux-gnu-cc accepts -g... yes
checking for /opt/conda/bin/x86_64-conda_cos6-linux-gnu-cc option to accept ISO C89... none needed
checking for ranlib... /opt/conda/bin/x86_64-conda_cos6-linux-gnu-ranlib
checking for grep that handles long lines and -e... /bin/grep
checking for C compiler warning flags... -Wall
checking for special C compiler options needed for large files... no
checking for _FILE_OFFSET_BITS value needed for large files... no
checking for _LARGEFILE_SOURCE value needed for large files... no
checking shared library type for unknown-Linux... plain .so
checking how to run the C preprocessor... /opt/conda/bin/x86_64-conda_cos6-linux-gnu-cpp
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for stdlib.h... (cached) yes
checking for unistd.h... (cached) yes
checking for sys/param.h... yes
checking for getpagesize... yes
checking for working mmap... yes
checking for gmtime_r... yes
checking for fsync... yes
checking for drand48... yes
checking whether fdatasync is declared... yes
checking for fdatasync... yes
checking for library containing log... -lm
checking for zlib.h... yes
checking for inflate in -lz... yes
checking for library containing recv... none required
checking for bzlib.h... yes
checking for BZ2_bzBuffToBuffCompress in -lbz2... yes
checking for lzma.h... yes
checking for lzma_easy_buffer_encode in -llzma... yes
checking for libdeflate.h... yes
checking for libdeflate_deflate_compress in -ldeflate... yes
checking for curl_easy_pause in -lcurl... yes
checking for CCHmac... no
checking for library containing HMAC... -lcrypto
checking whether PTHREAD_MUTEX_RECURSIVE is declared... yes
configure: creating ./config.status
config.status: creating config.mk
config.status: creating htslib.pc.tmp
config.status: creating config.h
config.status: config.h is unchanged
make[1]: Entering directory '/biosoft/lancet/htslib-1.8'
make[1]: Nothing to be done for 'all'.
make[1]: Leaving directory '/biosoft/lancet/htslib-1.8'
cd src; make; cp lancet ../; cd ../
make[1]: Entering directory '/biosoft/lancet/src'
g++ -std=c++0x -Wno-deprecated -Wall -O3 -fexceptions -g -Wl,-rpath,/biosoft/lancet/bamtools-2.5.1/lib64/ -I/biosoft/lancet/bamtools-2.5.1/include/bamtools -I/biosoft/lancet/htslib-1.8/ -L/biosoft/lancet/bamtools-2.5.1/lib/ -L/biosoft/lancet/bamtools-2.5.1/lib64/ -L/biosoft/lancet/htslib-1.8/ Lancet.cc Edge.cc Node.cc Graph.cc Microassembler.cc Ref.cc Path.cc ContigLink.cc align.cc util.cc sha256.cc VariantDB.cc Variant.cc -o lancet /biosoft/lancet/htslib-1.8/libhts.a -llzma -lbz2 -lz -ldl -lpthread -lcurl -lcrypto -lbamtools
In file included from Variant.hh:38,
                 from Variant.cc:1:
FET.hh: In function ‘double FET_t::kt_fisher_exact(int, int, int, int, double*, double*, double*)’:
FET.hh:95:11: warning: ‘aux.FET_t::hgacc_t::n_1’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   hgacc_t aux;
           ^~~
FET.hh:71:22: warning: ‘aux.FET_t::hgacc_t::n’ may be used uninitialized in this function [-Wmaybe-uninitialized]
    if (n11%11 && n11 + aux->n - aux->n1_ - aux->n_1) {
                  ~~~~^~~~~~~~
FET.hh:95:11: note: ‘aux.FET_t::hgacc_t::n’ was declared here
   hgacc_t aux;
           ^~~
FET.hh:71:31: warning: ‘aux.FET_t::hgacc_t::n1_’ may be used uninitialized in this function [-Wmaybe-uninitialized]
    if (n11%11 && n11 + aux->n - aux->n1_ - aux->n_1) {
                  ~~~~~~~~~~~~~^~~~~~~~~~
FET.hh:95:11: note: ‘aux.FET_t::hgacc_t::n1_’ was declared here
   hgacc_t aux;
           ^~~
FET.hh:72:25: warning: ‘aux.FET_t::hgacc_t::n11’ may be used uninitialized in this function [-Wmaybe-uninitialized]
     if (n11 == aux->n11 + 1) { // incremental
                ~~~~~~~~~^~~
FET.hh:95:11: note: ‘aux.FET_t::hgacc_t::n11’ was declared here
   hgacc_t aux;
           ^~~
FET.hh:73:13: warning: ‘aux.FET_t::hgacc_t::p’ may be used uninitialized in this function [-Wmaybe-uninitialized]
      aux->p *= (double)(aux->n1_ - aux->n11) / n11
      ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       * (aux->n_1 - aux->n11) / (n11 + aux->n - aux->n1_ - aux->n_1);
       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
FET.hh:95:11: note: ‘aux.FET_t::hgacc_t::p’ was declared here
   hgacc_t aux;
           ^~~
/usr/bin/ld: /biosoft/lancet/htslib-1.8/libhts.a(cram_io.o): in function `itf8_decode_crc':
cram_io.c:(.text.itf8_decode_crc+0x146): undefined reference to `libdeflate_crc32'
/usr/bin/ld: cram_io.c:(.text.itf8_decode_crc+0x207): undefined reference to `libdeflate_crc32'
/usr/bin/ld: cram_io.c:(.text.itf8_decode_crc+0x25e): undefined reference to `libdeflate_crc32'
/usr/bin/ld: cram_io.c:(.text.itf8_decode_crc+0x2d5): undefined reference to `libdeflate_crc32'
/usr/bin/ld: cram_io.c:(.text.itf8_decode_crc+0x303): undefined reference to `libdeflate_crc32'
/usr/bin/ld: /biosoft/lancet/htslib-1.8/libhts.a(cram_io.o):cram_io.c:(.text.ltf8_decode_crc+0x1e0): more undefined references to `libdeflate_crc32' follow
/usr/bin/ld: /biosoft/lancet/htslib-1.8/libhts.a(bgzf.o): in function `bgzf_uncompress':
bgzf.c:(.text.bgzf_uncompress+0x16): undefined reference to `libdeflate_alloc_decompressor'
/usr/bin/ld: bgzf.c:(.text.bgzf_uncompress+0x37): undefined reference to `libdeflate_deflate_decompress'
/usr/bin/ld: bgzf.c:(.text.bgzf_uncompress+0x42): undefined reference to `libdeflate_free_decompressor'
/usr/bin/ld: /biosoft/lancet/htslib-1.8/libhts.a(bgzf.o): in function `bgzf_compress':
bgzf.c:(.text.bgzf_compress+0x6e): undefined reference to `libdeflate_alloc_compressor'
/usr/bin/ld: bgzf.c:(.text.bgzf_compress+0x95): undefined reference to `libdeflate_deflate_compress'
/usr/bin/ld: bgzf.c:(.text.bgzf_compress+0xaf): undefined reference to `libdeflate_free_compressor'
/usr/bin/ld: bgzf.c:(.text.bgzf_compress+0xe6): undefined reference to `libdeflate_crc32'
/usr/bin/ld: bgzf.c:(.text.bgzf_compress+0x188): undefined reference to `libdeflate_free_compressor'
/usr/bin/ld: /biosoft/lancet/htslib-1.8/libhts.a(bgzf.o): in function `bgzf_read_block':
bgzf.c:(.text.bgzf_read_block+0x432): undefined reference to `libdeflate_crc32'
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:17: lancet] Error 1
make[1]: Leaving directory '/biosoft/lancet/src'
cp: cannot stat 'lancet': No such file or directory

by the way ,i have saw all issues here but still can not solve my problem.

I noticed that you are using a very recent/modern gcc compiler (version 8.3.0). We have not yet tested the code on it. Are you able to install an older compiler, such as gcc-4.8.x or gcc-4.9.x, and try again?

@gnarzisi Thank you for your reply, I installed gcc-4.9.2 ,but got other errors:

......
/usr/bin/ld: /biosoft/lancet/htslib-1.8/libhts.a(cram_io.o): in function `itf8_decode_crc':
cram_io.c:(.text.itf8_decode_crc+0x146): undefined reference to `libdeflate_crc32'
/usr/bin/ld: cram_io.c:(.text.itf8_decode_crc+0x207): undefined reference to `libdeflate_crc32'
/usr/bin/ld: cram_io.c:(.text.itf8_decode_crc+0x25e): undefined reference to `libdeflate_crc32'
/usr/bin/ld: cram_io.c:(.text.itf8_decode_crc+0x2d5): undefined reference to `libdeflate_crc32'
/usr/bin/ld: cram_io.c:(.text.itf8_decode_crc+0x303): undefined reference to `libdeflate_crc32'
/usr/bin/ld: /biosoft/lancet/htslib-1.8/libhts.a(cram_io.o):cram_io.c:(.text.ltf8_decode_crc+0x1e0): more undefined references to `libdeflate_crc32' follow
/usr/bin/ld: /biosoft/lancet/htslib-1.8/libhts.a(bgzf.o): in function `bgzf_uncompress':
bgzf.c:(.text.bgzf_uncompress+0x16): undefined reference to `libdeflate_alloc_decompressor'
/usr/bin/ld: bgzf.c:(.text.bgzf_uncompress+0x37): undefined reference to `libdeflate_deflate_decompress'
/usr/bin/ld: bgzf.c:(.text.bgzf_uncompress+0x42): undefined reference to `libdeflate_free_decompressor'
/usr/bin/ld: /biosoft/lancet/htslib-1.8/libhts.a(bgzf.o): in function `bgzf_compress':
bgzf.c:(.text.bgzf_compress+0x6e): undefined reference to `libdeflate_alloc_compressor'
/usr/bin/ld: bgzf.c:(.text.bgzf_compress+0x95): undefined reference to `libdeflate_deflate_compress'
/usr/bin/ld: bgzf.c:(.text.bgzf_compress+0xaf): undefined reference to `libdeflate_free_compressor'
/usr/bin/ld: bgzf.c:(.text.bgzf_compress+0xe6): undefined reference to `libdeflate_crc32'
/usr/bin/ld: bgzf.c:(.text.bgzf_compress+0x188): undefined reference to `libdeflate_free_compressor'
/usr/bin/ld: /biosoft/lancet/htslib-1.8/libhts.a(bgzf.o): in function `bgzf_read_block':
bgzf.c:(.text.bgzf_read_block+0x432): undefined reference to `libdeflate_crc32'
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:17: lancet] Error 1
make[1]: Leaving directory '/biosoft/lancet/src'
cp: cannot stat 'lancet': No such file or directory

Thanks for trying that. The following error in your output is likely due to some of the BAMTools libraries failing to compile:

/biosoft/lancet/src/Lancet.cc:800: undefined reference to `BamTools::BamReader::Open(std::string const&)`

Can you check if the bamtools executable was created under bamtools-2.5.1/bin/?

There is also another error:

/usr/bin/ld: /biosoft/lancet/htslib-1.8/libhts.a(cram_io.o): in function `itf8_decode_crc':
cram_io.c:(.text.itf8_decode_crc+0x146): undefined reference to `libdeflate_crc32'

The problem is that the linker doesn't seem to find your copy of libdeflate. Can you check id that library is installed in your system? Here is a related issue posted in the samtools forum: samtools/htslib#688

I also noticed that you are using the Conda management system. Are you compiling under a Windows, MacOS or Linux machine?

Finally I recommend running "make clean" before each re-compilation test.

Finally,the problem was solved. Thank you! @gnarzisi
I use conda in Linux machine.
"make clean" before "make" is effective for the first error .

About the second error , I add "-ldeflate" in "lancet/src/Makefile" file :
before: LDLIBS := -llzma -lbz2 -lz -ldl -lpthread -lcurl -lcrypto -lbamtools
after: LDLIBS := -llzma -lbz2 -lz -ldl -lpthread -lcurl -lcrypto -lbamtools -ldeflate
and the problem was solved.

Great to hear the compilation problems were resolved. Thanks for reporting the solution here.

Just a comment for anyone trying to install lancet that gets this:
checking for CCHmac... no
You should include -ldeflate in "lancet/src/Makefile" as mention above.

I've installed this software ten times on different computers, and I always had to do the same thing.
Idk if this is a bug that will be solved in further versions, but I hope that anyone with the same problem will find this straightforward solution.