Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Crash]: Segmentation fault on dedicated server launch (Linux arm64) #12609

Closed
arb103 opened this issue May 2, 2024 · 6 comments
Closed

[Crash]: Segmentation fault on dedicated server launch (Linux arm64) #12609

arb103 opened this issue May 2, 2024 · 6 comments

Comments

@arb103
Copy link

arb103 commented May 2, 2024

Version of OpenTTD

14.0 Debian GNU/Linux 11 arm64

Steps to reproduce

I built release 14.0 on my raspberry pi 4b running Debian 11 arm64 just as I had previously done succesfully for version 13.4
This time there was this warning when running the cmake step (irrelevant lines omitted):

CMake Warning at CMakeLists.txt:138 (find_package):
  By not providing "Findunofficial-breakpad.cmake" in CMAKE_MODULE_PATH this
  project has asked CMake to find a package configuration file provided by
  "unofficial-breakpad", but CMake did not find one.

  Could not find a package configuration file provided by
  "unofficial-breakpad" with any of the following names:

    unofficial-breakpadConfig.cmake
    unofficial-breakpad-config.cmake

  Add the installation prefix of "unofficial-breakpad" to CMAKE_PREFIX_PATH
  or set "unofficial-breakpad_DIR" to a directory containing one of the above
  files.  If "unofficial-breakpad" provides a separate development package or
  SDK, be sure it has been installed.
CMake Warning at cmake/LinkPackage.cmake:24 (message):
  unofficial-breakpad not found; compiling OpenTTD without
  unofficial-breakpad is strongly discouraged
Call Stack (most recent call first):
  CMakeLists.txt:322 (link_package)

After that, running make produces an executable which, when ran, produces the attached crash files (no crash.dmp is produced due to a lack of breakpad)
Steps followed:

  1. checkout the release/14 branch
  2. run cmake -DOPTION_DEDICATED=ON -DCMAKE_BUILD_TYPE=RelWithDebInfo ..
  3. run make and make install
  4. run /usr/local/games/openttd -D
  5. watch as it crashes

Just to make sure that the warning was relevant, I checked out the release/13 branch and ran the same cmake command, which produced no such error

One last remark is that running make test produces the following two failed tests

97% tests passed, 2 tests failed out of 62

Total Test time (real) =   1.87 sec

The following tests FAILED:
         61 - regression_regression (Failed)
         62 - regression_stationlist (Failed)
Errors while running CTest
make: *** [Makefile:114: test] Error 8

Upload crash files

crash.zip

@TrueBrain
Copy link
Member

TrueBrain commented May 2, 2024

Relevant part of the crash:

        "/usr/local/games/openttd(_Z13InitRailTypesv+0x258) [0x55746ab6ac]",
        "/usr/local/games/openttd(_Z10LoadNewGRFjj+0x1724) [0x55745ffd64]",
        "/usr/local/games/openttd(_Z14GfxLoadSpritesv+0x228) [0x55745512a8]",
        "/usr/local/games/openttd(_Z13GenerateWorld12GenWorldModejjb+0xcc) [0x557453bf5c]",

@arb103
Copy link
Author

arb103 commented May 3, 2024

I paid attention when running make this time and I saw these warnings:

Long lines inside
In file included from /home/user/OpenTTD/src/script/api/script_admin.cpp:16:
/home/user/OpenTTD/src/script/api/../../3rdparty/nlohmann/json.hpp: In member function ‘void nlohmann::json_abi_v3_11_3::detail::serializer<BasicJsonType>::dump_integer(NumberType) [with NumberType = unsigned char; typename std::enable_if<(((std::is_integral<NumberType>::value || std::is_same<NumberType, typename BasicJsonType::number_unsigned_t>::value) || std::is_same<NumberType, typename BasicJsonType::number_integer_t>::value) || std::is_same<NumberType, typename BasicJsonType::binary_t::value_type>::value), int>::type <anonymous> = 0; BasicJsonType = nlohmann::json_abi_v3_11_3::basic_json<>]’:
/home/user/OpenTTD/src/script/api/../../3rdparty/nlohmann/json.hpp:18781:29: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
18781 |             *(--buffer_ptr) = digits_to_99[digits_index][1];
In file included from /usr/include/c++/10/tuple:39,
               from /usr/include/c++/10/ranges:46,
               from /usr/include/c++/10/bits/ranges_algobase.h:38,
               from /usr/include/c++/10/bits/ranges_algo.h:35,
               from /usr/include/c++/10/algorithm:64,
               from /home/user/OpenTTD/src/stdafx.h:49,
               from /home/user/OpenTTD/build/CMakeFiles/openttd_lib.dir/cmake_pch.hxx:5,
               from <command-line>:
