Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build fails with GCC 11 on Linux #3

Open
awvwgk opened this issue Jul 6, 2022 · 4 comments
Open

Build fails with GCC 11 on Linux #3

awvwgk opened this issue Jul 6, 2022 · 4 comments

Comments

@awvwgk
Copy link

awvwgk commented Jul 6, 2022

Trying to build molassembler against Nauty 2.7.2 fails with

[21/81] Building CXX object src/CMakeFiles/molassembler_obj.dir/Molassembler/Graph/Canonicalization.cpp.o
FAILED: src/CMakeFiles/molassembler_obj.dir/Molassembler/Graph/Canonicalization.cpp.o 
/home/abt-grimme/opt/conda/envs/gcc/bin/x86_64-conda-linux-gnu-c++ -DBOOST_ALL_NO_LIB -DBOOST_FILESYSTEM_DYN_LINK -DBOOST_SYSTEM_DYN_LINK -DEIGEN_USE_BLAS -DEIGEN_USE_MKL_ALL -I/tmp1/ehlert/scine/molassembler/src -I/tmp1/ehlert/scine/molassembler/_build/src -I/software/intel/parallel_studio_xe_2019/compilers_and_libraries_2019.6.324/linux/mkl/include -I/tmp1/ehlert/scine/molassembler/_build/RingDecomposerLib/src/RingDecomposerLib -isystem /home/abt-grimme/opt/conda/envs/scine/include -isystem /tmp1/ehlert/scine/molassembler/_build -isystem /home/abt-grimme/opt/conda/envs/scine/include/eigen3 -isystem /home/abt-grimme/opt/conda/envs/scine/include/Scine -fvisibility-inlines-hidden -fmessage-length=0 -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /home/abt-grimme/opt/conda/envs/gcc/include -g -fPIC -fvisibility=hidden -fvisibility-inlines-hidden -fopenmp -Wall -Wextra -Wshadow -Wpedantic -Wduplicated-cond -Wlogical-op -Wold-style-cast -Wuseless-cast -Wdouble-promotion -Wno-maybe-uninitialized -std=gnu++14 -MD -MT src/CMakeFiles/molassembler_obj.dir/Molassembler/Graph/Canonicalization.cpp.o -MF src/CMakeFiles/molassembler_obj.dir/Molassembler/Graph/Canonicalization.cpp.o.d -o src/CMakeFiles/molassembler_obj.dir/Molassembler/Graph/Canonicalization.cpp.o -c /tmp1/ehlert/scine/molassembler/src/Molassembler/Graph/Canonicalization.cpp
In file included from /home/abt-grimme/opt/conda/envs/scine/include/boost/smart_ptr/detail/sp_thread_sleep.hpp:22,
                 from /home/abt-grimme/opt/conda/envs/scine/include/boost/smart_ptr/detail/yield_k.hpp:23,
                 from /home/abt-grimme/opt/conda/envs/scine/include/boost/smart_ptr/detail/spinlock_gcc_atomic.hpp:14,
                 from /home/abt-grimme/opt/conda/envs/scine/include/boost/smart_ptr/detail/spinlock.hpp:42,
                 from /home/abt-grimme/opt/conda/envs/scine/include/boost/smart_ptr/detail/spinlock_pool.hpp:25,
                 from /home/abt-grimme/opt/conda/envs/scine/include/boost/smart_ptr/shared_ptr.hpp:29,
                 from /home/abt-grimme/opt/conda/envs/scine/include/boost/property_map/vector_property_map.hpp:14,
                 from /home/abt-grimme/opt/conda/envs/scine/include/boost/property_map/property_map.hpp:602,
                 from /home/abt-grimme/opt/conda/envs/scine/include/boost/graph/adjacency_list.hpp:27,
                 from /tmp1/ehlert/scine/molassembler/src/Molassembler/Graph/PrivateGraph.h:11,
                 from /tmp1/ehlert/scine/molassembler/src/Molassembler/Graph/Canonicalization.cpp:15:
/home/abt-grimme/opt/conda/envs/scine/include/boost/detail/iterator.hpp:13:1: note: '#pragma message: This header is deprecated. Use <iterator> instead.'
   13 | BOOST_HEADER_DEPRECATED("<iterator>")
      | ^~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/abt-grimme/opt/conda/envs/scine/include/nauty/nausparse.h:26,
                 from /tmp1/ehlert/scine/molassembler/src/Molassembler/Graph/Canonicalization.cpp:24:
