Closed noahrose closed 3 years ago
I resolved this issue by using a newer compiler (gcc 8.3.1), but now I'm having issues properly linking htslib dependencies -- any advice you might have would be greatly appreciated!
[ 31%] Linking CXX executable BarcodeExtract
CMakeFiles/BarcodeExtract.dir/barcode_extractor/BAMReader.cpp.o: In function BAMReader::BAMReader(char const*)': BAMReader.cpp:(.text+0x28): undefined reference to
hts_open'
BAMReader.cpp:(.text+0x3d): undefined reference to hts_idx_load' BAMReader.cpp:(.text+0x4e): undefined reference to
sam_hdr_read'
BAMReader.cpp:(.text+0x5c): undefined reference to bam_init1' CMakeFiles/BarcodeExtract.dir/barcode_extractor/BAMReader.cpp.o: In function
BAMReader::~BAMReader()':
BAMReader.cpp:(.text+0xb8): undefined reference to hts_close' BAMReader.cpp:(.text+0xc1): undefined reference to
sam_hdr_destroy'
BAMReader.cpp:(.text+0xca): undefined reference to hts_itr_destroy' BAMReader.cpp:(.text+0xd3): undefined reference to
hts_idx_destroy'
CMakeFiles/BarcodeExtract.dir/barcode_extractor/BAMReader.cpp.o: In function BAMReader::seek_to_contig(char const*)': BAMReader.cpp:(.text+0x101): undefined reference to
sam_hdr_name2tid'
BAMReader.cpp:(.text+0x10d): undefined reference to hts_itr_destroy' BAMReader.cpp:(.text+0x125): undefined reference to
sam_itr_querys'
CMakeFiles/BarcodeExtract.dir/barcode_extractor/BAMReader.cpp.o: In function AlignedReads::AlignedReads(bam1_t*)': BAMReader.cpp:(.text+0x1a7): undefined reference to
bam_aux_get'
CMakeFiles/BarcodeExtract.dir/barcode_extractor/BAMReader.cpp.o: In function BAMReader::read_into_struct(AlignedReads*&)': BAMReader.cpp:(.text+0x2f4): undefined reference to
hts_itr_next'
CMakeFiles/BarcodeExtract.dir/barcode_extractor/BAMReader.cpp.o: In function BAMReader::~BAMReader()': BAMReader.cpp:(.text+0xdd): undefined reference to
bam_destroy1'
collect2: error: ld returned 1 exit status
make[2]: [CMakeFiles/BarcodeExtract.dir/build.make:148: BarcodeExtract] Error 1
make[1]: [CMakeFiles/Makefile2:97: CMakeFiles/BarcodeExtract.dir/all] Error 2
This worked, leaving it here for anyone else with the same issue (to substitute their own paths and gcc modules etc if compiling on a cluster):
git clone https://github.com/deepomicslab/SpecHap.git module load cmake/3.x rh/devtoolset/8 cd SpecHap mkdir build && cd builid cmake .. -D HTSlib_INCLUDE_DIR=/usr/local/samtools/1.4.1/include -D HTSlib_LIBRARY=/usr/local/samtools/1.4.1/lib64/libhts.so -D ARPACK_INCLUDE_DIR="" make
also, for extractHAIRS compilation there's a typo, should be: cd /path/to/SpecHap/ git submodule init && git submodule update cd submodules/htslib git checkout 26229a3 cd ../samtools git checkout 255f97d cd ../../hairs-src make
(hairs-src directory is listed as hair-src in the README)
Hi noahrose, thank you for trying out SpecHap and sorry for the late reply. SpecHap has been tested on gcc >= 7. Therefore you need a newer compiler, which I believe you already figured out by yourself.
The CMake script will search for arpack and htslib in predefined locations:
/usr/local:$HOME/local:$HOME/.local
If you are installing without superuser privilege, try to put the arpack and htslib in your home directory. I will also update the script to search packages in the conda installation directory.
And yes you can specified the library path by yourself with the CMake -D options, I will make this part of the user guide for installation.
We are testing SpecHap with older gcc right now. We will also make it a conda package/docker image with the next release version according to your suggestion.
Thanks for your response -- that all makes sense and sounds great! Thanks again for your work developing these tools.
Hi there,
I'm interested in trying out your program -- I'm working on an organism with a large and diverse genome so I was excited to see your manuscript getting good results in that situation. However, I'm having some trouble compiling, during the make step.
I'm not totally sure what to make of this error I'm getting -- I had to manually set the path to htslib in BAMReader.h (since I am operating on a cluster and cannot do "make install"), so I am not sure if that could be related to this problem as well.
Alternatively, do you have any plans to make the package available as a static binary, docker/singularity, or conda distribution?
[ 25%] Building CXX object CMakeFiles/BarcodeExtract.dir/barcode_extractor/worker.cpp.o /usr/bin/g++ -D_GLIBCXX_USE_CXX11_ABI=0 -I/home/noahr/bin/SpecHap/build -I/home/noahr/bin/SpecHap -O3 -std=gnu++11 -o CMakeFiles/BarcodeExtract.dir/barcode_extractor/worker.cpp.o -c /home/noahr/bin/SpecHap/barcode_extractor/worker.cpp In file included from /usr/include/c++/4.8.2/algorithm:62:0, from /home/noahr/bin/SpecHap/barcode_extractor/worker.cpp:7: /home/noahr/bin/SpecHap/barcode_extractor/worker.cpp:95:43: note: candidates are: std::sort(temp.begin(), temp.end(), [=](val_pair &a, val_pair &b) ^ In file included from /usr/include/c++/4.8.2/algorithm:62:0, from /home/noahr/bin/SpecHap/barcode_extractor/worker.cpp:7: /usr/include/c++/4.8.2/bits/stl_algo.h:2263:35: note: bool (*)(val_pair&, val_pair&) {aka bool (*)(std::pair<std::basic_string<char>, Barcode>&, std::pair<std::basic_string<char>, Barcode>&)} <conversion> while (__comp(*__first, __pivot)) ^ /usr/include/c++/4.8.2/bits/stl_algo.h:2263:35: note: candidate expects 3 arguments, 3 provided /home/noahr/bin/SpecHap/barcode_extractor/worker.cpp:95:69: note: worker::write_frags(const char*)::__lambda0 std::sort(temp.begin(), temp.end(), [=](val_pair &a, val_pair &b) ^ /home/noahr/bin/SpecHap/barcode_extractor/worker.cpp:95:69: note: /home/noahr/bin/SpecHap/barcode_extractor/worker.cpp:95:43: note: candidates are: std::sort(temp.begin(), temp.end(), [=](val_pair &a, val_pair &b) ^ In file included from /usr/include/c++/4.8.2/algorithm:62:0, from /home/noahr/bin/SpecHap/barcode_extractor/worker.cpp:7: /usr/include/c++/4.8.2/bits/stl_algo.h:2266:34: note: bool (*)(val_pair&, val_pair&) {aka bool (*)(std::pair<std::basic_string<char>, Barcode>&, std::pair<std::basic_string<char>, Barcode>&)} <conversion> while (__comp(__pivot, *__last)) ^ /usr/include/c++/4.8.2/bits/stl_algo.h:2266:34: note: candidate expects 3 arguments, 3 provided /home/noahr/bin/SpecHap/barcode_extractor/worker.cpp:95:69: note: worker::write_frags(const char*)::__lambda0 std::sort(temp.begin(), temp.end(), [=](val_pair &a, val_pair &b) ^ /home/noahr/bin/SpecHap/barcode_extractor/worker.cpp:95:69: note: make[2]: *** [CMakeFiles/BarcodeExtract.dir/barcode_extractor/worker.cpp.o] Error 1 make[2]: Leaving directory
/home/noahr/bin/SpecHap/build' make[1]: [CMakeFiles/BarcodeExtract.dir/all] Error 2 make[1]: Leaving directory `/home/noahr/bin/SpecHap/build' make: [all] Error 2`