/usr/include/c++/10/array:110:56: note: at offset -1 to object ‘std::array<char, 64>::_M_elems’ with size 64 declared here
110 |       typename _AT_Type::_Type                         _M_elems;
    |                                                        ^~~~~~~~
In file included from /home/user/OpenTTD/src/script/api/script_admin.cpp:16:
/home/user/OpenTTD/src/script/api/../../3rdparty/nlohmann/json.hpp:18782:29: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
18782 |             *(--buffer_ptr) = digits_to_99[digits_index][0];
In file included from /usr/include/c++/10/tuple:39,
               from /usr/include/c++/10/ranges:46,
               from /usr/include/c++/10/bits/ranges_algobase.h:38,
               from /usr/include/c++/10/bits/ranges_algo.h:35,
               from /usr/include/c++/10/algorithm:64,
               from /home/user/OpenTTD/src/stdafx.h:49,
               from /home/user/OpenTTD/build/CMakeFiles/openttd_lib.dir/cmake_pch.hxx:5,
               from <command-line>:
/usr/include/c++/10/array:110:56: note: at offset -2 to object ‘std::array<char, 64>::_M_elems’ with size 64 declared here
110 |       typename _AT_Type::_Type                         _M_elems;
    |                                                        ^~~~~~~~
In file included from /home/user/OpenTTD/src/script/api/script_admin.cpp:16:
/home/user/OpenTTD/src/script/api/../../3rdparty/nlohmann/json.hpp:18788:29: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
18788 |             *(--buffer_ptr) = digits_to_99[digits_index][1];
In file included from /usr/include/c++/10/tuple:39,
               from /usr/include/c++/10/ranges:46,
               from /usr/include/c++/10/bits/ranges_algobase.h:38,
               from /usr/include/c++/10/bits/ranges_algo.h:35,
               from /usr/include/c++/10/algorithm:64,
               from /home/user/OpenTTD/src/stdafx.h:49,
               from /home/user/OpenTTD/build/CMakeFiles/openttd_lib.dir/cmake_pch.hxx:5,
               from <command-line>:
/usr/include/c++/10/array:110:56: note: at offset -1 to object ‘std::array<char, 64>::_M_elems’ with size 64 declared here
110 |       typename _AT_Type::_Type                         _M_elems;
    |                                                        ^~~~~~~~
In file included from /home/user/OpenTTD/src/script/api/script_admin.cpp:16:
/home/user/OpenTTD/src/script/api/../../3rdparty/nlohmann/json.hpp:18789:29: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
18789 |             *(--buffer_ptr) = digits_to_99[digits_index][0];
In file included from /usr/include/c++/10/tuple:39,
               from /usr/include/c++/10/ranges:46,
               from /usr/include/c++/10/bits/ranges_algobase.h:38,
               from /usr/include/c++/10/bits/ranges_algo.h:35,
               from /usr/include/c++/10/algorithm:64,
               from /home/user/OpenTTD/src/stdafx.h:49,
               from /home/user/OpenTTD/build/CMakeFiles/openttd_lib.dir/cmake_pch.hxx:5,
               from <command-line>:
/usr/include/c++/10/array:110:56: note: at offset -2 to object ‘std::array<char, 64>::_M_elems’ with size 64 declared here
110 |       typename _AT_Type::_Type                         _M_elems;
    |                                                        ^~~~~~~~
In file included from /home/user/OpenTTD/src/network/../survey.h:13,
                 from /home/user/OpenTTD/src/network/network_survey.cpp:16:
