soedinglab / xxmotif

XXmotif: eXhaustive, weight matriX-based motif discovery in nucleotide sequences
GNU General Public License v3.0
1 stars 0 forks source link

Build failure with newer GNU compilers #2

Open martin-g opened 2 months ago

martin-g commented 2 months ago

I tried to add support for Linux ARM64 to the Bioconda recipe but I faced a compilation error:

13:20:23 [32mBIOCONDA INFO[0m (OUT) /opt/conda/conda-bld/xxmotif_1712841496861/_build_env/aarch64-conda-linux-gnu/include/c++/7.5.0/bits/list.tcc:277:28: error: no match for 'operator!=' (operand types are 'Pool_alloc<std::_List_node<Match> >' and 'const Pool_alloc<std::_List_node<Match> >')[0m
13:20:23 [32mBIOCONDA INFO[0m (OUT)             && __this_alloc != __that_alloc)[0m
13:20:23 [32mBIOCONDA INFO[0m (OUT)                ~~~~~~~~~~~~~^~~~~~~~~~~~~~~[0m
13:20:23 [32mBIOCONDA INFO[0m (OUT) In file included from /opt/conda/conda-bld/xxmotif_1712841496861/_build_env/aarch64-conda-linux-gnu/include/c++/7.5.0/iosfwd:40:0,[0m
13:20:23 [32mBIOCONDA INFO[0m (OUT)                  from /opt/conda/conda-bld/xxmotif_1712841496861/_build_env/aarch64-conda-linux-gnu/include/c++/7.5.0/ios:38,[0m
13:20:23 [32mBIOCONDA INFO[0m (OUT)                  from /opt/conda/conda-bld/xxmotif_1712841496861/_build_env/aarch64-conda-linux-gnu/include/c++/7.5.0/ostream:38,[0m
13:20:23 [32mBIOCONDA INFO[0m (OUT)                  from /opt/conda/conda-bld/xxmotif_1712841496861/_build_env/aarch64-conda-linux-gnu/include/c++/7.5.0/iostream:39,[0m
13:20:23 [32mBIOCONDA INFO[0m (OUT)                  from /opt/conda/conda-bld/xxmotif_1712841496861/work/src/AbstractKmer.cpp:1:[0m

It seems it was due to the newer version of the compiler. GNU compiler v7.5.0 is the oldest one that could be used at Bioconda!

So, I needed to make this changes to the source code to be able to build it:


diff --git CMakeLists.txt CMakeLists.txt
index 85c64b6..100a843 100644
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -9,7 +9,7 @@ set(XXMOTIF_PATCH_VERSION 6)
 set(XXMOTIF_VERSION ${XXMOTIF_MAJOR_VERSION}.${XXMOTIF_MINOR_VERSION}.${XXMOTIF_PATCH_VERSION})

-set(CMAKE_CXX_FLAGS "-std=c++11 -DLOG_MAX_LEVEL=0 -D__GXX_EXPERIMENTAL_CXX0X__ -O3 -g3 -pedantic -pedantic-errors -Wall -fmessage-length=0 -fno-strict-aliasing -Wconversion")
+set(CMAKE_CXX_FLAGS "-std=c99 -DLOG_MAX_LEVEL=0 -D__GXX_EXPERIMENTAL_CXX0X__ -O3 -g3 -pedantic -pedantic-errors -Wall -fmessage-length=0 -fno-strict-aliasing -Wconversion")

 set(CMAKE_C_FLAGS "-D__GXX_EXPERIMENTAL_CXX0X__ -O3 -pedantic -pedantic-errors -Wall -fmessage-length=0 -Wconversion")

diff --git src/memoryPool/pool_alloc.h src/memoryPool/pool_alloc.h
index c1fe05b..925f31d 100644
--- src/memoryPool/pool_alloc.h
+++ src/memoryPool/pool_alloc.h
@@ -90,4 +90,14 @@ private:

 template <class T> Pool Pool_alloc<T>::mem(sizeof(T));

+template <class T, class U, std::size_t N>
+inline bool operator==(const Pool_alloc<T>& a, const Pool_alloc<U>& b){
+    return &a == &b;
+}
+
+template <class T, class U>
+inline bool operator!=(const Pool_alloc<T>& a, const Pool_alloc<U>& b){
+    return &a != &b;
+}
+
 #endif /* POOL_ALLOC_H */

I'd open a Pull Request but the project has no updates since 8 years and I don't expect it to be merged. Please let me know if you'd like me to open a PR! I hope the patch is useful to other users!

martin-g commented 2 months ago

Cross-ref: https://github.com/bioconda/bioconda-recipes/pull/47161