/tmp1/ehlert/scine/molassembler/src/Molassembler/Graph/Canonicalization.cpp: In function 'void molassembler_nauty_canonicalize(int, size_t, size_t*, int*, int*, size_t, size_t, size_t, int*, int*)':
/tmp1/ehlert/scine/molassembler/src/Molassembler/Graph/Canonicalization.cpp:51:3: error: '_Thread_local' does not name a type; did you mean 'thread_local'?
   51 |   DYNALLSTAT(int, orbits, orbits_sz);
      |   ^~~~~~~~~~
/tmp1/ehlert/scine/molassembler/src/Molassembler/Graph/Canonicalization.cpp:51:3: error: '_Thread_local' does not name a type; did you mean 'thread_local'?
   51 |   DYNALLSTAT(int, orbits, orbits_sz);
      |   ^~~~~~~~~~
In file included from /home/abt-grimme/opt/conda/envs/scine/include/nauty/nausparse.h:26,
                 from /tmp1/ehlert/scine/molassembler/src/Molassembler/Graph/Canonicalization.cpp:24:
/tmp1/ehlert/scine/molassembler/src/Molassembler/Graph/Canonicalization.cpp:52:26: error: 'orbits_sz' was not declared in this scope
   52 |   DYNALLOC1(int, orbits, orbits_sz, nv, "malloc");
      |                          ^~~~~~~~~
/tmp1/ehlert/scine/molassembler/src/Molassembler/Graph/Canonicalization.cpp:52:18: error: 'orbits' was not declared in this scope
   52 |   DYNALLOC1(int, orbits, orbits_sz, nv, "malloc");
      |                  ^~~~~~
/tmp1/ehlert/scine/molassembler/src/Molassembler/Graph/Canonicalization.cpp:52:18: error: 'orbits' was not declared in this scope
   52 |   DYNALLOC1(int, orbits, orbits_sz, nv, "malloc");
      |                  ^~~~~~
/tmp1/ehlert/scine/molassembler/src/Molassembler/Graph/Canonicalization.cpp:58:34: error: 'orbits' was not declared in this scope
   58 |   sparsenauty(&source, lab, ptn, orbits, &options, &stats, &canong);
      |                                  ^~~~~~
In file included from /home/abt-grimme/opt/conda/envs/scine/include/nauty/nausparse.h:26,
                 from /tmp1/ehlert/scine/molassembler/src/Molassembler/Graph/Canonicalization.cpp:24:
/tmp1/ehlert/scine/molassembler/src/Molassembler/Graph/Canonicalization.cpp:66:19: error: 'orbits_sz' was not declared in this scope
   66 |   DYNFREE(orbits, orbits_sz);
      |                   ^~~~~~~~~
cmake
❯ cmake -B _build -G Ninja -DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX -DSCINE_MARCH=""
-- The C compiler identification is GNU 11.2.0
-- The CXX compiler identification is GNU 11.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /home/abt-grimme/opt/conda/envs/gcc/bin/x86_64-conda-linux-gnu-cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /home/abt-grimme/opt/conda/envs/gcc/bin/x86_64-conda-linux-gnu-c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Setting build type to default 'Debug'
-- Scine::UtilsOS found locally at /home/abt-grimme/opt/conda/envs/scine/lib/cmake/ScineUtilsOS
-- Enabling GCC specific warning flags
-- Could NOT find MKL (missing: MKL_INCLUDE_DIRS) 
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE  
-- Found LAPACKE for use with Eigen3
-- Performing Test COMPILER_HAS_HIDDEN_VISIBILITY
-- Performing Test COMPILER_HAS_HIDDEN_VISIBILITY - Success
-- Performing Test COMPILER_HAS_HIDDEN_INLINE_VISIBILITY
-- Performing Test COMPILER_HAS_HIDDEN_INLINE_VISIBILITY - Success
-- Performing Test COMPILER_HAS_DEPRECATED_ATTR
-- Performing Test COMPILER_HAS_DEPRECATED_ATTR - Success
-- Configuring done
CMake Warning at test/CMakeLists.txt:16 (add_executable):
  Cannot generate a safe runtime search path for target MolassemblerTests
  because files in some directories may conflict with libraries in implicit
  directories:

    runtime library [libgomp.so.1] in /home/abt-grimme/opt/conda/envs/gcc/lib may be hidden by files in:
      /home/abt-grimme/opt/conda/envs/scine/lib

  Some of these libraries may not be found correctly.