/home/user/OpenTTD/src/network/../3rdparty/nlohmann/json.hpp: In member function ‘void nlohmann::json_abi_v3_11_3::detail::serializer<BasicJsonType>::dump_integer(NumberType) [with NumberType = unsigned char; typename std::enable_if<(((std::is_integral<NumberType>::value || std::is_same<NumberType, typename BasicJsonType::number_unsigned_t>::value) || std::is_same<NumberType, typename BasicJsonType::number_integer_t>::value) || std::is_same<NumberType, typename BasicJsonType::binary_t::value_type>::value), int>::type <anonymous> = 0; BasicJsonType = nlohmann::json_abi_v3_11_3::basic_json<>]’:
/home/user/OpenTTD/src/network/../3rdparty/nlohmann/json.hpp:18781:29: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
18781 |             *(--buffer_ptr) = digits_to_99[digits_index][1];
In file included from /usr/include/c++/10/tuple:39,
                 from /usr/include/c++/10/ranges:46,
                 from /usr/include/c++/10/bits/ranges_algobase.h:38,
                 from /usr/include/c++/10/bits/ranges_algo.h:35,
                 from /usr/include/c++/10/algorithm:64,
                 from /home/user/OpenTTD/src/stdafx.h:49,
                 from /home/user/OpenTTD/build/CMakeFiles/openttd_lib.dir/cmake_pch.hxx:5,
                 from <command-line>:
/usr/include/c++/10/array:110:56: note: at offset -1 to object ‘std::array<char, 64>::_M_elems’ with size 64 declared here
  110 | AT_Type::_Type                         _M_elems;
      |                                        ^~~~~~~~

In file included from /home/user/OpenTTD/src/network/../survey.h:13,
                 from /home/user/OpenTTD/src/network/network_survey.cpp:16:
/home/user/OpenTTD/src/network/../3rdparty/nlohmann/json.hpp:18782:29: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
18782 |             *(--buffer_ptr) = digits_to_99[digits_index][0];
In file included from /usr/include/c++/10/tuple:39,
                 from /usr/include/c++/10/ranges:46,
                 from /usr/include/c++/10/bits/ranges_algobase.h:38,
                 from /usr/include/c++/10/bits/ranges_algo.h:35,
                 from /usr/include/c++/10/algorithm:64,
                 from /home/user/OpenTTD/src/stdafx.h:49,
                 from /home/user/OpenTTD/build/CMakeFiles/openttd_lib.dir/cmake_pch.hxx:5,
                 from <command-line>:
/usr/include/c++/10/array:110:56: note: at offset -2 to object ‘std::array<char, 64>::_M_elems’ with size 64 declared here
  110 | AT_Type::_Type                         _M_elems;
      |                                        ^~~~~~~~

In file included from /home/user/OpenTTD/src/network/../survey.h:13,
                 from /home/user/OpenTTD/src/network/network_survey.cpp:16:
/home/user/OpenTTD/src/network/../3rdparty/nlohmann/json.hpp:18788:29: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
18788 |             *(--buffer_ptr) = digits_to_99[digits_index][1];
In file included from /usr/include/c++/10/tuple:39,
                 from /usr/include/c++/10/ranges:46,
                 from /usr/include/c++/10/bits/ranges_algobase.h:38,
                 from /usr/include/c++/10/bits/ranges_algo.h:35,
                 from /usr/include/c++/10/algorithm:64,
                 from /home/user/OpenTTD/src/stdafx.h:49,
                 from /home/user/OpenTTD/build/CMakeFiles/openttd_lib.dir/cmake_pch.hxx:5,
                 from <command-line>:
/usr/include/c++/10/array:110:56: note: at offset -1 to object ‘std::array<char, 64>::_M_elems’ with size 64 declared here
  110 | AT_Type::_Type                         _M_elems;
      |                                        ^~~~~~~~

In file included from /home/user/OpenTTD/src/network/../survey.h:13,
                 from /home/user/OpenTTD/src/network/network_survey.cpp:16:
