AntonBankevich/LJA

Compile fails

shaze opened this issue · 2 comments

shaze commented

We're trying to install LJA but I've been struggling.

I'm using cmake 3.17.5 and gcc 11.2.1 on Centos 7

cmake succeeds, but compilation fails -- I get the following. The error seems to be related to compliance with C++17 but the appropriate flags seem set and the compiler does seem right (I've tried with gcc 9 and get the same -- and if I try gcc 4 then the cmake3 step fails as expected)

We'd be grateful for any suggestions -- thanks

[  1%] Building CXX object src/projects/dbg/CMakeFiles/lja_dbg.dir/sparse_dbg.cpp.o
[  3%] Building CXX object src/projects/dbg/CMakeFiles/lja_dbg.dir/graph_algorithms.cpp.o
[  4%] Building CXX object src/projects/dbg/CMakeFiles/lja_dbg.dir/dbg_disjointigs.cpp.o
[  6%] Building CXX object src/projects/dbg/CMakeFiles/lja_dbg.dir/dbg_construction.cpp.o
[  8%] Building CXX object src/projects/dbg/CMakeFiles/lja_dbg.dir/minimizer_selection.cpp.o
[  9%] Building CXX object src/projects/dbg/CMakeFiles/lja_dbg.dir/paths.cpp.o
[ 11%] Building CXX object src/projects/dbg/CMakeFiles/lja_dbg.dir/graph_alignment_storage.cpp.o
[ 12%] Building CXX object src/projects/dbg/CMakeFiles/lja_dbg.dir/component.cpp.o
[ 14%] Building CXX object src/projects/dbg/CMakeFiles/lja_dbg.dir/graph_modification.cpp.o
[ 16%] Linking CXX static library ../../../lib/liblja_dbg.a
[ 16%] Built target lja_dbg
Scanning dependencies of target repeat_resolution
[ 17%] Building CXX object src/projects/repeat_resolution/CMakeFiles/repeat_resolution.dir/paths.cpp.o
In file included from /root/see/LJA-untagged-c539e6b1159980742576/src/projects/repeat_resolution/mdbg_topology.hpp:12,
                 from /root/see/LJA-untagged-c539e6b1159980742576/src/projects/repeat_resolution/paths.hpp:7,
                 from /root/see/LJA-untagged-c539e6b1159980742576/src/projects/repeat_resolution/paths.cpp:5:
/root/see/LJA-untagged-c539e6b1159980742576/src/tools/graphlite/serialize.hpp:36:18: error: ‘optional’ in namespace ‘std’ does not name a template type
   36 |             std::optional<std::function<std::string(const PT&)>> fmt;
      |                  ^~~~~~~~
/root/see/LJA-untagged-c539e6b1159980742576/src/tools/graphlite/serialize.hpp:13:1: note: ‘std::optional’ is defined in header ‘<optional>’; did you forget to ‘#include <optional>’?
   12 | #include "graphlite.hpp"
  +++ |+#include <optional>
   13 | #include <deque>
In file included from /root/see/LJA-untagged-c539e6b1159980742576/src/projects/repeat_resolution/mdbg_topology.hpp:12,
                 from /root/see/LJA-untagged-c539e6b1159980742576/src/projects/repeat_resolution/paths.hpp:7,
                 from /root/see/LJA-untagged-c539e6b1159980742576/src/projects/repeat_resolution/paths.cpp:5:
/root/see/LJA-untagged-c539e6b1159980742576/src/tools/graphlite/serialize.hpp: In member function ‘void graph_lite::Serializer<NodeType, NodePropType, EdgePropType, direction, multi_edge, self_loop, adj_list_spec, neighbors_container_spec>::delete_node_formatter()’:
/root/see/LJA-untagged-c539e6b1159980742576/src/tools/graphlite/serialize.hpp:247:33: error: ‘nullopt’ is not a member of ‘std’
  247 |             node_fmt.fmt = std::nullopt;
      |                                 ^~~~~~~
/root/see/LJA-untagged-c539e6b1159980742576/src/tools/graphlite/serialize.hpp: In member function ‘void graph_lite::Serializer<NodeType, NodePropType, EdgePropType, direction, multi_edge, self_loop, adj_list_spec, neighbors_container_spec>::delete_edge_formatter()’:
/root/see/LJA-untagged-c539e6b1159980742576/src/tools/graphlite/serialize.hpp:258:33: error: ‘nullopt’ is not a member of ‘std’
  258 |             edge_fmt.fmt = std::nullopt;
      |                                 ^~~~~~~
make[2]: *** [src/projects/repeat_resolution/CMakeFiles/repeat_resolution.dir/build.make:83: src/projects/repeat_resolution/CMakeFiles/repeat_resolution.dir/paths.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:852: src/projects/repeat_resolution/CMakeFiles/repeat_resolution.dir/all] Error 2
make: *** [Makefile:150: all] Error 2
shaze commented

I should have added -- I have tried both with the release version and the current GitHub state.

shaze commented

Sorry I see this is very similar to issue #16 and I used the advice given by ASLeonard. I added #include <optional> to repeat_resolution/mdbg_topology.hpp and then the make completed fine. I see ASLeonard also used CentOS 7. However, we used RH scl enable devtoolset-11 rather than conda to enable a newer compiler.

As an aside, when I tested on an Ubuntu machine, the make worked find without having to make this change so it does seem that it may be an OS issue.