Error: fenics-dolfinx requires GCC-9 or newer for improved C++17 support but gcc version 10.2.1 in my system

I am trying to install it on cluster by spack, but I met this error after spack install. This is the output of gcc -v:
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/opt/rh/devtoolset-10/root/usr/libexec/gcc/x86_64-redhat-linux/10/lto-wrapper
Target: x86_64-redhat-linux
Configured with: …/configure --enable-bootstrap --enable-languages=c,c++,fortran,lto --prefix=/opt/rh/devtoolset-10/root/usr --mandir=/opt/rh/devtoolset-10/root/usr/share/man --infodir=/opt/rh/devtoolset-10/root/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-gcc-major-version-only --with-linker-hash-style=gnu --with-default-libstdcxx-abi=gcc4-compatible --enable-plugin --enable-initfini-array --with-isl=/builddir/build/BUILD/gcc-10.2.1-20210130/obj-x86_64-redhat-linux/isl-install --disable-libmpx --enable-gnu-indirect-function --with-tune=generic --with-arch_32=x86-64 --build=x86_64-redhat-linux
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 10.2.1 20210130 (Red Hat 10.2.1-11) (GCC).

What should I do to install it.

Could you post the full error message/output from spack as well, using 3x` encapsulation

this is the full output

[root@localhost jzz]# spack install
==> Error: fenics-dolfinx requires GCC-9 or newer for improved C++17 support

Could you show all commands that you have executed (i.e. Spack install etc.)

Also, what is the output of spack concretize?

I follow the guide on github step by step,here are the commands:

git clone https://github.com/spack/spack.git
. ./spack/share/spack/setup-env.sh
spack env create fenicsx-env
spack env activate fenicsx-env
spack add py-fenics-dolfinx cflags="-O3" fflags="-O3"
spack install

And the output of spack concretize is the same error:

[root@localhost jzz]# spack concretize
==> Error: fenics-dolfinx requires GCC-9 or newer for improved C++17 support

Could you call spack compiler find
and then
spack add py-fenics-dolfinx%gcc cflags="-O3" fflags="-O3"

You could also check
spack compiler list

Additional to @dokken’s comment here, if your system does not have a sufficient C/C++ compiler you can request spack to install the latest. Something along the lines of

spack install gcc
spack compiler find

then you can specify the compiler you want to use.

1 Like

thank you for your help , but I meet another problem while installing:

[+] /home/jzz/spack/opt/spack/linux-centos7-skylake/gcc-10.2.1/py-petsc4py-3.18.2-mq3mkwgd2kl6u6nw32q7kyiqgmojekbj
==> Error: py-fenics-dolfinx-0.5.1-a3h3ikqpizu6fafkg7qaxhe4rxjckthe: Package was not installed
==> Error: py-fenics-dolfinx-0.5.1-a3h3ikqpizu6fafkg7qaxhe4rxjckthe: Package was not installed
==> Updating view at /home/jzz/spack/var/spack/environments/fenicsx-env/.spack-env/view
==> Error: Installation request failed.  Refer to reported errors for failing package(s).

what should I do

It is unclear what instructions you have followed(both me and nate gave some suggestions) and if you made a new spack environment before executing any of the commands above.

I use spack compiler find and spack add py-fenics-dolfinx%gcc cflags="-O3" fflags="-O3" in the previous spack environment.

Try making a new spack env, and add all the instructions + all of the output in a reply.

These are all the commands:

spack env create fenicsx
spack env activate fenicsx
spack add py-fenics-dolfinx cflags="-O3" fflags="-O3"
spack install

And these are the full error information:

==> Installing intel-tbb-2021.7.0-na7fhxqgmydjud6qn3uxpm2mzk6pp4kz
==> intel-tbb exists in binary cache but with different hash
==> No binary for intel-tbb-2021.7.0-na7fhxqgmydjud6qn3uxpm2mzk6pp4kz found: installing from source
==> Using cached archive: /home/jzz/spack/var/spack/cache/_source-cache/archive/2c/2cae2a80cda7d45dc7c072e4295c675fff5ad8316691f26f40539f7e7e54c0cc.tar.gz
==> No patches needed for intel-tbb
==> intel-tbb: Executing phase: 'cmake'
==> intel-tbb: Executing phase: 'build'
==> Error: ProcessError: Command exited with status 2:
    'make' '-j1'

4 errors found in build log:
     257                     from /tmp/root/spack-stage/jzz/spack-stage-i
            ntel-tbb-2021.7.0-na7fhxqgmydjud6qn3uxpm2mzk6pp4kz/spack-src/
            src/tbb/../../include/tbb/../oneapi/tbb/concurrent_unordered_
            map.h:21,
     258                     from /tmp/root/spack-stage/jzz/spack-stage-i
            ntel-tbb-2021.7.0-na7fhxqgmydjud6qn3uxpm2mzk6pp4kz/spack-src/
            src/tbb/../../include/tbb/concurrent_unordered_map.h:17,
     259                     from /tmp/root/spack-stage/jzz/spack-stage-i
            ntel-tbb-2021.7.0-na7fhxqgmydjud6qn3uxpm2mzk6pp4kz/spack-src/
            test/tbb/test_concurrent_unordered_map.cpp:22:
     260    /opt/rh/devtoolset-10/root/usr/include/c++/10/bits/basic_stri
            ng.h: In instantiation of 'class std::basic_string<char, std:
            :char_traits<char>, tbb::detail::d1::tbb_allocator<char> >':
     261    /tmp/root/spack-stage/jzz/spack-stage-intel-tbb-2021.7.0-na7f
            hxqgmydjud6qn3uxpm2mzk6pp4kz/spack-src/test/common/concurrent
            _associative_common.h:964:29:   required from 'void test_map_
            specific_types() [with Checker = UnorderedMapTypesTester]'
     262    /tmp/root/spack-stage/jzz/spack-stage-intel-tbb-2021.7.0-na7f
            hxqgmydjud6qn3uxpm2mzk6pp4kz/spack-src/test/tbb/test_concurre
            nt_unordered_map.cpp:97:54:   required from here
  >> 263    /opt/rh/devtoolset-10/root/usr/include/c++/10/bits/basic_stri
            ng.h:3150:57: error: no type named 'size_type' in 'std::basic
            _string<char, std::char_traits<char>, tbb::detail::d1::tbb_al
            locator<char> >::_CharT_alloc_type' {aka 'std::allocator_trai
            ts<tbb::detail::d1::tbb_allocator<char> >::rebind_alloc<char>
            '}
     264     3150 |       typedef typename _CharT_alloc_type::size_type  
               size_type;
     265          |                                                      
               ^~~~~~~~~
     266    compilation terminated due to -Wfatal-errors.
  >> 267    make[2]: *** [test/CMakeFiles/test_concurrent_unordered_map.d
            ir/build.make:79: test/CMakeFiles/test_concurrent_unordered_m
            ap.dir/tbb/test_concurrent_unordered_map.cpp.o] Error 1
     268    make[2]: Leaving directory '/tmp/root/spack-stage/jzz/spack-s
            tage-intel-tbb-2021.7.0-na7fhxqgmydjud6qn3uxpm2mzk6pp4kz/spac
            k-build-na7fhxq'
  >> 269    make[1]: *** [CMakeFiles/Makefile2:761: test/CMakeFiles/test_
            concurrent_unordered_map.dir/all] Error 2
     270    make[1]: Leaving directory '/tmp/root/spack-stage/jzz/spack-s
            tage-intel-tbb-2021.7.0-na7fhxqgmydjud6qn3uxpm2mzk6pp4kz/spac
            k-build-na7fhxq'
  >> 271    make: *** [Makefile:169: all] Error 2

See build log for details:
  /tmp/root/spack-stage/jzz/spack-stage-intel-tbb-2021.7.0-na7fhxqgmydjud6qn3uxpm2mzk6pp4kz/spack-build-out.txt

==> Warning: Skipping build of xtensor-0.24.1-4kyqnb5psxilxmgxaxch3sbbte2x2dqw since intel-tbb-2021.7.0-na7fhxqgmydjud6qn3uxpm2mzk6pp4kz failed
==> Warning: Skipping build of py-fenics-dolfinx-0.5.1-a3h3ikqpizu6fafkg7qaxhe4rxjckthe since xtensor-0.24.1-4kyqnb5psxilxmgxaxch3sbbte2x2dqw failed
==> Warning: Skipping build of fenics-dolfinx-0.5.1-mcvoeggdrotril2r5xierzh2324gy6hu since xtensor-0.24.1-4kyqnb5psxilxmgxaxch3sbbte2x2dqw failed
[+] /home/jzz/spack/opt/spack/linux-centos7-skylake/gcc-10.2.1/fenics-basix-0.5.1-wewd5p55fmtcrry3onj7soqrvvb55ezp
[+] /home/jzz/spack/opt/spack/linux-centos7-skylake/gcc-10.2.1/pmix-4.1.2-7evfnj7bupkwpv2n5nwqe4jpqvqfdakg
[+] /home/jzz/spack/opt/spack/linux-centos7-skylake/gcc-10.2.1/ninja-1.11.1-bd62itogvfhpduvrw6wx5zb4uj77odbi
[+] /home/jzz/spack/opt/spack/linux-centos7-skylake/gcc-10.2.1/py-pip-22.2.2-wlmej2nlc6thdrpnkeo33hkum4ma526b
[+] /home/jzz/spack/opt/spack/linux-centos7-skylake/gcc-10.2.1/openssh-9.1p1-et7vcymi45czd5vyizlul6h6ajnip6c3
[+] /home/jzz/spack/opt/spack/linux-centos7-skylake/gcc-10.2.1/py-wheel-0.37.1-2rzwy7vmhvk3urokvqqzw3gdkrh4hpg4
[+] /home/jzz/spack/opt/spack/linux-centos7-skylake/gcc-10.2.1/py-setuptools-63.0.0-ngyw2yvvp42kp5aasu5niqxjmbj3y4pb
[+] /home/jzz/spack/opt/spack/linux-centos7-skylake/gcc-10.2.1/openmpi-4.1.4-beeap2njsxu4ljokqauismz3jtnj2lkg
[+] /home/jzz/spack/opt/spack/linux-centos7-skylake/gcc-10.2.1/py-cython-0.29.32-yl76rjizk23wh6wt4ntj4q42raeus4an
[+] /home/jzz/spack/opt/spack/linux-centos7-skylake/gcc-10.2.1/py-pycparser-2.21-xj5d6jgkxtzi2npn55k5gzhelpstyrdw
[+] /home/jzz/spack/opt/spack/linux-centos7-skylake/gcc-10.2.1/py-pybind11-2.10.1-b7ovu6n25bfq7qivoaj4ho3fife3gxe6
[+] /home/jzz/spack/opt/spack/linux-centos7-skylake/gcc-10.2.1/parmetis-4.0.3-7jkb3njroebv37lcig7x74zuc6ovtjxz
[+] /home/jzz/spack/opt/spack/linux-centos7-skylake/gcc-10.2.1/py-mpi4py-3.1.4-wp4jupxzqlao7ihifecrtgqgwp4xiqbe
[+] /home/jzz/spack/opt/spack/linux-centos7-skylake/gcc-10.2.1/hypre-2.27.0-xe2si7ljbny5mynk6cnn4vodko3h46en
[+] /home/jzz/spack/opt/spack/linux-centos7-skylake/gcc-10.2.1/hdf5-1.12.2-pvegraf7za7v5eim2ojtzy66a34vzo5s
[+] /home/jzz/spack/opt/spack/linux-centos7-skylake/gcc-10.2.1/py-numpy-1.24.0-upor5yuoif63lm3xqqevwcsotqjx5rny
[+] /home/jzz/spack/opt/spack/linux-centos7-skylake/gcc-10.2.1/py-cffi-1.15.1-h7nim5nyzfdknggbcd46vvp6hffkaf2h
[+] /home/jzz/spack/opt/spack/linux-centos7-skylake/gcc-10.2.1/superlu-dist-8.1.2-32xbqn2qdwdg47lwy5qrnvnnjiu54rch
[+] /home/jzz/spack/opt/spack/linux-centos7-skylake/gcc-10.2.1/py-fenics-ufl-2022.2.0-t6hvihpmxrhv73cmdkjqwumpnpprfw76
[+] /home/jzz/spack/opt/spack/linux-centos7-skylake/gcc-10.2.1/py-fenics-basix-0.5.1-77ii2xpm7u66lpzfrm4xqwkxytrwouz4
[+] /home/jzz/spack/opt/spack/linux-centos7-skylake/gcc-10.2.1/petsc-3.18.2-3q62uhdszxk5nmbukxndktgbusgctvn7
==> Waiting for py-fenics-ffcx-0.5.0.post0-k2ei5erjkpb5wr3hbkkl2hhuc3uqaz6[+] /home/jzz/spack/opt/spack/linux-centos7-skylake/gcc-10.2.1/py-fenics-ffcx-0.5.0.post0-k2ei5erjkpb5wr3hbkkl2hhuc3uqaz6e
[+] /home/jzz/spack/opt/spack/linux-centos7-skylake/gcc-10.2.1/py-petsc4py-3.18.2-mq3mkwgd2kl6u6nw32q7kyiqgmojekbj
==> Error: py-fenics-dolfinx-0.5.1-a3h3ikqpizu6fafkg7qaxhe4rxjckthe: Package was not installed
==> Error: py-fenics-dolfinx-0.5.1-a3h3ikqpizu6fafkg7qaxhe4rxjckthe: Package was not installed
==> Error: Installation request failed.  Refer to reported errors for failing package(s).