/home/user/OpenTTD/src/network/../3rdparty/nlohmann/json.hpp:18789:29: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
18789 |             *(--buffer_ptr) = digits_to_99[digits_index][0];
In file included from /usr/include/c++/10/tuple:39,
                 from /usr/include/c++/10/ranges:46,
                 from /usr/include/c++/10/bits/ranges_algobase.h:38,
                 from /usr/include/c++/10/bits/ranges_algo.h:35,
                 from /usr/include/c++/10/algorithm:64,
                 from /home/user/OpenTTD/src/stdafx.h:49,
                 from /home/user/OpenTTD/build/CMakeFiles/openttd_lib.dir/cmake_pch.hxx:5,
                 from <command-line>:
/usr/include/c++/10/array:110:56: note: at offset -2 to object ‘std::array<char, 64>::_M_elems’ with size 64 declared here
  110 | AT_Type::_Type                         _M_elems;
      |                                        ^~~~~~~~

In file included from /home/user/OpenTTD/src/crashlog.h:13,
                 from /home/user/OpenTTD/src/crashlog.cpp:11:
/home/user/OpenTTD/src/3rdparty/nlohmann/json.hpp: In member function ‘void nlohmann::json_abi_v3_11_3::detail::serializer<BasicJsonType>::dump_integer(NumberType) [with NumberType = unsigned char; typename std::enable_if<(((std::is_integral<NumberType>::value || std::is_same<NumberType, typename BasicJsonType::number_unsigned_t>::value) || std::is_same<NumberType, typename BasicJsonType::number_integer_t>::value) || std::is_same<NumberType, typename BasicJsonType::binary_t::value_type>::value), int>::type <anonymous> = 0; BasicJsonType = nlohmann::json_abi_v3_11_3::basic_json<>]’:
/home/user/OpenTTD/src/3rdparty/nlohmann/json.hpp:18781:29: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
18781 |             *(--buffer_ptr) = digits_to_99[digits_index][1];
In file included from /usr/include/c++/10/tuple:39,
                 from /usr/include/c++/10/ranges:46,
                 from /usr/include/c++/10/bits/ranges_algobase.h:38,
                 from /usr/include/c++/10/bits/ranges_algo.h:35,
                 from /usr/include/c++/10/algorithm:64,
                 from /home/user/OpenTTD/src/stdafx.h:49,
                 from /home/user/OpenTTD/build/CMakeFiles/openttd_lib.dir/cmake_pch.hxx:5,
                 from <command-line>:
/usr/include/c++/10/array:110:56: note: at offset -1 to object ‘std::array<char, 64>::_M_elems’ with size 64 declared here
  110 |       typename _AT_Type::_Type                         _M_elems;
      |                                                        ^~~~~~~~
In file included from /home/user/OpenTTD/src/crashlog.h:13,
                 from /home/user/OpenTTD/src/crashlog.cpp:11:
/home/user/OpenTTD/src/3rdparty/nlohmann/json.hpp:18782:29: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
18782 |             *(--buffer_ptr) = digits_to_99[digits_index][0];
In file included from /usr/include/c++/10/tuple:39,
                 from /usr/include/c++/10/ranges:46,
                 from /usr/include/c++/10/bits/ranges_algobase.h:38,
                 from /usr/include/c++/10/bits/ranges_algo.h:35,
                 from /usr/include/c++/10/algorithm:64,
                 from /home/user/OpenTTD/src/stdafx.h:49,
                 from /home/user/OpenTTD/build/CMakeFiles/openttd_lib.dir/cmake_pch.hxx:5,
                 from <command-line>:
/usr/include/c++/10/array:110:56: note: at offset -2 to object ‘std::array<char, 64>::_M_elems’ with size 64 declared here
  110 |       typename _AT_Type::_Type                         _M_elems;
      |                                                        ^~~~~~~~
In file included from /home/user/OpenTTD/src/crashlog.h:13,
                 from /home/user/OpenTTD/src/crashlog.cpp:11:
/home/user/OpenTTD/src/3rdparty/nlohmann/json.hpp:18788:29: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
18788 |             *(--buffer_ptr) = digits_to_99[digits_index][1];
In file included from /usr/include/c++/10/tuple:39,
                 from /usr/include/c++/10/ranges:46,
                 from /usr/include/c++/10/bits/ranges_algobase.h:38,
                 from /usr/include/c++/10/bits/ranges_algo.h:35,
                 from /usr/include/c++/10/algorithm:64,
                 from /home/user/OpenTTD/src/stdafx.h:49,
                 from /home/user/OpenTTD/build/CMakeFiles/openttd_lib.dir/cmake_pch.hxx:5,
                 from <command-line>:
