COMBINE-lab / cuttlefish

Building the compacted de Bruijn graph efficiently from references or reads.
BSD 3-Clause "New" or "Revised" License
81 stars 9 forks source link

KMC compilation error when compiling from source #45

Open Sawwave opened 2 days ago

Sawwave commented 2 days ago

When compiling cuttlefish from source, the included kmc_core seems to have compilation errors due to an incorrect #include.

Specifically, the following errors are generated.


In file included from kmc_core/mem_disk_file.cpp:12:
kmc_core/critical_error_handler.h: In member function ‘void CCriticalErrorHandler::HandleCriticalError(const std::string&)’:
kmc_core/critical_error_handler.h:77:28: error: ‘runtime_error’ is not a member of ‘std’
77 |                 throw std::runtime_error(msg);
|                            ^~~~~~~~~~~~~
kmc_core/critical_error_handler.h:7:1: note: ‘std::runtime_error’ is defined in header ‘<stdexcept>’; this is probably fixable by adding ‘#include <stdexcept>’
6 | #include <condition_variable>
+++ |+#include <stdexcept>
7 |
In file included from kmc_core/queues.h:25,
from kmc_core/params.h:16,
from kmc_core/bkb_writer.h:14,
from kmc_core/bkb_writer.cpp:11:
kmc_core/critical_error_handler.h: In member function ‘void CCriticalErrorHandler::HandleCriticalError(const std::string&)’:
kmc_core/critical_error_handler.h:77:28: error: ‘runtime_error’ is not a member of ‘std’
77 |                 throw std::runtime_error(msg);
|                            ^~~~~~~~~~~~~
kmc_core/critical_error_handler.h:7:1: note: ‘std::runtime_error’ is defined in header ‘<stdexcept>’; this is probably fixable by adding ‘#include <stdexcept>’
6 | #include <condition_variable>
+++ |+#include <stdexcept>
7 |
make[3]: *** [Makefile:118: kmc_core/mem_disk_file.o] Error 1
make[3]: *** Waiting for unfinished jobs....
In file included from kmc_core/queues.h:25,
from kmc_core/params.h:16,
from kmc_core/bkb_reader.h:15,
from kmc_core/bkb_reader.cpp:11:
kmc_core/critical_error_handler.h: In member function ‘void CCriticalErrorHandler::HandleCriticalError(const std::string&)’:
kmc_core/critical_error_handler.h:77:28: error: ‘runtime_error’ is not a member of ‘std’
77 |                 throw std::runtime_error(msg);
|                            ^~~~~~~~~~~~~
kmc_core/critical_error_handler.h:7:1: note: ‘std::runtime_error’ is defined in header ‘<stdexcept>’; this is probably fixable by adding ‘#include <stdexcept>’
6 | #include <condition_variable>
+++ |+#include <stdexcept>
7 |
make[3]: *** [Makefile:118: kmc_core/bkb_writer.o] Error 1
make[3]: *** [Makefile:118: kmc_core/bkb_reader.o] Error 1
make[2]: *** [CMakeFiles/prj_kmc.dir/build.make:86: prj_kmc-prefix/src/prj_kmc-stamp/prj_kmc-build] Error 2
make[1]: *** [CMakeFiles/Makefile2:104: CMakeFiles/prj_kmc.dir/all] Error 2
make: *** [Makefile:136: all] Error 2

Is the wrong KMC version being downloaded with curl in the cmake build? Currently, the cmake file specifies the following for KMC:


# Prepare the `kmc` library — required by the Cuttlefish algorithm implementation.
# NOTE: do something more intelligent below than the -j4
message("Build system will fetch and install KMC3")
ExternalProject_Add(prj_kmc
    DOWNLOAD_DIR        ${CMAKE_SOURCE_DIR}/external
    DOWNLOAD_COMMAND    curl -k -L  /KMC/archive/refs/tags/v3.2.1.tar.gz -o KMC-3.2.1.tar.gz &&
                        tar -xzf KMC-3.2.1.tar.gz &&
                        rm KMC-3.2.1.tar.gz
    PATCH_COMMAND       patch --strip 1 < ${CMAKE_SOURCE_DIR}/patches/kmc_patch.diff
    SOURCE_DIR          ${CMAKE_SOURCE_DIR}/external/KMC-3.2.1
    BUILD_IN_SOURCE     TRUE
    INSTALL_DIR         ${CMAKE_SOURCE_DIR}/external/
    CONFIGURE_COMMAND   ""
    BUILD_COMMAND       make -j4 CC=${CMAKE_CXX_COMPILER} simde && make -j4 CC=${CMAKE_CXX_COMPILER} kmc
    INSTALL_COMMAND     cp bin/libkmc_core.a ${EXT_LIB} &&
                        cp include/kmc_runner.h ${EXT_INCLUDE}
)
rob-p commented 1 day ago

Can you say what version of GCC or clang you are using? Sometimes compilers update and break in an incompatible way (the newer compilers are stricter). We generally test on GCC 11, so there may be compilation problems on GCC 13 we aren't catching.

Sawwave commented 1 day ago
gcc --version
gcc (GCC) 14.2.1 20240910
Copyright (C) 2024 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.