marbl / harvest

Other
51 stars 11 forks source link

Unable to build Parsnp on Ubuntu 18.04.1 #42

Open isaurabhkr opened 5 years ago

isaurabhkr commented 5 years ago

I am trying to build Parsnp on my Linux machine, I have built libMUSCLE succesfully but while bulding Parsnp it is giving me these errors.

$ sudo make install
Making all in src
make[1]: Entering directory '/home/sroot/parsnp_src/src'
g++ -O3 -m64 -fopenmp -funroll-all-loops -fomit-frame-pointer -ftree-vectorize  -g -O2 -lgomp -lstdc++ -lpthread -std=gnu++0x -Wl,-rpath,/home/sroot/parsnp_src/muscle/lib -L/home/sroot/parsnp_src/muscle/lib -lMUSCLE-3.7   -o parsnp parsnp-MuscleInterface.o parsnp-parsnp.o parsnp-LCB.o parsnp-LCR.o parsnp-TMum.o parsnp-Converter.o ./ext/parsnp-iniFile.o  
parsnp-MuscleInterface.o: In function `MuscleInterface::CallMuscleFast(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&)':
/home/sroot/parsnp_src/src/MuscleInterface.cpp:44: undefined reference to `muscle::g_uMaxIters'
/home/sroot/parsnp_src/src/MuscleInterface.cpp:48: undefined reference to `muscle::g_SeqWeight1'
/home/sroot/parsnp_src/src/MuscleInterface.cpp:43: undefined reference to `muscle::g_SeqType'
/home/sroot/parsnp_src/src/MuscleInterface.cpp:45: undefined reference to `muscle::g_bStable'
/home/sroot/parsnp_src/src/MuscleInterface.cpp:46: undefined reference to `muscle::g_bVerbose'
/home/sroot/parsnp_src/src/MuscleInterface.cpp:47: undefined reference to `muscle::g_bQuiet'
/home/sroot/parsnp_src/src/MuscleInterface.cpp:49: undefined reference to `muscle::SetMaxIters(unsigned int)'
/home/sroot/parsnp_src/src/MuscleInterface.cpp:50: undefined reference to `muscle::SetSeqWeightMethod(muscle::SEQWEIGHT)'
/home/sroot/parsnp_src/src/MuscleInterface.cpp:51: undefined reference to `muscle::g_ulMaxSecs'
parsnp-MuscleInterface.o: In function `MuscleInterface::CallMuscleFast(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&)':
/home/sroot/parsnp_src/src/../muscle/libMUSCLE/seqvect.h:14: undefined reference to `vtable for muscle::SeqVect'
parsnp-MuscleInterface.o: In function `MuscleInterface::CallMuscleFast(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&)':
/home/sroot/parsnp_src/src/MuscleInterface.cpp:62: undefined reference to `muscle::SeqVect::AppendSeq(muscle::Seq const&)'
/home/sroot/parsnp_src/src/MuscleInterface.cpp:58: undefined reference to `muscle::Seq::SetName(char const*)'
/home/sroot/parsnp_src/src/MuscleInterface.cpp:65: undefined reference to `muscle::MSA::MSA()'
/home/sroot/parsnp_src/src/MuscleInterface.cpp:66: undefined reference to `muscle::MUSCLE(muscle::SeqVect&, muscle::MSA&)'
/home/sroot/parsnp_src/src/MuscleInterface.cpp:72: undefined reference to `muscle::MSA::GetSeqIndex(unsigned int) const'
/home/sroot/parsnp_src/src/MuscleInterface.cpp:73: undefined reference to `muscle::MSA::GetSeqBuffer(unsigned int) const'
/home/sroot/parsnp_src/src/MuscleInterface.cpp:65: undefined reference to `muscle::MSA::~MSA()'
/home/sroot/parsnp_src/src/MuscleInterface.cpp:52: undefined reference to `muscle::SeqVect::~SeqVect()'
/home/sroot/parsnp_src/src/MuscleInterface.cpp:52: undefined reference to `muscle::SeqVect::~SeqVect()'
/home/sroot/parsnp_src/src/MuscleInterface.cpp:65: undefined reference to `muscle::MSA::~MSA()'
collect2: error: ld returned 1 exit status
Makefile:364: recipe for target 'parsnp' failed
make[1]: *** [parsnp] Error 1
make[1]: Leaving directory '/home/sroot/parsnp_src/src'
Makefile:340: recipe for target 'all-recursive' failed
make: *** [all-recursive] Error 1

Please can you help?

tolot27 commented 5 years ago

nm lib/libMUSCLE-3.7.so --demangle lists the referenced functions. Hence, it is a linker problem.

Try make LDADD=-lMUSCLE-3.7. It worked for me. Found the solution at “Undefined reference” error with shared library and ldflags. Makefile.in should be adapted, accordingly.

tolot27 commented 5 years ago

This issue was already reported and solved previously at the parsnip repository https://github.com/marbl/parsnp/issues/57

isaurabhkr commented 5 years ago

Thanks a lot, It worked.