/usr/include/c++/10/array:110:56: note: at offset -1 to object ‘std::array<char, 64>::_M_elems’ with size 64 declared here
  110 |       typename _AT_Type::_Type                         _M_elems;
      |                                                        ^~~~~~~~
In file included from /home/user/OpenTTD/src/crashlog.h:13,
                 from /home/user/OpenTTD/src/crashlog.cpp:11:
/home/user/OpenTTD/src/3rdparty/nlohmann/json.hpp:18789:29: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
18789 |             *(--buffer_ptr) = digits_to_99[digits_index][0];
In file included from /usr/include/c++/10/tuple:39,
                 from /usr/include/c++/10/ranges:46,
                 from /usr/include/c++/10/bits/ranges_algobase.h:38,
                 from /usr/include/c++/10/bits/ranges_algo.h:35,
                 from /usr/include/c++/10/algorithm:64,
                 from /home/user/OpenTTD/src/stdafx.h:49,
                 from /home/user/OpenTTD/build/CMakeFiles/openttd_lib.dir/cmake_pch.hxx:5,
                 from <command-line>:
/usr/include/c++/10/array:110:56: note: at offset -2 to object ‘std::array<char, 64>::_M_elems’ with size 64 declared here
  110 |       typename _AT_Type::_Type                         _M_elems;
      |                                                        ^~~~~~~~

Hope it's relevant to finding the solution to this

@PeterN
Copy link
Member

PeterN commented May 4, 2024

I've compiled a 64-bit ARM build and I'm not seeing this issue.

It is however the latest Pi OS, based on Debian 12.5 instead of 11. We switched to C++20 for OpenTTD 14, so maybe the c++ library or the compilers on Debian 11 is a bit old?

ii  gcc-12                               12.2.0-14                           arm64        GNU C compiler
ii  libstdc++-12-dev:arm64               12.2.0-14                           arm64        GNU Standard C++ Library v3 (development files)

@arb103
Copy link
Author

arb103 commented May 4, 2024

This can probably be closed with a mention of minimum compiler version in the COMPILING.md if that's the case
I'll hate moving all my other stuff but I can't kick the can down the road any longer, I'll be updating to debian 12 and trying again in a few days

@arb103
Copy link
Author

arb103 commented May 6, 2024

Upgrade to debian 12 is complete, I ran cmake and got the same warnings again, then the following warning during make

Long lines inside
In file included from /home/user/OpenTTD/src/music/midifile.cpp:10:                                                                                                             [771/1309]
In constructor ‘constexpr MidiFile::DataBlock::DataBlock(MidiFile::DataBlock&&)’,                                                                                                              
    inlined from ‘constexpr decltype (::new(void*(0)) _Tp) std::construct_at(_Tp*, _Args&& ...) [with _Tp = MidiFile::DataBlock; _Args = {MidiFile::DataBlock}]’ at /usr/include/c++/12/bits/st
l_construct.h:97:14,                                                                                                                                                                           
    inlined from ‘static constexpr void std::allocator_traits<std::allocator<_Up> >::construct(allocator_type&, _Up*, _Args&& ...) [with _Up = MidiFile::DataBlock; _Args = {MidiFile::DataBloc
k}; _Tp = MidiFile::DataBlock]’ at /usr/include/c++/12/bits/alloc_traits.h:518:21,                                                                                                             
    inlined from ‘constexpr std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::emplace_back(_Args&& ...) [with _Args = {MidiFile::DataBlock}; _Tp = MidiFile::DataBlock; _Alloc = st
d::allocator<MidiFile::DataBlock>]’ at /usr/include/c++/12/bits/vector.tcc:117:30,                                                                                                             
    inlined from ‘constexpr void std::vector<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = MidiFile::DataBlock; _Alloc = std::allocator<MidiFile::DataBlock>]’ at /usr/include/c++/12/bits/
stl_vector.h:1294:21,                                                                                                                                                                          
    inlined from ‘bool MpsMachine::PlayInto()’ at /home/user/OpenTTD/src/music/midifile.cpp:794:32:                                                                                       
