FEniCS/basix

Segmentation Fault Error while building Basix from source

Closed this issue · 3 comments

Hello,

I'm trying to install Basix from source to install Dolfinx and I'm running into a segmentation fault error during the first build steps. I saw someone with the same error a few years back (here) that seemed to go unresolved and while I'm not certain that this is a Basix bug, I figured that it would be best to post this here.

The previous post on the FEniCS forum regarding this mentioned that there could be mismatch in the required xtensor version, and I'm not entirely sure how to use this info to solve this. Here's the output of my attempted build:

$ sudo cmake -DCMAKE_BUILD_TYPE=Release -B build-dir -S . -DCMAKE_INSTALL_PREFIX=/usr/local

-- 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...<0.25)
 * 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.

-- Configuring done
-- Generating done
$ sudo cmake --build build-dir
[  4%] Building CXX object CMakeFiles/basix.dir/basix/cell.cpp.o
In file included from /usr/local/include/xtensor/xaccumulator.hpp:18:0,
                 from /usr/local/include/xtensor/xmath.hpp:26,
                 from /usr/local/include/xtensor/xcontainer.hpp:25,
                 from /usr/local/include/xtensor/xtensor.hpp:20,
                 from /home/kenneth/test_software/basix/basix-0.4.1/cpp/basix/cell.h:8,
                 from /home/kenneth/test_software/basix/basix-0.4.1/cpp/basix/cell.cpp:5:
/usr/local/include/xtensor/xexpression.hpp: In instantiation of ‘struct xt::detail::is_crtp_base_of_impl<xt::xexpression, xt::has_simd_interface<xt::xview<xt::xtensor_container<xt::uvector<double, std::allocator<double> >, 2, (xt::layout_type)1, xt::xtensor_expression_tag>&, const long int, xt::xall<long unsigned int> >, double> >’:
/usr/local/include/xtl/xtype_traits.hpp:323:12:   required from ‘struct xtl::disjunction<xt::detail::is_crtp_base_of_impl<xt::xexpression, xt::has_simd_interface<xt::xview<xt::xtensor_container<xt::uvector<double, std::allocator<double> >, 2, (xt::layout_type)1, xt::xtensor_expression_tag>&, const long int, xt::xall<long unsigned int> >, double> >, xt::detail::is_crtp_base_of_impl<xt::xexpression, xt::has_simd_interface<xt::xtensor_container<xt::uvector<double, std::allocator<double> >, 1, (xt::layout_type)1, xt::xtensor_expression_tag>, double> > >/usr/local/include/xtensor/xoperation.hpp:212:90:   required by substitution of ‘template<class F, class ... E> using xfunction_type_t = typename std::enable_if<xtl::disjunction<xt::is_xexpression<typename std::decay<CT>::type>...>::value, xt::detail::xfunction_type<F, E ...> >::type::type [with F = xt::detail::logical_and; E = {xt::has_simd_interface<xt::xview<xt::xtensor_container<xt::uvector<double, std::allocator<double> >, 2, (xt::layout_type)1, xt::xtensor_expression_tag>&, const long int, xt::xall<long unsigned int> >, double>, xt::has_simd_interface<xt::xtensor_container<xt::uvector<double, std::allocator<double> >, 1, (xt::layout_type)1, xt::xtensor_expression_tag>, double>}]/usr/local/include/xtensor/xoperation.hpp:375:17:   required by substitution of ‘template<class E1, class E2> xt::detail::xfunction_type_t<xt::detail::logical_and, E1, E2> xt::operator&&(E1&&, E2&&) [with E1 = xt::has_simd_interface<xt::xview<xt::xtensor_container<xt::uvector<double, std::allocator<double> >, 2, (xt::layout_type)1, xt::xtensor_expression_tag>&, const long int, xt::xall<long unsigned int> >, double>; E2 = xt::has_simd_interface<xt::xtensor_container<xt::uvector<double, std::allocator<double> >, 1, (xt::layout_type)1, xt::xtensor_expression_tag>, double>]/usr/local/include/xtensor/xassign.hpp:346:104:   required from ‘static constexpr bool xt::xassign_traits<E1, E2>::simd_interface() [with E1 = xt::xview<xt::xtensor_container<xt::uvector<double, std::allocator<double> >, 2, (xt::layout_type)1, xt::xtensor_expression_tag>&, const long int, xt::xall<long unsigned int> >; E2 = xt::xtensor_container<xt::uvector<double, std::allocator<double> >, 1, (xt::layout_type)1, xt::xtensor_expression_tag>]/usr/local/include/xtensor/xassign.hpp:354:106:   [ skipping 2 instantiation contexts, use -ftemplate-backtrace-limit=0 to disable ]
/usr/local/include/xtensor/xview.hpp:1741:106:   required from ‘void xt::xview<CT, S>::assign_temporary_impl(xt::xview<CT, S>::temporary_type&&) [with CT = xt::xtensor_container<xt::uvector<double, std::allocator<double> >, 2, (xt::layout_type)1, xt::xtensor_expression_tag>&; S = {const long int, xt::xall<long unsigned int>}; xt::xview<CT, S>::temporary_type = xt::xtensor_container<xt::uvector<double, std::allocator<double> >, 1, (xt::layout_type)1, xt::xtensor_expression_tag>]/usr/local/include/xtensor/xsemantic.hpp:662:9:   required from ‘xt::xview_semantic<D>::derived_type& xt::xview_semantic<D>::assign_temporary(xt::xview_semantic<D>::temporary_type&&) [with D = xt::xview<xt::xtensor_container<xt::uvector<double, std::allocator<double> >, 2, (xt::layout_type)1, xt::xtensor_expression_tag>&, const long int, xt::xall<long unsigned int> >; xt::xview_semantic<D>::derived_type = xt::xview<xt::xtensor_container<xt::uvector<double, std::allocator<double> >, 2, (xt::layout_type)1, xt::xtensor_expression_tag>&, const long int, xt::xall<long unsigned int> >; xt::xview_semantic<D>::temporary_type = xt::xtensor_container<xt::uvector<double, std::allocator<double> >, 1, (xt::layout_type)1, xt::xtensor_expression_tag>]/usr/local/include/xtensor/xsemantic.hpp:601:68:   required from ‘xt::xsemantic_base<D>::derived_type& xt::xsemantic_base<D>::operator=(const xt::xexpression<E>&) [with E = xt::xbroadcast<const xt::xview<const xt::xtensor_container<xt::uvector<double, std::allocator<double> >, 2, (xt::layout_type)1, xt::xtensor_expression_tag>&, const long int, xt::xall<long unsigned int> >&, xt::sequence_view<std::array<long unsigned int, 2>, 1, 2> >; D = xt::xview<xt::xtensor_container<xt::uvector<double, std::allocator<double> >, 2, (xt::layout_type)1, xt::xtensor_expression_tag>&, const long int, xt::xall<long unsigned int> >; xt::xsemantic_base<D>::derived_type = xt::xview<xt::xtensor_container<xt::uvector<double, std::allocator<double> >, 2, (xt::layout_type)1, xt::xtensor_expression_tag>&, const long int, xt::xall<long unsigned int> >]/usr/local/include/xtensor/xsemantic.hpp:746:33:   required from ‘xt::xview_semantic<D>::derived_type& xt::xview_semantic<D>::operator=(const xt::xexpression<E>&) [with E = xt::xview<const xt::xtensor_container<xt::uvector<double, std::allocator<double> >, 2, (xt::layout_type)1, xt::xtensor_expression_tag>&, const long int, xt::xall<long unsigned int> >; D = xt::xview<xt::xtensor_container<xt::uvector<double, std::allocator<double> >, 2, (xt::layout_type)1, xt::xtensor_expression_tag>&, const long int, xt::xall<long unsigned int> >; xt::xview_semantic<D>::derived_type = xt::xview<xt::xtensor_container<xt::uvector<double, std::allocator<double> >, 2, (xt::layout_type)1, xt::xtensor_expression_tag>&, const long int, xt::xall<long unsigned int> >]/usr/local/include/xtensor/xview.hpp:931:40:   required from ‘xt::xview<CT, S>::self_type& xt::xview<CT, S>::operator=(const xt::xexpression<E>&) [with E = xt::xview<const xt::xtensor_container<xt::uvector<double, std::allocator<double> >, 2, (xt::layout_type)1, xt::xtensor_expression_tag>&, const long int, xt::xall<long unsigned int> >; CT = xt::xtensor_container<xt::uvector<double, std::allocator<double> >, 2, (xt::layout_type)1, xt::xtensor_expression_tag>&; S = {const long int, xt::xall<long unsigned int>}; xt::xview<CT, S>::self_type = xt::xview<xt::xtensor_container<xt::uvector<double, std::allocator<double> >, 2, (xt::layout_type)1, xt::xtensor_expression_tag>&, const long int, xt::xall<long unsigned int> >]/home/kenneth/test_software/basix/basix-0.4.1/cpp/basix/cell.cpp:337:64:   required from here
/usr/local/include/xtensor/xexpression.hpp:168:88: internal compiler error: Segmentation fault
         xtl::disjunction< std::is_base_of<B<E>, F<E>>, std::is_base_of<B<F<E>>, F<E>>> {};
                                                                                        ^
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-7/README.Bugs> for instructions.
CMakeFiles/basix.dir/build.make:75: recipe for target 'CMakeFiles/basix.dir/basix/cell.cpp.o' failed
make[2]: *** [CMakeFiles/basix.dir/basix/cell.cpp.o] Error 1
CMakeFiles/Makefile2:82: recipe for target 'CMakeFiles/basix.dir/all' failed
make[1]: *** [CMakeFiles/basix.dir/all] Error 2
Makefile:135: recipe for target 'all' failed
make: *** [all] Error 2

I tried this for Basix 0.4.0 and 0.3.0, and I also tried using various versions of xtensor, and I couldn't avoid running into this error. For reference, the build attempt that produced the error shown above uses the following:

  • Basix 0.4.1
  • xtensor 0.24.1
  • xtl 0.7.4
  • gcc 7.5.0
  • Ubuntu 18.04

Any with this is greatly appreciated, and apologies if this is not the best place to raise this issue - I don't know if this a Basix bug, a gcc bug, or if I'm installing Basix incorrectly.

Thanks,
Kenneth

Hi @kenneth-meyer,
gcc 7.5.0 is not fully compliant with C++ 17.
Even if it passes that point (which seems to be an issue with xtensor), it won't be able to compile basix.
Could you try gcc 9 or a newer version?

Closing because compiler version is too old for full C++17 support. (Basix requires C++17).

As a footnotes, xtensor is not longer used in the main branch.

jhale commented