FEniCS/basix

C++17 standard required in CMakeLists while <version> header included in "cpp/basix/mdspan.hpp"

Closed this issue · 5 comments

Hi,
I'm trying to build dolfinX from sources and attempted to build basix v0.4.3. On our cluster we have gnu 8.3 available, which seems to not expose the header. And since it is included in "cpp/basix/mdspan.hpp", I can not build basix.
Do you have in mind any workaround?
Below is the Cmake build log:


(dolfinx) 15:19:10 [afalaize@noether cpp]# cmake -DCMAKE_INSTALL_PREFIX=/opt/lasie/pub/libs/gnu8/basix-0.4.3  -DCMAKE_C_COMPILER=/opt/ohpc/pub/compiler/gcc/8.3.0/bin/gcc -DCMAKE_CXX_COMPILER=/opt/ohpc/pub/compiler/gcc/8.3.0/bin/g++  -DCMAKE_BUILD_TYPE=Release -B build-dir -S .
-- The CXX compiler identification is GNU 8.3.0
-- Check for working CXX compiler: /opt/ohpc/pub/compiler/gcc/8.3.0/bin/g++
-- Check for working CXX compiler: /opt/ohpc/pub/compiler/gcc/8.3.0/bin/g++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Performing Test arch_native_supported
-- Performing Test arch_native_supported - Success
-- Looking for sgemm_
-- Looking for sgemm_ - not found
-- Looking for C++ include pthread.h
-- Looking for C++ include 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  
-- Looking for sgemm_
-- Looking for sgemm_ - found
-- Found BLAS: /opt/ohpc/pub/libs/gnu8/openblas/0.3.7/lib/libopenblas.so  
-- Looking for cheev_
-- Looking for cheev_ - found
-- A library with LAPACK API found.
-- The following features have been enabled:

 * BUILD_SHARED_LIBS, Build Basix with shared libraries.

-- The following REQUIRED packages have been found:

 * xtl (required version >= 0.7.0)
 * xtensor (required version >= 0.23.10)
 * BLAS
 * Threads
 * LAPACK

-- The following features have been disabled:

 * DOWNLOAD_XTENSOR_LIBS, Download xtl and xtensor. Requires git.
 * XTENSOR_OPTIMIZE, Enable architecture-specific optimizations as defined by xtensor.

-- Found Python3: /opt/lasie/pub/libs/gnu8/python-3.8.10/venvs/dolfinx/bin/python3 (found version "3.8.10") found components:  Interpreter 
-- Configuring done
-- Generating done
CMake Warning:
  Manually-specified variables were not used by the project:

    CMAKE_C_COMPILER


-- Build files have been written to: /opt/lasie/srcs/basix-0.4.3/cpp/build-dir
(dolfinx) 15:19:16 [afalaize@noether cpp]# cmake --build build-dir/
Scanning dependencies of target basix
[  4%] Building CXX object CMakeFiles/basix.dir/basix/cell.cpp.o
In file included from /opt/lasie/srcs/basix-0.4.3/cpp/basix/math.h:9,
                 from /opt/lasie/srcs/basix-0.4.3/cpp/basix/cell.cpp:6:
/opt/lasie/srcs/basix-0.4.3/cpp/basix/mdspan.hpp:3:12: erreur fatale: version : Aucun fichier ou dossier de ce type
 #  include <version>
            ^~~~~~~~~
compilation terminée.
gmake[2]: *** [CMakeFiles/basix.dir/basix/cell.cpp.o] Erreur 1
gmake[1]: *** [CMakeFiles/basix.dir/all] Erreur 2
gmake: *** [all] Erreur 2

Best regards,

Antoine Falaize

We updated themdspan.hpp single header implementation, but the new implementation isn't handling different C++ versions properly. It only seems to work properly for C++20, whereas Basix requires C++17.

@chrisrichardson: could you take a look?

@afalaize could you try now using the main branch?