/home/user/OpenTTD/src/music/midifile.hpp:19:16: warning: ‘<unnamed>.MidiFile::DataBlock::realtime’ may be used uninitialized [-Wmaybe-uninitialized]                                     
   19 |         struct DataBlock {                                                                                                                                                             
      |                ^~~~~~~~~                                                                                                                                                               
/home/user/OpenTTD/src/music/midifile.cpp: In member function ‘bool MpsMachine::PlayInto()’:                                                                                              
/home/user/OpenTTD/src/music/midifile.cpp:794:67: note: ‘<anonymous>’ declared here                                                                                                       
  794 |                 this->target.blocks.push_back(MidiFile::DataBlock());                                                                                                                  
      |                                                                   ^                                                                                                                    
In constructor ‘constexpr MidiFile::DataBlock::DataBlock(MidiFile::DataBlock&&)’,                                                                                                              
    inlined from ‘constexpr decltype (::new(void*(0)) _Tp) std::construct_at(_Tp*, _Args&& ...) [with _Tp = MidiFile::DataBlock; _Args = {MidiFile::DataBlock}]’ at /usr/include/c++/12/bits/st
l_construct.h:97:14,                                                                                                                                                                           
    inlined from ‘static constexpr void std::allocator_traits<std::allocator<_Up> >::construct(allocator_type&, _Up*, _Args&& ...) [with _Up = MidiFile::DataBlock; _Args = {MidiFile::DataBloc
k}; _Tp = MidiFile::DataBlock]’ at /usr/include/c++/12/bits/alloc_traits.h:518:21,                                                                                                             
    inlined from ‘constexpr std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::emplace_back(_Args&& ...) [with _Args = {MidiFile::DataBlock}; _Tp = MidiFile::DataBlock; _Alloc = st
d::allocator<MidiFile::DataBlock>]’ at /usr/include/c++/12/bits/vector.tcc:117:30,                                                                                                             
    inlined from ‘constexpr void std::vector<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = MidiFile::DataBlock; _Alloc = std::allocator<MidiFile::DataBlock>]’ at /usr/include/c++/12/bits/
stl_vector.h:1294:21,                                                                                                                                                                          
    inlined from ‘bool MpsMachine::PlayInto()’ at /home/user/OpenTTD/src/music/midifile.cpp:801:33:                                                                                       
/home/user/OpenTTD/src/music/midifile.hpp:19:16: warning: ‘<unnamed>.MidiFile::DataBlock::realtime’ may be used uninitialized [-Wmaybe-uninitialized]                                     
   19 |         struct DataBlock {                                                                                                                                                             
      |                ^~~~~~~~~                                                                                                                                                               
/home/user/OpenTTD/src/music/midifile.cpp: In member function ‘bool MpsMachine::PlayInto()’:                                                                                              
/home/user/OpenTTD/src/music/midifile.cpp:801:75: note: ‘<anonymous>’ declared here                                                                                                       
  801 |                         this->target.blocks.push_back(MidiFile::DataBlock());                                                                                                          
      |                                                                           ^                                                                                                            
In constructor ‘constexpr MidiFile::DataBlock::DataBlock(MidiFile::DataBlock&&)’,                                                                                                              
    inlined from ‘constexpr decltype (::new(void*(0)) _Tp) std::construct_at(_Tp*, _Args&& ...) [with _Tp = MidiFile::DataBlock; _Args = {MidiFile::DataBlock}]’ at /usr/include/c++/12/bits/st
l_construct.h:97:14,                                                                                                                                                                           
    inlined from ‘static constexpr void std::allocator_traits<std::allocator<_Up> >::construct(allocator_type&, _Up*, _Args&& ...) [with _Up = MidiFile::DataBlock; _Args = {MidiFile::DataBloc
k}; _Tp = MidiFile::DataBlock]’ at /usr/include/c++/12/bits/alloc_traits.h:518:21,                                                                                                             
    inlined from ‘constexpr std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::emplace_back(_Args&& ...) [with _Args = {MidiFile::DataBlock}; _Tp = MidiFile::DataBlock; _Alloc = st
d::allocator<MidiFile::DataBlock>]’ at /usr/include/c++/12/bits/vector.tcc:117:30,                                                                                                             
    inlined from ‘constexpr void std::vector<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = MidiFile::DataBlock; _Alloc = std::allocator<MidiFile::DataBlock>]’ at /usr/include/c++/12/bits/
