rega-cev / virulign

VIRULIGN: fast codon-correct alignment and annotation of viral genomes
GNU General Public License v2.0
31 stars 12 forks source link

Building from source on Linux #19

Closed Egors01 closed 3 years ago

Egors01 commented 3 years ago

Hello, I am trying to build the virulign on the local directory on the shared node of the HPC-cluster. The cmake finds compiler and does not raise any errors. Then every target is compiled, but the problem occurs at the last step of linking the target (below) It throws a long output of "undefined reference" errors.

[ 96%] Building CXX object src/CMakeFiles/virulign.dir/Virulign.cpp.o [100%] Linking CXX executable virulign guile: warning: failed to install locale ld: CMakeFiles/virulign.dir/Virulign.cpp.o: in function void std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char*>(char*, char*, std::forward_iterator_tag) [clone .isra.0]': Virulign.cpp:(.text+0x6b): undefined reference tostd::cxx11::basic_string<char, std::char_traits, std::allocator >::_M_create(unsigned long&, unsigned long)' ld: CMakeFiles/virulign.dir/Virulign.cpp.o: in function `std::cxx11::basic_string<char, std::char_traits, std::allocator >::basic_string(char const, std::allocator const&) [clone .constprop.0]': Virulign.cpp:(.text+0x11b): undefined reference to std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_create(unsigned long&, unsigned long)' ld: CMakeFiles/virulign.dir/Virulign.cpp.o: in functionloadRefSeq(std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&) [clone .cold]': Virulign.cpp:(.text.unlikely+0x16): undefined reference to `std::runtime_error::runtime_error(char const)'

.... and hundreds of similar lines

I have difficulty troubleshooting this issue since I can't see where the errors point. Should I use a specific cpp standard or add some flags to CMakeLists ?

I attach the file with the cmake&make commands and their full output CompileLog.txt

Kind regards Egor

plibin commented 3 years ago

Hi Egor,

When I look at your compile log file, I notice that your C and CXX compiler versions differ. And, when I google for the type of errors you get, the first hit is about std lib ABI problems, so is it possible that you’re somehow mixing environments?

Are you using an HPC with a module system? If so, try to load a recent version of gcc explicitly, and if necessary try to specify the correct version of the compiler.

For certain c++ projects, I also need to specify a particular compiler on our HPC, and this can be done by defining these env vars, prior to running cmake: export CXX=/apps/leuven/haswell/2018a/software/GCCcore/6.4.0/bin/c++ export CC=/apps/leuven/haswell/2018a/software/GCCcore/6.4.0/bin/gcc

Please let us know whether this works, or if you need additional assistance.

Kind regards,

Pieter

On 2 Mar 2021, at 18:42, Egors01 notifications@github.com<mailto:notifications@github.com> wrote:

Hello, I am trying to build the virulign on the local directory on the shared node of the HPC-cluster. The cmake finds compiler and does not raise any errors. Then every target is compiled, but the problem occurs at the last step of linking the target (below) It throws a long output of "undefined reference" errors.

[ 96%] Building CXX object src/CMakeFiles/virulign.dir/Virulign.cpp.o [100%] Linking CXX executable virulign guile: warning: failed to install locale ld: CMakeFiles/virulign.dir/Virulign.cpp.o: in function void std::cxx11::basic_string<char, std::char_traits, std::allocator >::_M_construct<char>(char, char*, std::forward_iterator_tag) [clone .isra.0]': Virulign.cpp:(.text+0x6b): undefined reference to std::cxx11::basic_string<char, std::char_traits, std::allocator >::_M_create(unsigned long&, unsigned long)' ld: CMakeFiles/virulign.dir/Virulign.cpp.o: in function std::__cxx11::basic_string<char, std::char_traits, std::allocator >::basic_string(char const, std::allocator const&) [clone .constprop.0]': Virulign.cpp:(.text+0x11b): undefined reference to std::cxx11::basic_string<char, std::char_traits, std::allocator >::_M_create(unsigned long&, unsigned long)' ld: CMakeFiles/virulign.dir/Virulign.cpp.o: in function loadRefSeq(std::cxx11::basic_string<char, std::char_traits, std::allocator > const&) [clone .cold]': Virulign.cpp:(.text.unlikely+0x16): undefined reference to std::runtime_error::runtime_error(char const)'

.... and hundreds of similar lines

I have difficulty troubleshooting this issue since I can't see where the errors point. Should I use a specific cpp standard or add some flags to CMakeLists ?

I attach the file with the cmake&make commands and their full output CompileLog.txthttps://github.com/rega-cev/virulign/files/6070647/CompileLog.txt

Kind regards Egor

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/rega-cev/virulign/issues/19, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ABJOXASF6LISJY7WPIG5VBTTBUPPVANCNFSM4YPN2KZA.

[ { "@context": "http://schema.org", "@type": "EmailMessage", "potentialAction": { "@type": "ViewAction", "target": "https://github.com/rega-cev/virulign/issues/19", "url": "https://github.com/rega-cev/virulign/issues/19", "name": "View Issue" }, "description": "View this Issue on GitHub", "publisher": { "@type": "Organization", "name": "GitHub", "url": "https://github.com" } } ]

Egors01 commented 3 years ago

@plibin Indeed, seems that the discrepancy between the versions of the C ang CXX was the cause of the problem.

I have modified the variable to explicitly point to the gcc and g++ of the same toolchain. Everything compiles fine now. I will update this message, once I run the alignment.

Thanks a lot

- UPD The aligner works fine 16/03/2021.