Hi
Thank you for replying. Got latest commit on main (#564) and still have dependencies on C++20 standard:

(dolfinx) 15:49:50 [afalaize@noether cpp]# git show
commit 3844e0f52e34106a9f23a2298a00224d816466e5
Author: Garth N. Wells <gnw20@cam.ac.uk>
Date:   Thu Jul 14 17:17:02 2022 +0100

    Revert DOLFINx CI branch back to main (#564)

diff --git a/.github/workflows/dolfin-tests.yml b/.github/workflows/dolfin-tests.yml
index 8145e72..068653c 100644
--- a/.github/workflows/dolfin-tests.yml
+++ b/.github/workflows/dolfin-tests.yml
@@ -67,7 +67,6 @@ jobs:
         with:
           path: ./dolfinx
           repository: FEniCS/dolfinx
-          ref: garth/cpp-20
       - name: Get DOLFINx
         if: github.event_name == 'workflow_dispatch'
         uses: actions/checkout@v3
(dolfinx) 15:49:52 [afalaize@noether cpp]# cmake -DCMAKE_INSTALL_PREFIX=/opt/lasie/pub/libs/gnu8/basix-0.4.3  -DCMAKE_C_COMPILER=/opt/ohpc/pub/compiler/gcc/8.3.0/bin/gcc -DCMAKE_CXX_COMPILER=/opt/ohpc/pub/compiler/gcc/8.3.0/bin/g++  -DCMAKE_BUILD_TYPE=Release -B build-dir -S .
-- The CXX compiler identification is GNU 8.3.0
-- Check for working CXX compiler: /opt/ohpc/pub/compiler/gcc/8.3.0/bin/g++
-- Check for working CXX compiler: /opt/ohpc/pub/compiler/gcc/8.3.0/bin/g++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for sgemm_
-- Looking for sgemm_ - not found
-- Looking for C++ include pthread.h
-- Looking for C++ include 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  
-- Looking for sgemm_
-- Looking for sgemm_ - found
-- Found BLAS: /opt/ohpc/pub/libs/gnu8/openblas/0.3.7/lib/libopenblas.so  
-- Looking for cheev_
-- Looking for cheev_ - found
-- A library with LAPACK API found.
-- The following features have been enabled:

 * BUILD_SHARED_LIBS, Build Basix with shared libraries.

-- The following REQUIRED packages have been found:

 * BLAS
 * Threads
 * LAPACK

-- Found Python3: /opt/lasie/pub/libs/gnu8/python-3.8.10/venvs/dolfinx/bin/python3 (found version "3.8.10") found components:  Interpreter 
-- Configuring done
-- Generating done
CMake Warning:
  Manually-specified variables were not used by the project:

    CMAKE_C_COMPILER


-- Build files have been written to: /opt/lasie/srcs/basix-0.4.3/cpp/build-dir
(dolfinx) 15:49:58 [afalaize@noether cpp]# cmake --build build-dir/
Scanning dependencies of target basix
[  4%] Building CXX object CMakeFiles/basix.dir/basix/cell.cpp.o
In file included from /opt/lasie/srcs/basix-0.4.3/cpp/basix/math.h:9,
                 from /opt/lasie/srcs/basix-0.4.3/cpp/basix/cell.cpp:6:
/opt/lasie/srcs/basix-0.4.3/cpp/basix/mdspan.hpp:3:12: erreur fatale: version : Aucun fichier ou dossier de ce type
 #  include <version>
            ^~~~~~~~~
compilation terminée.
gmake[2]: *** [CMakeFiles/basix.dir/basix/cell.cpp.o] Erreur 1
gmake[1]: *** [CMakeFiles/basix.dir/all] Erreur 2
gmake: *** [all] Erreur 2
(dolfinx) 15:50:04 [afalaize@noether cpp]# 

In the meantime with have moved to C++20, so you need gcc 10.

Development version has moved to C++20. New release (v0.5) will come soon.