stl_vector.h:1294:21,                                                                                                                                                                          
    inlined from ‘bool ReadTrackChunk(FILE*, MidiFile&)’ at /home/user/OpenTTD/src/music/midifile.cpp:213:25,
    inlined from ‘bool MidiFile::LoadFile(const std::string&)’ at /home/user/OpenTTD/src/music/midifile.cpp:471:22:
/home/user/OpenTTD/src/music/midifile.hpp:19:16: warning: ‘<unnamed>.MidiFile::DataBlock::realtime’ may be used uninitialized [-Wmaybe-uninitialized]
   19 |         struct DataBlock {
      |                ^~~~~~~~~
/home/user/OpenTTD/src/music/midifile.cpp: In member function ‘bool MidiFile::LoadFile(const std::string&)’:
/home/user/OpenTTD/src/music/midifile.cpp:213:53: note: ‘<anonymous>’ declared here
  213 |         target.blocks.push_back(MidiFile::DataBlock());
      |                                                     ^
In constructor ‘constexpr MidiFile::DataBlock::DataBlock(MidiFile::DataBlock&&)’,
    inlined from ‘constexpr decltype (::new(void*(0)) _Tp) std::construct_at(_Tp*, _Args&& ...) [with _Tp = MidiFile::DataBlock; _Args = {MidiFile::DataBlock}]’ at /usr/include/c++/12/bits/st
l_construct.h:97:14,
    inlined from ‘static constexpr void std::allocator_traits<std::allocator<_Up> >::construct(allocator_type&, _Up*, _Args&& ...) [with _Up = MidiFile::DataBlock; _Args = {MidiFile::DataBloc
k}; _Tp = MidiFile::DataBlock]’ at /usr/include/c++/12/bits/alloc_traits.h:518:21,
    inlined from ‘constexpr std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::emplace_back(_Args&& ...) [with _Args = {MidiFile::DataBlock}; _Tp = MidiFile::DataBlock; _Alloc = st
d::allocator<MidiFile::DataBlock>]’ at /usr/include/c++/12/bits/vector.tcc:117:30,
    inlined from ‘constexpr void std::vector<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = MidiFile::DataBlock; _Alloc = std::allocator<MidiFile::DataBlock>]’ at /usr/include/c++/12/bits/
stl_vector.h:1294:21,
    inlined from ‘bool ReadTrackChunk(FILE*, MidiFile&)’ at /home/user/OpenTTD/src/music/midifile.cpp:225:27,
    inlined from ‘bool MidiFile::LoadFile(const std::string&)’ at /home/user/OpenTTD/src/music/midifile.cpp:471:22:
/home/user/OpenTTD/src/music/midifile.hpp:19:16: warning: ‘<unnamed>.MidiFile::DataBlock::realtime’ may be used uninitialized [-Wmaybe-uninitialized]
   19 |         struct DataBlock {
      |                ^~~~~~~~~
/home/user/OpenTTD/src/music/midifile.cpp: In member function ‘bool MidiFile::LoadFile(const std::string&)’:
/home/user/OpenTTD/src/music/midifile.cpp:225:96: note: ‘<anonymous>’ declared here
  225 |                         target.blocks.push_back(MidiFile::DataBlock(block->ticktime + deltatime));
      |

Despite this, the game succesfully compiled and runs with no apparent issues.
I'll close this as solved, although mentioning gcc 12 and C++20 as minimum requirements for version 14.0 onwards would be great.

@arb103 arb103 closed this as completed May 6, 2024
@PeterN
Copy link
Member

PeterN commented May 6, 2024

Well it is in COMPILING.md

## Supported compilers

Every compiler that is supported by CMake and supports C++20, should be
able to compile OpenTTD. As the exact list of compilers changes constantly,
we refer to the compiler manual to see if it supports C++20, and to CMake
to see if it supports your compiler.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants