abyzovlab / CNVnator

a tool for CNV discovery and genotyping from depth-of-coverage by mapped reads
Other
210 stars 66 forks source link

Compile issues - version dependencies? #284

Open Neato-Nick opened 10 months ago

Neato-Nick commented 10 months ago

Hi, I've gotten various compilation issues as I've tried various installs of root, htslib, and samtools available on my HPC. Exactly which versions are required for install?

I've tried samtools 1.9 and 1.13. In both cases, I linked the samtools src dir that also contained an htslib* sub-dir contained libhts.a. I'm using root 6.10 and have run thisroot.sh. echo $ROOTSYS indicated this worked. I've tried gcc 4.94, 8.3, and 12.3.1.

Lastly, here is my OS info:

$ cat /etc/os-release
NAME="Red Hat Enterprise Linux Server"
VERSION="7.9 (Maipo)"
ID="rhel"
ID_LIKE="fedora"
VARIANT="Server"
VARIANT_ID="server"
VERSION_ID="7.9"
PRETTY_NAME="Red Hat Enterprise Linux Server 7.9 (Maipo)"

When I compile, I get this error

$ make OMP=no
Compiling with NO parallel support
g++ -O3 -std=c++11 -DCNVNATOR_VERSION=\"v0.4.1\"  -o cnvnator obj/cnvnator.o obj/EXOnator.o obj/IO.o obj/Visualizer.o obj/HisMaker.o obj/AliParser.o obj/FastaParser.o obj/VcfParser.o obj/Genotyper.o obj/Interval.o obj/Genome.o samtools/libbam.a samtools/htslib-1.9/libhts.a -lz -lbz2 -lcurl -llzma -lreadline -L/gpfs/runtime/opt/root/6.10/lib      -lCore -lRIO -lHist -lGraf -lGpad -lTree -lMathCore
/usr/bin/ld: samtools/htslib-1.9/libhts.a(thread_pool.o): undefined reference to symbol 'pthread_mutexattr_settype@@GLIBC_2.2.5'
//usr/lib64/libpthread.so.0: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make: *** [cnvnator] Error 1

Following https://github.com/abyzovlab/CNVnator/issues/15#issuecomment-371223865 I edited the Makefile with -lpthread and I got a new error. It's the same whether or not I compile with OMP

First with just make I got errors related to libcrypto:

/usr/bin/ld: samtools/htslib-1.13/libhts.a(hfile_s3.o): undefined reference to symbol 'EVP_sha256@@libcrypto.so.10'

So I did the alternate compilation suggested:

