Illumina / ExpansionHunter

A tool for estimating repeat sizes
Other
182 stars 51 forks source link

Will not build with GCC 11 #168

Open signalbox2 opened 2 years ago

signalbox2 commented 2 years ago

When building from source with GCC 11.2.0 it fails with this error:

/home/apps/eb/tmp/ExpansionHunter/v5.0.0/GCC-11.2.0/ExpansionHunter-5.0.0/ehunter/thirdparty/graph-tools-master-f421f4c/src/graphcore/GraphCoordinates.cpp: In c onstructor graphtools::GraphCoordinates::GraphCoordinatesImpl::GraphCoordinatesImpl(const graphtools::Graph*): /home/apps/eb/tmp/ExpansionHunter/v5.0.0/GCC-11.2.0/ExpansionHunter-5.0.0/ehunter/thirdparty/graph-tools-master-f421f4c/src/graphcore/GraphCoordinates.cpp:52:40 : error: numeric_limits is not a member of std 52 | size_t min_dist = std::numeric_limits<size_t>::max(); | ^~~~~~~~~~~~~~ This seems to be a known issue updating code for GCC 11 https://www.gnu.org/software/gcc/gcc-11/porting_to.html

_Header dependency changes Some C++ Standard Library headers have been changed to no longer include other headers that were being used internally by the library. As such, C++ programs that used standard library components without including the right headers will no longer compile.

The following headers are used less widely in libstdc++ and may need to be included explicitly when compiled with GCC 11:

(for std::numeric_limits) (for std::unique_ptr, std::shared_ptr etc.) (for std::pair, std::tuple_size, std::index_sequence etc.) (for members of namespace std::this_thread.)_ The fix will be to add #include
ccario83 commented 1 year ago

I'm also having this issue and agree with the fix. A work-around is to compile with GCC 10, which will require selecting it as an alternative compiler:

A guide on how to do this is here.

In short, here's how to do this (on Ubuntu 22.04):

sudo apt update
sudo apt install build-essential
sudo apt -y install gcc-10
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 10
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 11
sudo update-alternatives --config gcc # Select version 10
gcc --version # Should say gcc (Ubuntu 10.4.0-4ubuntu1~22.04) 10.4.0 or similar

And then follow the Install instructions:

cd ExpansionHunter
mkdir build
cd build
cmake ..
make

If it finishes successfully, you'll want to set the default compiler back to GCC 11:

sudo update-alternatives --config gcc # Select version 11
gcc --version # Should say gcc (Ubuntu 11.3.0-1ubuntu1~22.04.1) 11.3.0