bamUtil icon indicating copy to clipboard operation
bamUtil copied to clipboard

Building bamUtil returns error: undefined reference

Open Dlfn opened this issue 7 years ago • 4 comments

Hello, I am working on a HPC cluster that uses linux x86_64. I am encountering an error while building this repository using the following commands:

git clone https://github.com/statgen/bamUtil.git cd bamUtil export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib module load dev/gcc/8.2 module load dev/PGI-compilers/17.5 make cloneLib make ## here comes the error

[..] g++ -std=c++0x -I/usr/local/packages/dev/gcc/8.2.0/include -I../../libStatGen/include -I. -D__ZLIB_AVAILABLE__ -D_FILE_OFFSET_BITS=64 -D__STDC_LIMIT_MACROS -DDATE=""Wed 5 Dec 17:31:32 GMT 2018"" -DVERSION=""1.0.14"" -DUSER=""bo1fra"" -o ../obj/BamExecutable.o -c BamExecutable.cpp -DVERSION=""1.0.14"" mkdir -p ../bin g++ -std=c++0x -I/usr/local/packages/dev/gcc/8.2.0/include -I../../libStatGen/include -I. -D__ZLIB_AVAILABLE__ -D_FILE_OFFSET_BITS=64 -D__STDC_LIMIT_MACROS -DDATE=""Wed 5 Dec 17:31:32 GMT 2018"" -DVERSION=""1.0.14"" -DUSER=""bo1fra"" -o ../bin/bam ../obj/BamExecutable.o ../obj/Validate.o ../obj/Convert.o ../obj/Diff.o ../obj/DumpHeader.o ../obj/SplitChromosome.o ../obj/WriteRegion.o ../obj/DumpIndex.o ../obj/ReadIndexedBam.o ../obj/DumpRefInfo.o ../obj/Filter.o ../obj/ReadReference.o ../obj/Revert.o ../obj/Squeeze.o ../obj/FindCigars.o ../obj/Stats.o ../obj/PileupElementBaseQCStats.o ../obj/ClipOverlap.o ../obj/MateMapByCoord.o ../obj/SplitBam.o ../obj/TrimBam.o ../obj/MergeBam.o ../obj/PolishBam.o ../obj/GapInfo.o ../obj/Logger.o ../obj/Bam2FastQ.o ../obj/Dedup.o ../obj/Dedup_LowMem.o ../obj/Prediction.o ../obj/LogisticRegression.o ../obj/MathCholesky.o ../obj/HashErrorModel.o ../obj/Recab.o ../obj/OverlapHandler.o ../obj/OverlapClipLowerBaseQual.o ../obj/ExplainFlags.o ../obj/Main.o ../../libStatGen/libStatGen.a -lm -lz
../obj/Validate.o: In function operator<<(std::ostream&, SamValidationErrors const&)': Validate.cpp:(.text._ZlsRSoRK19SamValidationErrors[_ZlsRSoRK19SamValidationErrors]+0x4d): undefined reference to SamValidationErrors::getErrorString(std::__cxx11::basic_string<char, std::char_traits, std::allocator >&) const' ../obj/DumpHeader.o: In function DumpHeader::dumpHeader(char const*)': DumpHeader.cpp:(.text+0x21f): undefined reference to SamFileHeader::getHeaderString(std::__cxx11::basic_string<char, std::char_traits, std::allocator >&) const' ../obj/WriteRegion.o: In function WriteRegion::execute(int, char**)': WriteRegion.cpp:(.text+0xe11): undefined reference to InputFile::readTilChar(std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&, std::__cxx11::basic_string<char, std::char_traits, std::allocator >&)' ../obj/ReadReference.o: In function ReadReference::execute(int, char**)': ReadReference.cpp:(.text+0x4b3): undefined reference to GenomeSequence::getString(std::__cxx11::basic_string<char, std::char_traits, std::allocator >&, unsigned int, int) const' ../obj/MergeBam.o: In function parseOutRG(SamFileHeader&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, SamFileHeader*, bool)': MergeBam.cpp:(.text+0x28aa): undefined reference to SamHeaderRecord::appendString(std::__cxx11::basic_string<char, std::char_traits, std::allocator >&)' MergeBam.cpp:(.text+0x28cc): undefined reference to SamHeaderRecord::appendString(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&)' MergeBam.cpp:(.text+0x2c18): undefined reference to SamHeaderRecord::appendString(std::__cxx11::basic_string<char, std::char_traits, std::allocator >&)' MergeBam.cpp:(.text+0x2c3a): undefined reference to SamHeaderRecord::appendString(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&)' MergeBam.cpp:(.text+0x2cee): undefined reference to SamHeaderRecord::appendString(std::__cxx11::basic_string<char, std::char_traits, std::allocator >&)' MergeBam.cpp:(.text+0x2d16): undefined reference to SamFileHeader::appendCommentLines(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&)' ../obj/Bam2FastQ.o: In function Bam2FastQ::writeFastQ(SamRecord&, InputFile*, std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&, char const*)': Bam2FastQ.cpp:(.text+0x2c0b): undefined reference to SamHeaderRecord::appendString(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&)' Bam2FastQ.cpp:(.text+0x2f3f): undefined reference to BaseUtilities::reverseComplement(std::__cxx11::basic_string<char, std::char_traits, std::allocator >&)' ../obj/Dedup.o: In function Dedup::buildReadGroupLibraryMap(SamFileHeader&)': Dedup.cpp:(.text+0x277c): undefined reference to SamHeaderRecord::appendString(std::__cxx11::basic_string<char, std::char_traits, std::allocator >&)' Dedup.cpp:(.text+0x2868): undefined reference to SamHeaderRecord::appendString(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&)' ../obj/Dedup_LowMem.o: In function Dedup_LowMem::buildReadGroupLibraryMap(SamFileHeader&)': Dedup_LowMem.cpp:(.text+0x25a6): undefined reference to SamHeaderRecord::appendString(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&)' Dedup_LowMem.cpp:(.text+0x2692): undefined reference to SamHeaderRecord::appendString(std::__cxx11::basic_string<char, std::char_traits, std::allocator >&)' collect2: error: ld returned 1 exit status make[1]: *** [../bin/bam] Error 1 make[1]: Leaving directory `/home/bo1fra/software/bamUtil/src' make: *** [src] Error 2

Any suggestion? Thank you in advance

Dlfn avatar Dec 05 '18 17:12 Dlfn

It looks like the libStatGen being linked was built with an older version of gcc (< 5). Is it possible that libStatGen is installed in a system path somewhere? Or did you run make cloneLib previously without loading the gcc v8.2 module?

jonathonl avatar Dec 05 '18 17:12 jonathonl

Thank you for your quick reply! I run make cloneLib previously without loading the gcc v. 8.2 module (before knowing that module load was necessary for gcc :-(). Is there a way to undo this? Sorry for asking, my knowledge in this topic is quite limited.

On 5 Dec 2018, at 17:47, Jonathon LeFaive [email protected] wrote:

It looks like the libStatGen being linked was built with an older version of gcc (< 5). Is it possible that libStatGen is install in a system path somewhere? Or did you run make cloneLib previously without loading the gcc v8.2 module?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/statgen/bamUtil/issues/52#issuecomment-444577742, or mute the thread https://github.com/notifications/unsubscribe-auth/AXyDFlCYdd5ifBjGvwdnBs4zSuCiJZ6Xks5u2AaxgaJpZM4ZDaF9.

Dlfn avatar Dec 05 '18 17:12 Dlfn

Yes, you can clean the libStatGen directory by running cd ../libStatGen && make clean.

jonathonl avatar Dec 05 '18 18:12 jonathonl

It works. Thank you very much!

Dlfn avatar Dec 05 '18 18:12 Dlfn