-- Generating done
-- Build files have been written to: /tmp1/ehlert/scine/molassembler/_build
mamba info
     active environment : scine
    active env location : /home/abt-grimme/opt/conda/envs/scine
            shell level : 3
       user config file : /home/ehlert/.condarc
 populated config files : /home/abt-grimme/opt/conda/.condarc
                          /home/ehlert/.condarc
          conda version : 4.12.0
    conda-build version : not installed
         python version : 3.9.10.final.0
       virtual packages : __linux=4.12.14=0
                          __glibc=2.26=0
                          __unix=0=0
                          __archspec=1=x86_64
       base environment : /home/abt-grimme/opt/conda  (writable)
      conda av data dir : /home/abt-grimme/opt/conda/etc/conda
  conda av metadata url : None
           channel URLs : https://conda.anaconda.org/conda-forge/linux-64
                          https://conda.anaconda.org/conda-forge/noarch
          package cache : /home/abt-grimme/opt/conda/pkgs
                          /home/ehlert/.conda/pkgs
       envs directories : /home/abt-grimme/opt/conda/envs
                          /home/ehlert/.conda/envs
               platform : linux-64
             user-agent : conda/4.12.0 requests/2.27.1 CPython/3.9.10 Linux/4.12.14-lp151.28.13-default opensuse-leap/15.1 glibc/2.26
                UID:GID : 1748:1001
             netrc file : None
           offline mode : False
mamba list
_libgcc_mutex             0.1                 conda_forge    conda-forge
_openmp_mutex             4.5                  2_kmp_llvm    conda-forge
abseil-cpp                20211102.0           h27087fc_1    conda-forge
boost-cpp                 1.74.0               h75c5d50_8    conda-forge
bzip2                     1.0.8                h7f98852_4    conda-forge
c-ares                    1.18.1               h7f98852_0    conda-forge
ca-certificates           2022.6.15            ha878542_0    conda-forge
cyrus-sasl                2.1.27               h7604b24_5    conda-forge
docutils                  0.19            py310hff52083_0    conda-forge
eigen                     3.4.0                h4bd325d_0    conda-forge
gitdb                     4.0.9              pyhd8ed1ab_0    conda-forge
gitpython                 3.1.27             pyhd8ed1ab_0    conda-forge
gmock                     1.11.0               h924138e_0    conda-forge
gtest                     1.11.0               h924138e_0    conda-forge
icu                       70.1                 h27087fc_0    conda-forge
keyutils                  1.6.1                h166bdaf_0    conda-forge
krb5                      1.19.3               h08a2579_0    conda-forge
ld_impl_linux-64          2.36.1               hea4e1c9_2    conda-forge
libblas                   3.9.0           15_linux64_openblas    conda-forge
libbson                   1.21.2               h27087fc_0    conda-forge
libcblas                  3.9.0           15_linux64_openblas    conda-forge
libcurl                   7.83.1               h2283fc2_0    conda-forge
libedit                   3.1.20191231         he28a2e2_2    conda-forge
libev                     4.33                 h516909a_1    conda-forge
libffi                    3.4.2                h7f98852_5    conda-forge
libgcc-ng                 12.1.0              h8d9b700_16    conda-forge
libgfortran-ng            12.1.0              h69a702a_16    conda-forge
libgfortran5              12.1.0              hdcd56e2_16    conda-forge
libgomp                   12.1.0              h8d9b700_16    conda-forge
liblapack                 3.9.0           15_linux64_openblas    conda-forge
libmongoc                 1.21.2               h0506597_0    conda-forge
libmongocxx               3.6.7                h6e2fe03_0    conda-forge
libnghttp2                1.47.0               he49606f_0    conda-forge
libnsl                    2.0.0                h7f98852_0    conda-forge
libntlm                   1.4               h7f98852_1002    conda-forge
libopenblas               0.3.20          pthreads_h78a6416_0    conda-forge
libssh2                   1.10.0               ha35d2d1_2    conda-forge
libstdcxx-ng              12.1.0              ha89aaad_16    conda-forge
libuuid                   2.32.1            h7f98852_1000    conda-forge
libzlib                   1.2.12               h166bdaf_1    conda-forge
llvm-openmp               14.0.4               he0ac6c6_0    conda-forge
lockfile                  0.12.2                     py_1    conda-forge
lz4-c                     1.9.3                h9c3ff4c_1    conda-forge
mctc-lib                  0.3.0                hc3ea6d6_0    conda-forge
mkl                       2022.1.0           h84fe81f_915    conda-forge
mongodb                   5.1.1                h0e13805_3    conda-forge
nauty                     2.7.2                h7f98852_0    conda-forge
ncurses                   6.3                  h27087fc_1    conda-forge
nlohmann_json             3.10.5               h27087fc_1    conda-forge
numpy                     1.23.0          py310h53a5b5f_0    conda-forge
openssl                   3.0.5                h166bdaf_0    conda-forge
pcre                      8.45                 h9c3ff4c_0    conda-forge
pip                       22.1.2             pyhd8ed1ab_0    conda-forge
psutil                    5.9.1           py310h5764c6d_0    conda-forge
pybind11                  2.9.2           py310hbf28c38_1    conda-forge
pybind11-global           2.9.2           py310hbf28c38_1    conda-forge
python                    3.10.5          ha86cf86_0_cpython    conda-forge
python-daemon             2.3.0              pyhd8ed1ab_1    conda-forge
python_abi                3.10                    2_cp310    conda-forge
pyyaml                    6.0             py310h5764c6d_4    conda-forge
readline                  8.1.2                h0f457ee_0    conda-forge
ringdecomposerlib         1.1.3                h166bdaf_1    conda-forge
scine-core                4.0.1                h6e2fe03_0    conda-forge
scine-database            1.0.0                    pypi_0    pypi
scine-puffin              1.0.0                    pypi_0    pypi
scine-readuct             4.0.0                he3004b7_0    conda-forge
scine-sparrow             3.0.1                he3004b7_1    conda-forge
scine-utilsos             5.0.0                h99171d1_0    conda-forge
scine-xtb                 1.0.1                h886c582_1    conda-forge
scipy                     1.8.1           py310h7612f91_0    conda-forge
setproctitle              1.2.3           py310h5764c6d_0    conda-forge
setuptools                63.1.0          py310hff52083_0    conda-forge
smmap                     3.0.5              pyh44b312d_0    conda-forge
snappy                    1.1.9                hbd366e4_1    conda-forge
sqlite                    3.39.0               h4ff8645_0    conda-forge
tbb                       2021.5.0             h924138e_1    conda-forge
tk                        8.6.12               h27826a3_0    conda-forge
typing_extensions         4.3.0              pyha770c72_0    conda-forge
tzdata                    2022a                h191b570_0    conda-forge
wheel                     0.37.1             pyhd8ed1ab_0    conda-forge
xtb                       6.5.0                h9d67668_0    conda-forge
xz                        5.2.5                h516909a_1    conda-forge
yaml                      0.2.5                h7f98852_2    conda-forge
yaml-cpp                  0.7.0                h27087fc_1    conda-forge
zlib                      1.2.12               h166bdaf_1    conda-forge
zstd                      1.5.2                h8a70e8d_2    conda-forge
@weymutht
Copy link
Member

