chrxh / alien

ALIEN is a CUDA-powered artificial life simulation program.
https://alien-project.org
BSD 3-Clause "New" or "Revised" License
4.45k stars 137 forks source link

Build error on Arch Linux #100

Closed yuvadm closed 2 weeks ago

yuvadm commented 3 weeks ago

Build error:

[ 14%] Built target Base
[ 15%] Building CXX object source/EngineInterface/CMakeFiles/EngineInterface.dir/SimulationParameters.cpp.o
[ 15%] Building CXX object source/Network/CMakeFiles/Network.dir/NetworkService.cpp.o
[ 16%] Building CXX object source/Network/CMakeFiles/Network.dir/NetworkResourceParserService.cpp.o
[ 16%] Building CXX object source/EngineInterface/CMakeFiles/EngineInterface.dir/SpaceCalculator.cpp.o
In file included from /usr/include/c++/14.2.1/array:43,
                 from /home/yuval/dev/alien/source/Base/Definitions.h:3,
                 from /home/yuval/dev/alien/source/EngineInterface/DescriptionEditService.h:3,
                 from /home/yuval/dev/alien/source/EngineInterface/DescriptionEditService.cpp:1:
In function ‘constexpr decltype (__comp((* __first1), (* __first2))) std::lexicographical_compare_three_way(_InputIter1, _InputIter1, _InputIter2, _InputIter2, _Comp) [with _InputIter1 = __gnu_cxx::__normal_iterator<const unsigned char*, vector<unsigned char> >; _InputIter2 = __gnu_cxx::__normal_iterator<const unsigned char*, vector<unsigned char> >; _Comp = __detail::_Synth3way]’,
    inlined from ‘constexpr std::__detail::__synth3way_t<_Iterator> std::operator<=>(const vector<_Tp, _Alloc>&, const vector<_Tp, _Alloc>&) [with _Tp = unsigned char; _Alloc = allocator<unsigned char>]’ at /usr/include/c++/14.2.1/bits/stl_vector.h:2071:52,
    inlined from ‘constexpr bool std::less<_Tp>::operator()(const _Tp&, const _Tp&) const [with _Tp = std::vector<unsigned char>]’ at /usr/include/c++/14.2.1/bits/stl_function.h:405:20,
    inlined from ‘std::pair<std::_Rb_tree_node_base*, std::_Rb_tree_node_base*> std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_get_insert_unique_pos(const key_type&) [with _Key = std::vector<unsigned char>; _Val = std::pair<const std::vector<unsigned char>, long unsigned int>; _KeyOfValue = std::_Select1st<std::pair<const std::vector<unsigned char>, long unsigned int> >; _Compare = std::less<std::vector<unsigned char> >; _Alloc = std::allocator<std::pair<const std::vector<unsigned char>, long unsigned int> >]’ at /usr/include/c++/14.2.1/bits/stl_tree.h:2114:35:
/usr/include/c++/14.2.1/bits/stl_algobase.h:1874:39: error: ‘int __builtin_memcmp(const void*, const void*, long unsigned int)’ specified bound [9223372036854775808, 18446744073709551615] exceeds maximum object size 9223372036854775807 [-Werror=stringop-overread]
 1874 |                     = __builtin_memcmp(&*__first1, &*__first2, __blen) <=> 0;
      |         

This comes up as a relevant bug from the past few weeks (albeit on Debian) - https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1077393 however still not sure how to resolve this.

mashaal commented 3 weeks ago

Running into this as well.

chrxh commented 3 weeks ago

It seems to be GCC compiler bug with the C++20 spaceship operator. I think the best solution is to use GCC 11 (see https://github.com/chrxh/alien?tab=readme-ov-file#build-instructions).

mgalgs commented 2 weeks ago

use GCC 11

Quick instructions with relevant definitions:

yay gcc11
mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=gcc-11 -DCMAKE_CXX_COMPILER=g++-11
cmake --build . --config Release -j<whatever>
chrxh commented 2 weeks ago

Thanks @mgalgs ! @yuvadm Does it solves your problem?

yuvadm commented 2 weeks ago

Yeah I guess that's good enough for now, thanks guys