Docker build issue 0.9.0< version <0.10.0

Hello everyone,

I’m building my docker image from scratch because I need to enable the Fortran bindings for ADIOS2. I’m try to build latest commit in the main branch (797e47c7e8034). After building locally the dockerfile.test-env, I’ve used to build dockerfile.end-user. However, this last step fails due to an error compiling the python wrapper:

156.6   [17/25] Building CXX object CMakeFiles/cpp.dir/dolfinx/wrappers/geometry.cpp.o
156.6   FAILED: CMakeFiles/cpp.dir/dolfinx/wrappers/geometry.cpp.o
156.6   /usr/bin/x86_64-linux-gnu-g++ -DADIOS2_USE_MPI -DDOLFINX_VERSION=\"0.10.0.0\" -DFMT_SHARED -DHAS_ADIOS2 -DHAS_KAHIP -DHAS_PETSC -DHAS_PETSC4PY -DHAS_PTSCOTCH -DHAS_SLEPC -DSPDLOG_COMPILED_LIB -DSPDLOG_FMT_EXTERNAL -DSPDLOG_SHARED_LIB -Dcpp_EXPORTS -Dcxx_std_20 -I/dolfinx-env/lib/python3.12/site-packages/petsc4py/include -I/dolfinx-env/lib/python3.12/site-packages/mpi4py/include -isystem /usr/include/python3.12 -isystem /dolfinx-env/lib/python3.12/site-packages/nanobind/include -isystem /usr/local/dolfinx-real/include -isystem /dolfinx-env/lib/python3.12/site-packages/ffcx/codegeneration -isystem /usr/local/petsc/linux-gnu-real64-32/include -isystem /usr/local/petsc/include -isystem /usr/local/slepc/linux-gnu-real64-32/include -isystem /usr/local/slepc/include -O3 -DNDEBUG -std=gnu++20 -fPIC -fvisibility=hidden -fno-stack-protector -Wall -Werror -Wextra -pedantic -ffunction-sections -fdata-sections -MD -MT CMakeFiles/cpp.dir/dolfinx/wrappers/geometry.cpp.o -MF CMakeFiles/cpp.dir/dolfinx/wrappers/geometry.cpp.o.d -o CMakeFiles/cpp.dir/dolfinx/wrappers/geometry.cpp.o -c /src/dolfinx/python/dolfinx/wrappers/geometry.cpp
156.6   In file included from /usr/include/c++/13/string:51,
156.6                    from /usr/include/c++/13/stdexcept:39,
156.6                    from /dolfinx-env/lib/python3.12/site-packages/nanobind/include/nanobind/nanobind.h:33,
156.6                    from /src/dolfinx/python/dolfinx/wrappers/array.h:11,
156.6                    from /src/dolfinx/python/dolfinx/wrappers/geometry.cpp:7:
156.7   In static member function ‘static constexpr _Up* std::__copy_move<_IsMove, true, std::random_access_iterator_tag>::__copy_m(_Tp*, _Tp*, _Up*) [with _Tp = unsigned int; _Up = unsigned int; bool _IsMove = false]’,
156.7       inlined from ‘constexpr _OI std::__copy_move_a2(_II, _II, _OI) [with bool _IsMove = false; _II = unsigned int*; _OI = unsigned int*]’ at /usr/include/c++/13/bits/stl_algobase.h:506:30,
156.7       inlined from ‘constexpr _OI std::__copy_move_a1(_II, _II, _OI) [with bool _IsMove = false; _II = unsigned int*; _OI = unsigned int*]’ at /usr/include/c++/13/bits/stl_algobase.h:533:42,
156.7       inlined from ‘constexpr _OI std::__copy_move_a(_II, _II, _OI) [with bool _IsMove = false; _II = unsigned int*; _OI = unsigned int*]’ at /usr/include/c++/13/bits/stl_algobase.h:540:31,
156.7       inlined from ‘constexpr _OI std::copy(_II, _II, _OI) [with _II = unsigned int*; _OI = unsigned int*]’ at /usr/include/c++/13/bits/stl_algobase.h:633:7,
156.7       inlined from ‘static _ForwardIterator std::__uninitialized_copy<true>::__uninit_copy(_InputIterator, _InputIterator, _ForwardIterator) [with _InputIterator = unsigned int*; _ForwardIterator = unsigned int*]’ at /usr/include/c++/13/bits/stl_uninitialized.h:147:27,
156.7       inlined from ‘_ForwardIterator std::uninitialized_copy(_InputIterator, _InputIterator, _ForwardIterator) [with _InputIterator = unsigned int*; _ForwardIterator = unsigned int*]’ at /usr/include/c++/13/bits/stl_uninitialized.h:185:15,
156.7       inlined from ‘constexpr void fmt::v9::basic_memory_buffer<T, SIZE, Allocator>::grow(size_t) [with T = unsigned int; long unsigned int SIZE = 32; Allocator = std::allocator<unsigned int>]’ at /usr/include/fmt/format.h:925:26,
156.7       inlined from ‘constexpr void fmt::v9::detail::buffer<T>::try_reserve(size_t) [with T = unsigned int]’ at /usr/include/fmt/core.h:928:39,
156.7       inlined from ‘constexpr void fmt::v9::detail::buffer<T>::try_resize(size_t) [with T = unsigned int]’ at /usr/include/fmt/core.h:919:16,
156.7       inlined from ‘constexpr void fmt::v9::basic_memory_buffer<T, SIZE, Allocator>::resize(size_t) [with T = unsigned int; long unsigned int SIZE = 32; Allocator = std::allocator<unsigned int>]’ at /usr/include/fmt/format.h:897:63,
156.7       inlined from ‘constexpr void fmt::v9::detail::bigint::assign(UInt) [with UInt = long unsigned int; typename std::enable_if<(std::is_same<UInt, long unsigned int>::value || std::is_same<UInt, __int128 unsigned>::value), int>::type <anonymous> = 0]’ at /usr/include/fmt/format.h:2792:19,
156.7       inlined from ‘constexpr void fmt::v9::detail::bigint::operator=(Int) [with Int = int]’ at /usr/include/fmt/format.h:2813:11,
156.7       inlined from ‘constexpr void fmt::v9::detail::format_dragon(basic_fp<__int128 unsigned>, unsigned int, int, buffer<char>&, int&)’ at /usr/include/fmt/format.h:3006:17:
156.7   /usr/include/c++/13/bits/stl_algobase.h:437:30: error: ‘void* __builtin_memmove(void*, const void*, long unsigned int)’ forming offset 4 is out of the bounds [0, 4] [-Werror=array-bounds=]
156.7     437 |             __builtin_memmove(__result, __first, sizeof(_Tp) * _Num);
156.7         |             ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
156.7   In static member function ‘static constexpr _Up* std::__copy_move<_IsMove, true, std::random_access_iterator_tag>::__copy_m(_Tp*, _Tp*, _Up*) [with _Tp = unsigned int; _Up = unsigned int; bool _IsMove = false]’,
156.7       inlined from ‘constexpr _OI std::__copy_move_a2(_II, _II, _OI) [with bool _IsMove = false; _II = unsigned int*; _OI = unsigned int*]’ at /usr/include/c++/13/bits/stl_algobase.h:506:30,
156.7       inlined from ‘constexpr _OI std::__copy_move_a1(_II, _II, _OI) [with bool _IsMove = false; _II = unsigned int*; _OI = unsigned int*]’ at /usr/include/c++/13/bits/stl_algobase.h:533:42,
156.7       inlined from ‘constexpr _OI std::__copy_move_a(_II, _II, _OI) [with bool _IsMove = false; _II = unsigned int*; _OI = unsigned int*]’ at /usr/include/c++/13/bits/stl_algobase.h:540:31,
156.7       inlined from ‘constexpr _OI std::copy(_II, _II, _OI) [with _II = unsigned int*; _OI = unsigned int*]’ at /usr/include/c++/13/bits/stl_algobase.h:633:7,
156.7       inlined from ‘static _ForwardIterator std::__uninitialized_copy<true>::__uninit_copy(_InputIterator, _InputIterator, _ForwardIterator) [with _InputIterator = unsigned int*; _ForwardIterator = unsigned int*]’ at /usr/include/c++/13/bits/stl_uninitialized.h:147:27,
156.7       inlined from ‘_ForwardIterator std::uninitialized_copy(_InputIterator, _InputIterator, _ForwardIterator) [with _InputIterator = unsigned int*; _ForwardIterator = unsigned int*]’ at /usr/include/c++/13/bits/stl_uninitialized.h:185:15,
156.7       inlined from ‘constexpr void fmt::v9::basic_memory_buffer<T, SIZE, Allocator>::grow(size_t) [with T = unsigned int; long unsigned int SIZE = 32; Allocator = std::allocator<unsigned int>]’ at /usr/include/fmt/format.h:925:26,
156.7       inlined from ‘constexpr void fmt::v9::detail::buffer<T>::try_reserve(size_t) [with T = unsigned int]’ at /usr/include/fmt/core.h:928:39,
156.7       inlined from ‘constexpr void fmt::v9::detail::buffer<T>::try_resize(size_t) [with T = unsigned int]’ at /usr/include/fmt/core.h:919:16,
156.7       inlined from ‘constexpr void fmt::v9::basic_memory_buffer<T, SIZE, Allocator>::resize(size_t) [with T = unsigned int; long unsigned int SIZE = 32; Allocator = std::allocator<unsigned int>]’ at /usr/include/fmt/format.h:897:63,
156.7       inlined from ‘constexpr void fmt::v9::detail::bigint::assign(UInt) [with UInt = long unsigned int; typename std::enable_if<(std::is_same<UInt, long unsigned int>::value || std::is_same<UInt, __int128 unsigned>::value), int>::type <anonymous> = 0]’ at /usr/include/fmt/format.h:2792:19,
156.7       inlined from ‘constexpr void fmt::v9::detail::bigint::operator=(Int) [with Int = int]’ at /usr/include/fmt/format.h:2813:11,
156.7       inlined from ‘constexpr void fmt::v9::detail::bigint::assign_pow10(int)’ at /usr/include/fmt/format.h:2893:11,       
156.7       inlined from ‘constexpr void fmt::v9::detail::bigint::assign_pow10(int)’ at /usr/include/fmt/format.h:2884:24,       
156.7       inlined from ‘constexpr void fmt::v9::detail::format_dragon(basic_fp<__int128 unsigned>, unsigned int, int, buffer<char>&, int&)’ at /usr/include/fmt/format.h:3011:29:
156.7   /usr/include/c++/13/bits/stl_algobase.h:437:30: error: ‘void* __builtin_memmove(void*, const void*, long unsigned int)’ forming offset 4 is out of the bounds [0, 4] [-Werror=array-bounds=]
156.7     437 |             __builtin_memmove(__result, __first, sizeof(_Tp) * _Num);
156.7         |             ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
156.7   cc1plus: all warnings being treated as errors
docker build --target dev-env -t dev-env:currentf  --file dolfinx/docker/Dockerfile.test-env --build-arg PETSC_SLEPC_OPTFLAGS="-O2 -march=native" .
docker build -f .\dolfinx\docker\Dockerfile.end-user -t dolfinx-fortran:current .

do you have any suggestion?

I encountered the same issue after

It might be fixed with

This PR by Garth should resolve the issue: Disable some GCC checks that trigger false positive warnings by garth-wells · Pull Request #3623 · FEniCS/dolfinx · GitHub

1 Like

thank @dokken, and Garth. It works.