$ make LIBS="-lcrypto"
Compiling with parallel (OpenMP) support
g++ -O3 -std=c++11 -lpthread -DCNVNATOR_VERSION=\"v0.4.1\" -fopenmp -o cnvnator obj/cnvnator.o obj/EXOnator.o obj/IO.o obj/Visualizer.o obj/HisMaker.o obj/AliParser.o obj/FastaParser.o obj/VcfParser.o obj/Genotyper.o obj/Interval.o obj/Genome.o samtools/libbam.a samtools/htslib-1.13/libhts.a -lcrypto -lz -lbz2 -lcurl -llzma -lreadline -L/gpfs/runtime/opt/root/6.10/lib      -lCore -lRIO -lHist -lGraf -lGpad -lTree -lMathCore
obj/IO.o: In function `IO::treeName(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >) [clone .constprop.114]':
IO.cpp:(.text+0xd9): undefined reference to `TString::TString(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
IO.cpp:(.text+0x170): undefined reference to `TString::TString(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
obj/IO.o: In function `IO::treeName(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)':
IO.cpp:(.text+0x279): undefined reference to `TString::TString(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
IO.cpp:(.text+0x310): undefined reference to `TString::TString(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
obj/IO.o: In function `IO::IO(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)':
IO.cpp:(.text+0xc85): undefined reference to `TString::TString(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
obj/IO.o: In function `IO::signalName(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, unsigned int)':
IO.cpp:(.text+0x1a96): undefined reference to `TString::operator=(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
IO.cpp:(.text+0x1ae9): undefined reference to `TString::TString(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
IO.cpp:(.text+0x1ccb): undefined reference to `TString::operator=(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
IO.cpp:(.text+0x1d1e): undefined reference to `TString::TString(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
IO.cpp:(.text+0x26c1): undefined reference to `TString::operator=(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
IO.cpp:(.text+0x2a5c): undefined reference to `TString::operator=(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
IO.cpp:(.text+0x2aaf): undefined reference to `TString::TString(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
IO.cpp:(.text+0x2ba7): undefined reference to `TString::operator=(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
IO.cpp:(.text+0x2bfa): undefined reference to `TString::TString(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
IO.cpp:(.text+0x2cb6): undefined reference to `TString::operator=(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
IO.cpp:(.text+0x2d09): undefined reference to `TString::TString(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
IO.cpp:(.text+0x2d6d): undefined reference to `TString::operator=(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
IO.cpp:(.text+0x2dc0): undefined reference to `TString::TString(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
IO.cpp:(.text+0x2ef4): undefined reference to `TString::operator=(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
IO.cpp:(.text+0x2f47): undefined reference to `TString::TString(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
IO.cpp:(.text+0x3027): undefined reference to `TString::operator=(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
IO.cpp:(.text+0x307a): undefined reference to `TString::TString(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
IO.cpp:(.text+0x30de): undefined reference to `TString::operator=(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
IO.cpp:(.text+0x3131): undefined reference to `TString::TString(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
IO.cpp:(.text+0x3195): undefined reference to `TString::operator=(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
IO.cpp:(.text+0x31e8): undefined reference to `TString::TString(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
IO.cpp:(.text+0x324c): undefined reference to `TString::operator=(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
IO.cpp:(.text+0x329f): undefined reference to `TString::TString(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
IO.cpp:(.text+0x3303): undefined reference to `TString::operator=(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
IO.cpp:(.text+0x3356): undefined reference to `TString::TString(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
IO.cpp:(.text+0x33ba): undefined reference to `TString::operator=(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
IO.cpp:(.text+0x340d): undefined reference to `TString::TString(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
IO.cpp:(.text+0x3471): undefined reference to `TString::operator=(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
IO.cpp:(.text+0x34c4): undefined reference to `TString::TString(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
IO.cpp:(.text+0x3528): undefined reference to `TString::operator=(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
IO.cpp:(.text+0x357b): undefined reference to `TString::TString(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
IO.cpp:(.text+0x35df): undefined reference to `TString::operator=(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
IO.cpp:(.text+0x3632): undefined reference to `TString::TString(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
IO.cpp:(.text+0x36a8): undefined reference to `TString::operator=(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
IO.cpp:(.text+0x36fb): undefined reference to `TString::TString(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
IO.cpp:(.text+0x37e4): undefined reference to `TString::operator=(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
IO.cpp:(.text+0x3837): undefined reference to `TString::TString(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
IO.cpp:(.text+0x38c2): undefined reference to `TString::operator=(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
IO.cpp:(.text+0x3915): undefined reference to `TString::TString(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
IO.cpp:(.text+0x39a0): undefined reference to `TString::operator=(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
IO.cpp:(.text+0x39f3): undefined reference to `TString::TString(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
IO.cpp:(.text+0x3a7e): undefined reference to `TString::operator=(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
IO.cpp:(.text+0x3ad1): undefined reference to `TString::TString(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
IO.cpp:(.text+0x3b5c): undefined reference to `TString::operator=(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
IO.cpp:(.text+0x3baf): undefined reference to `TString::TString(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
IO.cpp:(.text+0x3c3a): undefined reference to `TString::operator=(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
IO.cpp:(.text+0x3c8d): undefined reference to `TString::TString(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
IO.cpp:(.text+0x3d18): undefined reference to `TString::operator=(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
IO.cpp:(.text+0x3d6b): undefined reference to `TString::TString(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
obj/IO.o: In function `IO::newSignalTH1(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, unsigned int, int, double, double)':
IO.cpp:(.text+0x6120): undefined reference to `TString::TString(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
IO.cpp:(.text+0x626f): undefined reference to `TString::TString(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
obj/IO.o: In function `IO::newSignalTH2(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, unsigned int, int, double, double, int, double, double)':
IO.cpp:(.text+0x64b8): undefined reference to `TString::TString(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
IO.cpp:(.text+0x662a): undefined reference to `TString::TString(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
obj/Visualizer.o: In function `Visualizer::parseRegionOption(TString, TString&, int&, int&, TString&)':
Visualizer.cpp:(.text+0x58ea): undefined reference to `TString::operator=(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
Visualizer.cpp:(.text+0x59d1): undefined reference to `TString::TString(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
Visualizer.cpp:(.text+0x5a45): undefined reference to `TString::TString(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
obj/Visualizer.o: In function `Visualizer::generateView(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, int, TVirtualPad*)':
Visualizer.cpp:(.text+0x61c8): undefined reference to `TString::TString(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
Visualizer.cpp:(.text+0x6629): undefined reference to `TString::TString(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
Visualizer.cpp:(.text+0x6dbe): undefined reference to `TString::TString(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
obj/Visualizer.o:Visualizer.cpp:(.text+0x739e): more undefined references to `TString::TString(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)' follow
obj/HisMaker.o: In function `HisMaker::generateView(TString, int, int, bool, bool, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, int)':
HisMaker.cpp:(.text+0x164b3): undefined reference to `TString::operator=(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
HisMaker.cpp:(.text+0x165b9): undefined reference to `TString::operator=(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
obj/HisMaker.o: In function `HisMaker::genotype(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, int, bool, bool)':
HisMaker.cpp:(.text+0x16e30): undefined reference to `TString::TString(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
obj/HisMaker.o: In function `HisMaker::printRegion(TString, int, int, bool, bool)':
HisMaker.cpp:(.text+0x173c2): undefined reference to `TString::TString(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
HisMaker.cpp:(.text+0x17ce8): undefined reference to `TString::operator=(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
obj/HisMaker.o: In function `HisMaker::produceHistogramsNew(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, int)':
HisMaker.cpp:(.text+0x1a3ef): undefined reference to `TString::TString(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
obj/HisMaker.o: In function `HisMaker::mergeTrees(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, int)':
HisMaker.cpp:(.text+0x1be09): undefined reference to `TString::TString(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
obj/HisMaker.o: In function `HisMaker::eval(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, int, bool, bool)':
HisMaker.cpp:(.text+0x2032a): undefined reference to `TString::operator=(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
obj/HisMaker.o: In function `HisMaker::partition(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, int, bool, bool, bool, bool, int)':
HisMaker.cpp:(.text+0x23f72): undefined reference to `TString::TString(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
HisMaker.cpp:(.text+0x24332): undefined reference to `TString::TString(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
obj/HisMaker.o: In function `HisMaker::partition2D(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, int, bool, bool, bool, bool, int)':
HisMaker.cpp:(.text+0x25182): undefined reference to `TString::TString(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
HisMaker.cpp:(.text+0x25201): undefined reference to `TString::TString(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
HisMaker.cpp:(.text+0x25699): undefined reference to `TString::TString(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
obj/HisMaker.o:HisMaker.cpp:(.text+0x28397): more undefined references to `TString::TString(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)' follow
obj/HisMaker.o: In function `HisMaker::generateViewBAF(TString, int, int, bool, bool)':
HisMaker.cpp:(.text+0x2b031): undefined reference to `TString::operator=(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
obj/HisMaker.o: In function `HisMaker::generateView(bool, bool)':
HisMaker.cpp:(.text+0x2bcda): undefined reference to `TString::TString(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
HisMaker.cpp:(.text+0x2c812): undefined reference to `TString::operator=(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
obj/HisMaker.o: In function `HisMaker::view(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, int, bool, bool)':
HisMaker.cpp:(.text+0x2d60a): undefined reference to `TString::TString(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
obj/HisMaker.o: In function `HisMaker::produceHistograms(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, int, bool)':
HisMaker.cpp:(.text+0x30997): undefined reference to `TString::TString(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
HisMaker.cpp:(.text+0x309d6): undefined reference to `TString::TString(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
HisMaker.cpp:(.text+0x30a1e): undefined reference to `TString::TString(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
HisMaker.cpp:(.text+0x30a8e): undefined reference to `TString::TString(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
obj/HisMaker.o:HisMaker.cpp:(.text+0x30bd3): more undefined references to `TString::TString(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)' follow
collect2: error: ld returned 1 exit status
make: *** [cnvnator] Error 1
Neato-Nick commented 10 months ago

I see the README says to use the latest release of samtools. I did that (samtools 1.18) and get a different error. I got the above by using samtools 1.9, which I found worked from a thread from a few years ago https://github.com/abyzovlab/CNVnator/issues/180

Here's the error using samtools 1.18

(base) [ncauldro@node1324 src]$ make LIBS="-lcrypto"
Compiling with parallel (OpenMP) support
g++ -O3 -std=c++11 -lpthread -DCNVNATOR_VERSION=\"v0.4.1\" -fopenmp -I/gpfs/runtime/opt/root/6.10/include      -Isamtools -Isamtools/htslib-1.18 -Isamtools/htslib-1.18/htslib -c cnvnator.cpp -o obj/cnvnator.o
In file included from cnvnator.cpp:14:0:
AliParser.hh:18:3: error: ‘samfile_t’ does not name a type
   samfile_t   *file;
   ^
AliParser.hh:19:3: error: ‘bam_index_t’ does not name a type
   bam_index_t *index;
   ^
AliParser.hh: In member function ‘std::string AliParser::getQueryName()’:
AliParser.hh:98:69: error: ‘bam1_qname’ was not declared in this scope
   inline string getQueryName() { return (record) ? bam1_qname(record) : ""; }
                                                                     ^
make: *** [obj/cnvnator.o] Error 1
abyzov commented 10 months ago

Hi, could you check that your file sam.h in samtools contains description of the following types: samfile_t bam_index_t bam1_t

Alexej Abyzov, Ph.D. Senior Associate Consultant, Associate Professor of Biomedical Informatics, Department of Quantitative Health Sciences, Center for Individualized Medicine, Mayo Clinic

Mayo Clinic, 200 1st street SW, Harwick 7-91 Rochester, MN 55905 www.abyzovlab.org http://www.abyzovlab.orgtel: +1-(507)-538-0978

Neato-Nick commented 10 months ago

Hi, I checked that header file in samtools/htslib 1.18 and found: samfile_t - NOT described bam_index_t - NOT described bam1_t - is described

in the file CNVnator_v0.4.1/src/samtools/htslib-1.18/htslib/sam.h (samtools dir is symlinked from my install dir of samtools 1.18)

Neato-Nick commented 10 months ago

With samtools 1.9 I get this error. It's much cleaner than the stack I posted in OP for some reason. I chose v1.9 here because it was the "current release" at the time the current version of cnvnator was released.

$ source /path/to/root/6.10/bin/thisroot.sh
$ samtools/samtools --version
samtools 1.9
Using htslib 1.9
Copyright (C) 2018 Genome Research Ltd.
$
$ # Compile with all defaults
$ make
Compiling with parallel (OpenMP) support
g++ -O3 -std=c++11 -lpthread -DCNVNATOR_VERSION=\"v0.4.1\" -fopenmp -o cnvnator obj/cnvnator.o obj/EXOnator.o obj/IO.o obj/Visualizer.o obj/HisMaker.o obj/AliParser.o obj/FastaParser.o obj/VcfParser.o obj/Genotyper.o obj/Interval.o obj/Genome.o samtools/libbam.a samtools/htslib-1.9/libhts.a -lz -lbz2 -lcurl -llzma -lreadline -L/gpfs/runtime/opt/root/6.10/lib      -lCore -lRIO -lHist -lGraf -lGpad -lTree -lMathCore
/usr/bin/ld: samtools/htslib-1.9/libhts.a(hfile_s3.o): undefined reference to symbol 'HMAC@@libcrypto.so.10'
//usr/lib64/libcrypto.so.10: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make: *** [cnvnator] Error 1
$
$ # libcrypto error, modified configuration as per cnvnator readme
$ make LIBS="-lcrypto"
Compiling with parallel (OpenMP) support
g++ -O3 -std=c++11 -lpthread -DCNVNATOR_VERSION=\"v0.4.1\" -fopenmp -o cnvnator obj/cnvnator.o obj/EXOnator.o obj/IO.o obj/Visualizer.o obj/HisMaker.o obj/AliParser.o obj/FastaParser.o obj/VcfParser.o obj/Genotyper.o obj/Interval.o obj/Genome.o samtools/libbam.a samtools/htslib-1.9/libhts.a -lcrypto -lz -lbz2 -lcurl -llzma -lreadline -L/gpfs/runtime/opt/root/6.10/lib      -lCore -lRIO -lHist -lGraf -lGpad -lTree -lMathCore
/gpfs/runtime/opt/root/6.10/lib/libCore.so: undefined reference to `std::__throw_out_of_range_fmt(char const*, ...)@GLIBCXX_3.4.20'
/gpfs/runtime/opt/root/6.10/lib/libCore.so: undefined reference to `__cxa_throw_bad_array_new_length@CXXABI_1.3.8'
collect2: error: ld returned 1 exit status
make: *** [cnvnator] Error 1
$
$ # try compile without multi-threading
$ make LIBS="-lcrypto" OMP=no
Compiling with NO parallel support
g++ -O3 -std=c++11 -lpthread -DCNVNATOR_VERSION=\"v0.4.1\"  -o cnvnator obj/cnvnator.o obj/EXOnator.o obj/IO.o obj/Visualizer.o obj/HisMaker.o obj/AliParser.o obj/FastaParser.o obj/VcfParser.o obj/Genotyper.o obj/Interval.o obj/Genome.o samtools/libbam.a samtools/htslib-1.9/libhts.a -lcrypto -lz -lbz2 -lcurl -llzma -lreadline -L/gpfs/runtime/opt/root/6.10/lib      -lCore -lRIO -lHist -lGraf -lGpad -lTree -lMathCore
obj/HisMaker.o: In function `calcLevelsInner(double const*, double const*, bool const*, int, int, double*, double const*, double const*) [clone ._omp_fn.0]':
HisMaker.cpp:(.text+0x2bb): undefined reference to `omp_get_num_threads'
HisMaker.cpp:(.text+0x2c3): undefined reference to `omp_get_thread_num'
HisMaker.cpp:(.text+0x577): undefined reference to `GOMP_barrier'
obj/HisMaker.o: In function `calcLevelsInner(double const*, double const*, bool const*, int, int, double*, double const*, double const*)':
HisMaker.cpp:(.text+0x9293): undefined reference to `GOMP_parallel_start'
HisMaker.cpp:(.text+0x92a5): undefined reference to `GOMP_parallel_end'
/gpfs/runtime/opt/root/6.10/lib/libCore.so: undefined reference to `std::__throw_out_of_range_fmt(char const*, ...)@GLIBCXX_3.4.20'
/gpfs/runtime/opt/root/6.10/lib/libCore.so: undefined reference to `__cxa_throw_bad_array_new_length@CXXABI_1.3.8'
collect2: error: ld returned 1 exit status
make: *** [cnvnator] Error 1
abyzov commented 10 months ago

If compiling with no OMP support there should be no error about OMP related functions. Please try:

make clean make

Alexej Abyzov, Ph.D. Senior Associate Consultant, Associate Professor of Biomedical Informatics, Department of Quantitative Health Sciences, Center for Individualized Medicine, Mayo Clinic

Mayo Clinic, 200 1st street SW, Harwick 7-91 Rochester, MN 55905 www.abyzovlab.org http://www.abyzovlab.orgtel: +1-(507)-538-0978

Neato-Nick commented 10 months ago

Just tried a few combos preceded by make clean and did not have luck. Looks like the error could be stemming from root. What versions are compatible?

(base) [ncauldro@node1317 src]$ make clean
Compiling with parallel (OpenMP) support
rm -fr obj cnvnator
(base) [ncauldro@node1317 src]$ make
Compiling with parallel (OpenMP) support
g++ -O3 -std=c++11 -lpthread -DCNVNATOR_VERSION=\"v0.4.1\" -fopenmp -I/gpfs/runtime/opt/root/6.10/include      -Isamtools -Isamtools/htslib-1.9 -Isamtools/htslib-1.9/htslib -c cnvnator.cpp -o obj/cnvnator.o
g++ -O3 -std=c++11 -lpthread -DCNVNATOR_VERSION=\"v0.4.1\" -fopenmp -I/gpfs/runtime/opt/root/6.10/include      -Isamtools -Isamtools/htslib-1.9 -Isamtools/htslib-1.9/htslib -c EXOnator.cpp -o obj/EXOnator.o
g++ -O3 -std=c++11 -lpthread -DCNVNATOR_VERSION=\"v0.4.1\" -fopenmp -I/gpfs/runtime/opt/root/6.10/include      -Isamtools -Isamtools/htslib-1.9 -Isamtools/htslib-1.9/htslib -c IO.cpp -o obj/IO.o
g++ -O3 -std=c++11 -lpthread -DCNVNATOR_VERSION=\"v0.4.1\" -fopenmp -I/gpfs/runtime/opt/root/6.10/include      -Isamtools -Isamtools/htslib-1.9 -Isamtools/htslib-1.9/htslib -c Visualizer.cpp -o obj/Visualizer.o
g++ -O3 -std=c++11 -lpthread -DCNVNATOR_VERSION=\"v0.4.1\" -fopenmp -I/gpfs/runtime/opt/root/6.10/include      -Isamtools -Isamtools/htslib-1.9 -Isamtools/htslib-1.9/htslib -c HisMaker.cpp -o obj/HisMaker.o
g++ -O3 -std=c++11 -lpthread -DCNVNATOR_VERSION=\"v0.4.1\" -fopenmp -I/gpfs/runtime/opt/root/6.10/include      -Isamtools -Isamtools/htslib-1.9 -Isamtools/htslib-1.9/htslib -c AliParser.cpp -o obj/AliParser.o
g++ -O3 -std=c++11 -lpthread -DCNVNATOR_VERSION=\"v0.4.1\" -fopenmp -I/gpfs/runtime/opt/root/6.10/include      -Isamtools -Isamtools/htslib-1.9 -Isamtools/htslib-1.9/htslib -c FastaParser.cpp -o obj/FastaParser.o
g++ -O3 -std=c++11 -lpthread -DCNVNATOR_VERSION=\"v0.4.1\" -fopenmp -I/gpfs/runtime/opt/root/6.10/include      -Isamtools -Isamtools/htslib-1.9 -Isamtools/htslib-1.9/htslib -c VcfParser.cpp -o obj/VcfParser.o
g++ -O3 -std=c++11 -lpthread -DCNVNATOR_VERSION=\"v0.4.1\" -fopenmp -I/gpfs/runtime/opt/root/6.10/include      -Isamtools -Isamtools/htslib-1.9 -Isamtools/htslib-1.9/htslib -c Genotyper.cpp -o obj/Genotyper.o
g++ -O3 -std=c++11 -lpthread -DCNVNATOR_VERSION=\"v0.4.1\" -fopenmp -I/gpfs/runtime/opt/root/6.10/include      -Isamtools -Isamtools/htslib-1.9 -Isamtools/htslib-1.9/htslib -c Interval.cpp -o obj/Interval.o
g++ -O3 -std=c++11 -lpthread -DCNVNATOR_VERSION=\"v0.4.1\" -fopenmp -I/gpfs/runtime/opt/root/6.10/include      -Isamtools -Isamtools/htslib-1.9 -Isamtools/htslib-1.9/htslib -c Genome.cpp -o obj/Genome.o
g++ -O3 -std=c++11 -lpthread -DCNVNATOR_VERSION=\"v0.4.1\" -fopenmp -o cnvnator obj/cnvnator.o obj/EXOnator.o obj/IO.o obj/Visualizer.o obj/HisMaker.o obj/AliParser.o obj/FastaParser.o obj/VcfParser.o obj/Genotyper.o obj/Interval.o obj/Genome.o samtools/libbam.a samtools/htslib-1.9/libhts.a -lz -lbz2 -lcurl -llzma -lreadline -L/gpfs/runtime/opt/root/6.10/lib      -lCore -lRIO -lHist -lGraf -lGpad -lTree -lMathCore
/usr/bin/ld: samtools/htslib-1.9/libhts.a(hfile_s3.o): undefined reference to symbol 'HMAC@@libcrypto.so.10'
//usr/lib64/libcrypto.so.10: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make: *** [cnvnator] Error 1
(base) [ncauldro@node1317 src]$ make clean
Compiling with parallel (OpenMP) support
rm -fr obj cnvnator
(base) [ncauldro@node1317 src]$ make LIBS="-lcrypto"
Compiling with parallel (OpenMP) support
g++ -O3 -std=c++11 -lpthread -DCNVNATOR_VERSION=\"v0.4.1\" -fopenmp -I/gpfs/runtime/opt/root/6.10/include      -Isamtools -Isamtools/htslib-1.9 -Isamtools/htslib-1.9/htslib -c cnvnator.cpp -o obj/cnvnator.o
g++ -O3 -std=c++11 -lpthread -DCNVNATOR_VERSION=\"v0.4.1\" -fopenmp -I/gpfs/runtime/opt/root/6.10/include      -Isamtools -Isamtools/htslib-1.9 -Isamtools/htslib-1.9/htslib -c EXOnator.cpp -o obj/EXOnator.o
g++ -O3 -std=c++11 -lpthread -DCNVNATOR_VERSION=\"v0.4.1\" -fopenmp -I/gpfs/runtime/opt/root/6.10/include      -Isamtools -Isamtools/htslib-1.9 -Isamtools/htslib-1.9/htslib -c IO.cpp -o obj/IO.o
g++ -O3 -std=c++11 -lpthread -DCNVNATOR_VERSION=\"v0.4.1\" -fopenmp -I/gpfs/runtime/opt/root/6.10/include      -Isamtools -Isamtools/htslib-1.9 -Isamtools/htslib-1.9/htslib -c Visualizer.cpp -o obj/Visualizer.o
g++ -O3 -std=c++11 -lpthread -DCNVNATOR_VERSION=\"v0.4.1\" -fopenmp -I/gpfs/runtime/opt/root/6.10/include      -Isamtools -Isamtools/htslib-1.9 -Isamtools/htslib-1.9/htslib -c HisMaker.cpp -o obj/HisMaker.o
g++ -O3 -std=c++11 -lpthread -DCNVNATOR_VERSION=\"v0.4.1\" -fopenmp -I/gpfs/runtime/opt/root/6.10/include      -Isamtools -Isamtools/htslib-1.9 -Isamtools/htslib-1.9/htslib -c AliParser.cpp -o obj/AliParser.o
g++ -O3 -std=c++11 -lpthread -DCNVNATOR_VERSION=\"v0.4.1\" -fopenmp -I/gpfs/runtime/opt/root/6.10/include      -Isamtools -Isamtools/htslib-1.9 -Isamtools/htslib-1.9/htslib -c FastaParser.cpp -o obj/FastaParser.o
g++ -O3 -std=c++11 -lpthread -DCNVNATOR_VERSION=\"v0.4.1\" -fopenmp -I/gpfs/runtime/opt/root/6.10/include      -Isamtools -Isamtools/htslib-1.9 -Isamtools/htslib-1.9/htslib -c VcfParser.cpp -o obj/VcfParser.o
g++ -O3 -std=c++11 -lpthread -DCNVNATOR_VERSION=\"v0.4.1\" -fopenmp -I/gpfs/runtime/opt/root/6.10/include      -Isamtools -Isamtools/htslib-1.9 -Isamtools/htslib-1.9/htslib -c Genotyper.cpp -o obj/Genotyper.o
g++ -O3 -std=c++11 -lpthread -DCNVNATOR_VERSION=\"v0.4.1\" -fopenmp -I/gpfs/runtime/opt/root/6.10/include      -Isamtools -Isamtools/htslib-1.9 -Isamtools/htslib-1.9/htslib -c Interval.cpp -o obj/Interval.o
g++ -O3 -std=c++11 -lpthread -DCNVNATOR_VERSION=\"v0.4.1\" -fopenmp -I/gpfs/runtime/opt/root/6.10/include      -Isamtools -Isamtools/htslib-1.9 -Isamtools/htslib-1.9/htslib -c Genome.cpp -o obj/Genome.o
g++ -O3 -std=c++11 -lpthread -DCNVNATOR_VERSION=\"v0.4.1\" -fopenmp -o cnvnator obj/cnvnator.o obj/EXOnator.o obj/IO.o obj/Visualizer.o obj/HisMaker.o obj/AliParser.o obj/FastaParser.o obj/VcfParser.o obj/Genotyper.o obj/Interval.o obj/Genome.o samtools/libbam.a samtools/htslib-1.9/libhts.a -lcrypto -lz -lbz2 -lcurl -llzma -lreadline -L/gpfs/runtime/opt/root/6.10/lib      -lCore -lRIO -lHist -lGraf -lGpad -lTree -lMathCore
/gpfs/runtime/opt/root/6.10/lib/libCore.so: undefined reference to `std::__throw_out_of_range_fmt(char const*, ...)@GLIBCXX_3.4.20'
/gpfs/runtime/opt/root/6.10/lib/libCore.so: undefined reference to `__cxa_throw_bad_array_new_length@CXXABI_1.3.8'
collect2: error: ld returned 1 exit status
make: *** [cnvnator] Error 1
(base) [ncauldro@node1317 src]$ make clean
Compiling with parallel (OpenMP) support
rm -fr obj cnvnator
(base) [ncauldro@node1317 src]$ make LIBS="-lcrypto" OMP=no
Compiling with NO parallel support
g++ -O3 -std=c++11 -lpthread -DCNVNATOR_VERSION=\"v0.4.1\"  -I/gpfs/runtime/opt/root/6.10/include      -Isamtools -Isamtools/htslib-1.9 -Isamtools/htslib-1.9/htslib -c cnvnator.cpp -o obj/cnvnator.o
g++ -O3 -std=c++11 -lpthread -DCNVNATOR_VERSION=\"v0.4.1\"  -I/gpfs/runtime/opt/root/6.10/include      -Isamtools -Isamtools/htslib-1.9 -Isamtools/htslib-1.9/htslib -c EXOnator.cpp -o obj/EXOnator.o
g++ -O3 -std=c++11 -lpthread -DCNVNATOR_VERSION=\"v0.4.1\"  -I/gpfs/runtime/opt/root/6.10/include      -Isamtools -Isamtools/htslib-1.9 -Isamtools/htslib-1.9/htslib -c IO.cpp -o obj/IO.o
g++ -O3 -std=c++11 -lpthread -DCNVNATOR_VERSION=\"v0.4.1\"  -I/gpfs/runtime/opt/root/6.10/include      -Isamtools -Isamtools/htslib-1.9 -Isamtools/htslib-1.9/htslib -c Visualizer.cpp -o obj/Visualizer.o
g++ -O3 -std=c++11 -lpthread -DCNVNATOR_VERSION=\"v0.4.1\"  -I/gpfs/runtime/opt/root/6.10/include      -Isamtools -Isamtools/htslib-1.9 -Isamtools/htslib-1.9/htslib -c HisMaker.cpp -o obj/HisMaker.o
g++ -O3 -std=c++11 -lpthread -DCNVNATOR_VERSION=\"v0.4.1\"  -I/gpfs/runtime/opt/root/6.10/include      -Isamtools -Isamtools/htslib-1.9 -Isamtools/htslib-1.9/htslib -c AliParser.cpp -o obj/AliParser.o
g++ -O3 -std=c++11 -lpthread -DCNVNATOR_VERSION=\"v0.4.1\"  -I/gpfs/runtime/opt/root/6.10/include      -Isamtools -Isamtools/htslib-1.9 -Isamtools/htslib-1.9/htslib -c FastaParser.cpp -o obj/FastaParser.o
g++ -O3 -std=c++11 -lpthread -DCNVNATOR_VERSION=\"v0.4.1\"  -I/gpfs/runtime/opt/root/6.10/include      -Isamtools -Isamtools/htslib-1.9 -Isamtools/htslib-1.9/htslib -c VcfParser.cpp -o obj/VcfParser.o
g++ -O3 -std=c++11 -lpthread -DCNVNATOR_VERSION=\"v0.4.1\"  -I/gpfs/runtime/opt/root/6.10/include      -Isamtools -Isamtools/htslib-1.9 -Isamtools/htslib-1.9/htslib -c Genotyper.cpp -o obj/Genotyper.o
g++ -O3 -std=c++11 -lpthread -DCNVNATOR_VERSION=\"v0.4.1\"  -I/gpfs/runtime/opt/root/6.10/include      -Isamtools -Isamtools/htslib-1.9 -Isamtools/htslib-1.9/htslib -c Interval.cpp -o obj/Interval.o
g++ -O3 -std=c++11 -lpthread -DCNVNATOR_VERSION=\"v0.4.1\"  -I/gpfs/runtime/opt/root/6.10/include      -Isamtools -Isamtools/htslib-1.9 -Isamtools/htslib-1.9/htslib -c Genome.cpp -o obj/Genome.o
g++ -O3 -std=c++11 -lpthread -DCNVNATOR_VERSION=\"v0.4.1\"  -o cnvnator obj/cnvnator.o obj/EXOnator.o obj/IO.o obj/Visualizer.o obj/HisMaker.o obj/AliParser.o obj/FastaParser.o obj/VcfParser.o obj/Genotyper.o obj/Interval.o obj/Genome.o samtools/libbam.a samtools/htslib-1.9/libhts.a -lcrypto -lz -lbz2 -lcurl -llzma -lreadline -L/gpfs/runtime/opt/root/6.10/lib      -lCore -lRIO -lHist -lGraf -lGpad -lTree -lMathCore
/gpfs/runtime/opt/root/6.10/lib/libCore.so: undefined reference to `std::__throw_out_of_range_fmt(char const*, ...)@GLIBCXX_3.4.20'
/gpfs/runtime/opt/root/6.10/lib/libCore.so: undefined reference to `__cxa_throw_bad_array_new_length@CXXABI_1.3.8'
collect2: error: ld returned 1 exit status
make: *** [cnvnator] Error 1
yangliu2009 commented 10 months ago

I got the same sam_file error for version 1.9 and 1.16 of samtools/htslib: AliParser.hh:18:3: error: ?samfile_t? does not name a type; did you mean ?samFile??

The version 1.18 of htslib also doesn't have definition for samfile_t, but still samFile: https://github.com/samtools/htslib/blob/1.18/htslib/sam.h

abyzov commented 10 months ago

Hello, looks like samtools has evolved. My local installation is running with samtools 1.12

Alexej Abyzov, Ph.D. Senior Associate Consultant, Associate Professor of Biomedical Informatics, Department of Quantitative Health Sciences, Center for Individualized Medicine, Mayo Clinic

Mayo Clinic, 200 1st street SW, Harwick 7-91 Rochester, MN 55905 www.abyzovlab.org http://www.abyzovlab.orgtel: +1-(507)-538-0978

yangliu2009 commented 10 months ago

I was able to install cnvnator (commit ae7f64f3e0155f9ee461e32933676e643e1ebfd7, PR #260 ) with samtools 1.12. Thanks.