Error during compilation
kmnip opened this issue · 4 comments
Hi,
I am trying to compile RATTLE, but I run into this error:
-- The CXX compiler identification is GNU 11.2.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /projects/kmnip_prj/conda/miniconda3/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: /home/kmnip/programs/rattle/RATTLE/spoa/build
[ 20%] Building CXX object CMakeFiles/spoa.dir/src/alignment_engine.cpp.o
/home/kmnip/programs/rattle/RATTLE/spoa/src/alignment_engine.cpp: In function 'std::unique_ptr<spoa::AlignmentEngine> spoa::createAlignmentEngine(spoa::AlignmentType, int8_t, int8_t, int8_t, int8_t, int8_t, int8_t)':
/home/kmnip/programs/rattle/RATTLE/spoa/src/alignment_engine.cpp:37:20: error: 'invalid_argument' is not a member of 'std'
37 | throw std::invalid_argument("[spoa::createAlignmentEngine] error: "
| ^~~~~~~~~~~~~~~~
/home/kmnip/programs/rattle/RATTLE/spoa/src/alignment_engine.cpp:41:20: error: 'invalid_argument' is not a member of 'std'
41 | throw std::invalid_argument("[spoa::createAlignmentEngine] error: "
| ^~~~~~~~~~~~~~~~
/home/kmnip/programs/rattle/RATTLE/spoa/src/alignment_engine.cpp:45:20: error: 'invalid_argument' is not a member of 'std'
45 | throw std::invalid_argument("[spoa::createAlignmentEngine] error: "
| ^~~~~~~~~~~~~~~~
make[2]: *** [CMakeFiles/spoa.dir/src/alignment_engine.cpp.o] Error 1
make[1]: *** [CMakeFiles/spoa.dir/all] Error 2
make: *** [all] Error 2
I was using cmake version 3.21.3 and gcc 11.2.0. How do I get around this error?
Thanks!
Hi,
Please use a g++ compiler instead of gcc.
Cheers,
Eileen
I am actually using g++
, i.e.
$ g++ --version
g++ (GCC) 11.2.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
I ran this to set the compiler to g++
:
export CXX=g++
But I am still getting pretty much the same errors:
-- The CXX compiler identification is GNU 11.2.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /projects/kmnip_prj/conda/miniconda3/bin/g++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: /home/kmnip/programs/rattle/RATTLE/spoa/build
[ 20%] Building CXX object CMakeFiles/spoa.dir/src/alignment_engine.cpp.o
/home/kmnip/programs/rattle/RATTLE/spoa/src/alignment_engine.cpp: In function 'std::unique_ptr<spoa::AlignmentEngine> spoa::createAlignmentEngine(spoa::AlignmentType, int8_t, int8_t, int8_t, int8_t, int8_t, int8_t)':
/home/kmnip/programs/rattle/RATTLE/spoa/src/alignment_engine.cpp:37:20: error: 'invalid_argument' is not a member of 'std'
37 | throw std::invalid_argument("[spoa::createAlignmentEngine] error: "
| ^~~~~~~~~~~~~~~~
/home/kmnip/programs/rattle/RATTLE/spoa/src/alignment_engine.cpp:41:20: error: 'invalid_argument' is not a member of 'std'
41 | throw std::invalid_argument("[spoa::createAlignmentEngine] error: "
| ^~~~~~~~~~~~~~~~
/home/kmnip/programs/rattle/RATTLE/spoa/src/alignment_engine.cpp:45:20: error: 'invalid_argument' is not a member of 'std'
45 | throw std::invalid_argument("[spoa::createAlignmentEngine] error: "
| ^~~~~~~~~~~~~~~~
make[2]: *** [CMakeFiles/spoa.dir/src/alignment_engine.cpp.o] Error 1
make[1]: *** [CMakeFiles/spoa.dir/all] Error 2
make: *** [all] Error 2
g++ -o rattle -Wall -Wextra -std=c++14 -O3 -pthread -Ispoa/include main.cpp fasta.o cluster.o utils.o kmer.o similarity.o correct.o spoa/build/lib/libspoa.a
main.cpp: In function 'int main(int, char**)':
main.cpp:378:31: warning: comparison of integer expressions of different signedness: 'std::vector<cseq_t>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
378 | if (c.seqs.size() > min_reads) {
| ~~~~~~~~~~~~~~^~~~~~~~~~~
/projects/kmnip_prj/conda/miniconda3/bin/../lib/gcc/x86_64-conda-linux-gnu/11.2.0/../../../../x86_64-conda-linux-gnu/bin/ld: cannot find spoa/build/lib/libspoa.a: No such file or directory
collect2: error: ld returned 1 exit status
make: *** [rattle] Error 1
SPOA seems cannot be built by the latest compiler.
You could change spoa/CMakeLists.txt
Line 10 into
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -std=c++14 -pedantic")
If the above method still can't work. There is another method to downgrade g++ & gcc compiler to an old version such as 9.4.0 or 7.5.0, it should solve your problem.
Please let me know if it doesn't work.
Thanks,
Eileen
Hi Eileen,
Tweaking spoa/CMakeList.txt
did not work, but downgrading g++ and gcc to version 9.4.0 works like a charm!
Thanks for your help!!
Ka Ming