weymutht commented Jul 7, 2022

Did this issue resolve now that you sorted out the problem with having multiple versions of nauty on your system?

If it persists, I recommend you use an older version of GCC. We tested Molassembler successfully up to GCC 10.

@awvwgk
Copy link
Author

awvwgk commented Jul 7, 2022

No the issue is unfortunately not due to multiple nauty versions but due to non-portable C++ usage which is flagged only in GCC 11 and above.

Edit: Also happens with GCC 10

@awvwgk
Copy link
Author

awvwgk commented Jul 7, 2022

This seems to be solvable by this somewhat hacky patch

diff --git a/src/Molassembler/Graph/Canonicalization.cpp b/src/Molassembler/Graph/Canonicalization.cpp
index dcf244bc..0ac57edf 100644
--- a/src/Molassembler/Graph/Canonicalization.cpp
+++ b/src/Molassembler/Graph/Canonicalization.cpp
@@ -21,6 +21,7 @@
 #include "Molassembler/Temple/Functional.h"
 
 extern "C" {
+#define _Thread_local thread_local
 #include "nauty/nausparse.h"
 
 /*!

@jan-grimo
Copy link
Member

I don't much want to include this patch in molassembler; this seems like an upstream issue, no? _Thread_local seems to have been substituted into your nauty/nausparse.h header file by nauty's configure script:

Line 5429: for ax_tls_keyword in _Thread_local __thread '__declspec(thread)' none; do

Fixing that by including a preprocessor redefinition in molassembler strikes me as the wrong way of fixing your issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants