Project-OSRM / osrm-backend

Open Source Routing Machine - C++ backend
http://map.project-osrm.org
BSD 2-Clause "Simplified" License
6.33k stars 3.34k forks source link

cmake fails on osrm-backend/third_party/sol2/include/sol/sol.hpp #7002

Closed kadotafig closed 2 months ago

kadotafig commented 2 months ago

I've tried to compile osrm-backend on Ubuntu 22.04 and 24.04. The attempts fail with: /home/osrm/osrm-backend/third_party/sol2/include/sol/sol.hpp:16151:49: error: array subscript ‘const char [30][0]’ is partly outside array bounds of ‘const char [18]’ [-Werror=array-bounds=] 16151 | lua_getfield(L, tableindex, &key[0]);

I followed the Building From Source instructions on both a Ubuntu 22.04 and Ubuntu 24.04 VM.

Full stack trace: Building CXX object CMakeFiles/EXTRACTOR.dir/src/extractor/scripting_environment_lua.cpp.o In file included from /home/osrm/osrm-backend/include/extractor/scripting_environment_lua.hpp:15, from /home/osrm/osrm-backend/src/extractor/scripting_environment_lua.cpp:1: In member function ‘void sol::stack::field_getter<T, global, raw, >::get(lua_State, Key&&, int) [with Key = const char (&)[23]; T = char [23]; bool global = false; bool raw = false; = void]’, inlined from ‘void sol::stack::get_field(lua_State, Key&&, int) [with bool global = false; bool raw = false; Key = const char (&)[23]]’ at /home/osrm/osrm-backend/third_party/sol2/include/sol/sol.hpp:12091:62, inlined from ‘sol::stack::probe sol::stack::probe_field_getter<T, P, global, raw, >::get(lua_State, Key&&, int) [with Key = const char (&)[23]; T = char [23]; P = int; bool b = false; bool raw = false; = void]’ at /home/osrm/osrm-backend/third_party/sol2/include/sol/sol.hpp:16328:21, inlined from ‘sol::stack::probe sol::stack::probe_field_getter<T, P, global, raw, >::get(lua_State, Key&&, int) [with Key = const char (&)[15]; T = char [15]; P = int; bool b = false; bool raw = false; = void]’ at /home/osrm/osrm-backend/third_party/sol2/include/sol/sol.hpp:16322:9, inlined from ‘sol::stack::probe sol::stack::probe_get_field(lua_State, Key&&, int) [with bool global = false; bool raw = false; C = int; Key = const char (&)[15]]’ at /home/osrm/osrm-backend/third_party/sol2/include/sol/sol.hpp:12111:78, inlined from ‘decltype(auto) sol::basic_table_core<, >::traverse_get_deep_optional(int&, int, Key&&, Keys&& ...) const [with bool global = false; bool raw = false; sol::detail::insert_mode mode = sol::detail::none; T = sol::optional; Key = const char (&)[15]; Keys = {}; bool top_level = false; ref_t = sol::basic_reference]’ at /home/osrm/osrm-backend/third_party/sol2/include/sol/sol.hpp:25626:62, inlined from ‘decltype(auto) sol::basic_table_core<, >::traverse_get_single(int, Keys&& ...) const [with bool raw = false; Ret = sol::optional; Keys = {const char (&)[15]}; bool top_level = false; ref_t = sol::basic_reference]’ at /home/osrm/osrm-backend/third_party/sol2/include/sol/sol.hpp:25532:83, inlined from ‘decltype(auto) sol::basic_table_core<, >::traverse_get(Keys&& ...) const [with T = sol::optional; Keys = {const char (&)[15]}; bool top_level = false; ref_t = sol::basic_reference]’ at /home/osrm/osrm-backend/third_party/sol2/include/sol/sol.hpp:25859:40, inlined from ‘decltype(auto) sol::table_proxy< , >::tuple_get(std::index_sequence<_Ind ...>) const & [with T = sol::optional; long unsigned int ...I = {0}; Table = sol::basic_table_core<false, sol::basic_reference >&; Key = std::tuple<const char (&)[15]>]’ at /home/osrm/osrm-backend/third_party/sol2/include/sol/sol.hpp:24741:39, inlined from ‘decltype(auto) sol::table_proxy< , >::get() const & [with T = sol::optional; Table = sol::basic_table_core<false, sol::basic_reference >&; Key = std::tuple<const char (&)[15]>]’ at /home/osrm/osrm-backend/third_party/sol2/include/sol/sol.hpp:24846:23, inlined from ‘sol::proxy_base< >::operator T() const [with T = sol::optional; typename std::enable_if<sol::meta::all<std::integral_constant<bool, (! std::integral_constant<bool, ((((((is_string_literal_array_of_v<T, char> || is_same_v<T, const char>) || is_same_v<T, char>) || is_string_of_v<T, char>) || is_same_v<T, std::initializer_list >) || is_string_view_of_v<T, char>) || is_null_pointer_v)>::value)>, sol::is_proxy_primitive<typename std::remove_cv<typename std::remove_reference<_Iter>::type>::type> >::value, sol::meta::enable_t>::type = sol::meta::enablet::; Super = sol::table_proxy<sol::basic_table_core<false, sol::basic_reference >&, std::tuple<const char (&)[15]> >]’ at /home/osrm/osrm-backend/third_party/sol2/include/sol/sol.hpp:16972:32, inlined from ‘osrm::extractor::Sol2ScriptingEnvironment::InitContext(osrm::extractor::LuaScriptingContext&)::<lambda()>’ at /home/osrm/osrm-backend/src/extractor/scripting_environment_lua.cpp:647:85: /home/osrm/osrm-backend/third_party/sol2/include/sol/sol.hpp:16151:49: error: array subscript ‘const char [23][0]’ is partly outside array bounds of ‘const char [15]’ [-Werror=array-bounds=] 16151 | lua_getfield(L, tableindex, &key[0]); | ^~~~ In member function ‘void sol::stack::field_getter<T, global, raw, >::get(lua_State, Key&&, int) [with Key = const char (&)[30]; T = char [30]; bool global = false; bool raw = false; = void]’, inlined from ‘void sol::stack::get_field(lua_State, Key&&, int) [with bool global = false; bool raw = false; Key = const char (&)[30]]’ at /home/osrm/osrm-backend/third_party/sol2/include/sol/sol.hpp:12091:62, inlined from ‘sol::stack::probe sol::stack::probe_field_getter<T, P, global, raw, >::get(lua_State, Key&&, int) [with Key = const char (&)[30]; T = char [30]; P = bool; bool b = false; bool raw = false; = void]’ at /home/osrm/osrm-backend/third_party/sol2/include/sol/sol.hpp:16328:21, inlined from ‘sol::stack::probe sol::stack::probe_field_getter<T, P, global, raw, >::get(lua_State, Key&&, int) [with Key = const char (&)[18]; T = char [18]; P = bool; bool b = false; bool raw = false; = void]’ at /home/osrm/osrm-backend/third_party/sol2/include/sol/sol.hpp:16322:9, inlined from ‘sol::stack::probe sol::stack::probe_get_field(lua_State, Key&&, int) [with bool global = false; bool raw = false; C = bool; Key = const char (&)[18]]’ at /home/osrm/osrm-backend/third_party/sol2/include/sol/sol.hpp:12111:78, inlined from ‘decltype(auto) sol::basic_table_core<, >::traverse_get_deep_optional(int&, int, Key&&, Keys&& ...) const [with bool global = false; bool raw = false; sol::detail::insert_mode mode = sol::detail::none; T = sol::optional; Key = const char (&)[18]; Keys = {}; bool top_level = false; ref_t = sol::basic_reference]’ at /home/osrm/osrm-backend/third_party/sol2/include/sol/sol.hpp:25626:62, inlined from ‘decltype(auto) sol::basic_table_core<, >::traverse_get_single(int, Keys&& ...) const [with bool raw = false; Ret = sol::optional; Keys = {const char (&)[18]}; bool top_level = false; ref_t = sol::basic_reference]’ at /home/osrm/osrm-backend/third_party/sol2/include/sol/sol.hpp:25532:83, inlined from ‘decltype(auto) sol::basic_table_core<, >::traverse_get(Keys&& ...) const [with T = sol::optional; Keys = {const char (&)[18]}; bool top_level = false; ref_t = sol::basic_reference]’ at /home/osrm/osrm-backend/third_party/sol2/include/sol/sol.hpp:25859:40, inlined from ‘decltype(auto) sol::table_proxy< , >::tuple_get(std::index_sequence<_Ind ...>) const & [with T = sol::optional; long unsigned int ...I = {0}; Table = sol::basic_table_core<false, sol::basic_reference >&; Key = std::tuple<const char (&)[18]>]’ at /home/osrm/osrm-backend/third_party/sol2/include/sol/sol.hpp:24741:39, inlined from ‘decltype(auto) sol::table_proxy< , >::get() const & [with T = sol::optional; Table = sol::basic_table_core<false, sol::basic_reference >&; Key = std::tuple<const char (&)[18]>]’ at /home/osrm/osrm-backend/third_party/sol2/include/sol/sol.hpp:24846:23, inlined from ‘sol::proxy_base< >::operator T() const [with T = sol::optional; typename std::enable_if<sol::meta::all<std::integral_constant<bool, (! std::integral_constant<bool, ((((((is_string_literal_array_of_v<T, char> || is_same_v<T, const char>) || is_same_v<T, char>) || is_string_of_v<T, char>) || is_same_v<T, std::initializer_list >) || is_string_view_of_v<T, char>) || is_null_pointer_v)>::value)>, sol::is_proxy_primitive<typename std::remove_cv<typename std::remove_reference<_Iter>::type>::type> >::value, sol::meta::enable_t>::type = sol::meta::enablet::; Super = sol::table_proxy<sol::basic_table_core<false, sol::basic_reference >&, std::tuple<const char (&)[18]> >]’ at /home/osrm/osrm-backend/third_party/sol2/include/sol/sol.hpp:16972:32, inlined from ‘osrm::extractor::Sol2ScriptingEnvironment::InitContext(osrm::extractor::LuaScriptingContext&)::<lambda()>’ at /home/osrm/osrm-backend/src/extractor/scripting_environment_lua.cpp:666:83: /home/osrm/osrm-backend/third_party/sol2/include/sol/sol.hpp:16151:49: error: array subscript ‘const char [30][0]’ is partly outside array bounds of ‘const char [18]’ [-Werror=array-bounds=] 16151 | lua_getfield(L, tableindex, &key[0]); | ^~~~ In member function ‘void sol::stack::field_getter<T, global, raw, >::get(lua_State, Key&&, int) [with Key = const char (&)[23]; T = char [23]; bool global = false; bool raw = false; = void]’, inlined from ‘void sol::stack::get_field(lua_State, Key&&, int) [with bool global = false; bool raw = false; Key = const char (&)[23]]’ at /home/osrm/osrm-backend/third_party/sol2/include/sol/sol.hpp:12091:62, inlined from ‘sol::stack::probe sol::stack::probe_field_getter<T, P, global, raw, >::get(lua_State, Key&&, int) [with Key = const char (&)[23]; T = char [23]; P = int; bool b = false; bool raw = false; = void]’ at /home/osrm/osrm-backend/third_party/sol2/include/sol/sol.hpp:16328:21, inlined from ‘sol::stack::probe sol::stack::probe_field_getter<T, P, global, raw, >::get(lua_State, Key&&, int) [with Key = const char (&)[17]; T = char [17]; P = unsigned int; bool b = false; bool raw = false; = void]’ at /home/osrm/osrm-backend/third_party/sol2/include/sol/sol.hpp:16322:9, inlined from ‘sol::stack::probe sol::stack::probe_get_field(lua_State, Key&&, int) [with bool global = false; bool raw = false; C = unsigned int; Key = const char (&)[17]]’ at /home/osrm/osrm-backend/third_party/sol2/include/sol/sol.hpp:12111:78, inlined from ‘decltype(auto) sol::basic_table_core<, >::traverse_get_deep_optional(int&, int, Key&&, Keys&& ...) const [with bool global = false; bool raw = false; sol::detail::insert_mode mode = sol::detail::none; T = sol::optional; Key = const char (&)[17]; Keys = {}; bool top_level = false; ref_t = sol::basic_reference]’ at /home/osrm/osrm-backend/third_party/sol2/include/sol/sol.hpp:25626:62, inlined from ‘decltype(auto) sol::basic_table_core<, >::traverse_get_single(int, Keys&& ...) const [with bool raw = false; Ret = sol::optional; Keys = {const char (&)[17]}; bool top_level = false; ref_t = sol::basic_reference]’ at /home/osrm/osrm-backend/third_party/sol2/include/sol/sol.hpp:25532:83, inlined from ‘decltype(auto) sol::basic_table_core<, >::traverse_get(Keys&& ...) const [with T = sol::optional; Keys = {const char (&)[17]}; bool top_level = false; ref_t = sol::basic_reference]’ at /home/osrm/osrm-backend/third_party/sol2/include/sol/sol.hpp:25859:40, inlined from ‘decltype(auto) sol::table_proxy< , >::tuple_get(std::index_sequence<_Ind ...>) const & [with T = sol::optional; long unsigned int ...I = {0}; Table = sol::basic_table_core<false, sol::basic_reference >&; Key = std::tuple<const char (&)[17]>]’ at /home/osrm/osrm-backend/third_party/sol2/include/sol/sol.hpp:24741:39, inlined from ‘decltype(auto) sol::table_proxy< , >::get() const & [with T = sol::optional; Table = sol::basic_table_core<false, sol::basic_reference >&; Key = std::tuple<const char (&)[17]>]’ at /home/osrm/osrm-backend/third_party/sol2/include/sol/sol.hpp:24846:23, inlined from ‘sol::proxy_base< >::operator T() const [with T = sol::optional; typename std::enable_if<sol::meta::all<std::integral_constant<bool, (! std::integral_constant<bool, ((((((is_string_literal_array_of_v<T, char> || is_same_v<T, const char>) || is_same_v<T, char>) || is_string_of_v<T, char>) || is_same_v<T, std::initializer_list >) || is_string_view_of_v<T, char>) || is_null_pointer_v)>::value)>, sol::is_proxy_primitive<typename std::remove_cv<typename std::remove_reference<_Iter>::type>::type> >::value, sol::meta::enable_t>::type = sol::meta::enablet::; Super = sol::table_proxy<sol::basic_table_core<false, sol::basic_reference >&, std::tuple<const char (&)[17]> >]’ at /home/osrm/osrm-backend/third_party/sol2/include/sol/sol.hpp:16972:32, inlined from ‘osrm::extractor::Sol2ScriptingEnvironment::InitContext(osrm::extractor::LuaScriptingContext&)::<lambda()>’ at /home/osrm/osrm-backend/src/extractor/scripting_environment_lua.cpp:670:85: /home/osrm/osrm-backend/third_party/sol2/include/sol/sol.hpp:16151:49: error: array subscript ‘const char [23][0]’ is partly outside array bounds of ‘const char [17]’ [-Werror=array-bounds=] 16151 | lua_getfield(L, tableindex, &key[0]); | ^~~~ In member function ‘void sol::stack::field_getter<T, global, raw, >::get(lua_State, Key&&, int) [with Key = const char (&)[30]; T = char [30]; bool global = false; bool raw = false; = void]’, inlined from ‘void sol::stack::get_field(lua_State, Key&&, int) [with bool global = false; bool raw = false; Key = const char (&)[30]]’ at /home/osrm/osrm-backend/third_party/sol2/include/sol/sol.hpp:12091:62, inlined from ‘sol::stack::probe sol::stack::probe_field_getter<T, P, global, raw, >::get(lua_State, Key&&, int) [with Key = const char (&)[30]; T = char [30]; P = bool; bool b = false; bool raw = false; = void]’ at /home/osrm/osrm-backend/third_party/sol2/include/sol/sol.hpp:16328:21, inlined from ‘sol::stack::probe sol::stack::probe_field_getter<T, P, global, raw, >::get(lua_State, Key&&, int) [with Key = const char (&)[18]; T = char [18]; P = bool; bool b = false; bool raw = false; = void]’ at /home/osrm/osrm-backend/third_party/sol2/include/sol/sol.hpp:16322:9, inlined from ‘sol::stack::probe sol::stack::probe_get_field(lua_State, Key&&, int) [with bool global = false; bool raw = false; C = bool; Key = const char (&)[18]]’ at /home/osrm/osrm-backend/third_party/sol2/include/sol/sol.hpp:12111:78, inlined from ‘decltype(auto) sol::basic_table_core<, >::traverse_get_deep_optional(int&, int, Key&&, Keys&& ...) const [with bool global = false; bool raw = false; sol::detail::insert_mode mode = sol::detail::none; T = sol::optional; Key = const char (&)[18]; Keys = {}; bool top_level = false; ref_t = sol::basic_reference]’ at /home/osrm/osrm-backend/third_party/sol2/include/sol/sol.hpp:25626:62, inlined from ‘decltype(auto) sol::basic_table_core<, >::traverse_get_single(int, Keys&& ...) const [with bool raw = false; Ret = sol::optional; Keys = {const char (&)[18]}; bool top_level = false; ref_t = sol::basic_reference]’ at /home/osrm/osrm-backend/third_party/sol2/include/sol/sol.hpp:25532:83, inlined from ‘decltype(auto) sol::basic_table_core<, >::traverse_get(Keys&& ...) const [with T = sol::optional; Keys = {const char (&)[18]}; bool top_level = false; ref_t = sol::basic_reference]’ at /home/osrm/osrm-backend/third_party/sol2/include/sol/sol.hpp:25859:40, inlined from ‘decltype(auto) sol::table_proxy< , >::tuple_get(std::index_sequence<_Ind ...>) const & [with T = sol::optional; long unsigned int ...I = {0}; Table = sol::basic_table_core<false, sol::basic_reference >&; Key = std::tuple<const char (&)[18]>]’ at /home/osrm/osrm-backend/third_party/sol2/include/sol/sol.hpp:24741:39, inlined from ‘decltype(auto) sol::table_proxy< , >::get() const & [with T = sol::optional; Table = sol::basic_table_core<false, sol::basic_reference >&; Key = std::tuple<const char (&)[18]>]’ at /home/osrm/osrm-backend/third_party/sol2/include/sol/sol.hpp:24846:23, inlined from ‘sol::proxy_base< >::operator T() const [with T = sol::optional; typename std::enable_if<sol::meta::all<std::integral_constant<bool, (! std::integral_constant<bool, ((((((is_string_literal_array_of_v<T, char> || is_same_v<T, const char>) || is_same_v<T, char>) || is_string_of_v<T, char>) || is_same_v<T, std::initializer_list >) || is_string_view_of_v<T, char>) || is_null_pointer_v)>::value)>, sol::is_proxy_primitive<typename std::remove_cv<typename std::remove_reference<_Iter>::type>::type> >::value, sol::meta::enable_t>::type = sol::meta::enablet::; Super = sol::table_proxy<sol::basic_table_core<false, sol::basic_reference >&, std::tuple<const char (&)[18]> >]’ at /home/osrm/osrm-backend/third_party/sol2/include/sol/sol.hpp:16972:32, inlined from ‘osrm::extractor::Sol2ScriptingEnvironment::InitContext(osrm::extractor::LuaScriptingContext&)::<lambda()>’ at /home/osrm/osrm-backend/src/extractor/scripting_environment_lua.cpp:674:83: /home/osrm/osrm-backend/third_party/sol2/include/sol/sol.hpp:16151:49: error: array subscript ‘const char [30][0]’ is partly outside array bounds of ‘const char [18]’ [-Werror=array-bounds=] 16151 | lua_getfield(L, tableindex, &key[0]); | ^~~~ At global scope: cc1plus: note: unrecognized command-line option ‘-Wno-ambiguous-reversed-operator’ may have been intended to silence earlier diagnostics cc1plus: note: unrecognized command-line option ‘-Wno-deprecated-comma-subscript’ may have been intended to silence earlier diagnostics cc1plus: all warnings being treated as errors make[2]: [CMakeFiles/EXTRACTOR.dir/build.make:328: CMakeFiles/EXTRACTOR.dir/src/extractor/scripting_environment_lua.cpp.o] Error 1 make[1]: [CMakeFiles/Makefile2:235: CMakeFiles/EXTRACTOR.dir/all] Error 2 make: *** [Makefile:136: all] Error 2

This attempt was on Ubuntu 24.04 Hardware: 16 Cores 64 GB ram 1TB HDD

installed software: build-essential git cmake libboost-all-dev libtbb-dev liblua5.2-dev libluabind-dev libstxxl-dev libxml2 libxml2-dev libosmpbf-dev libbz2-dev libprotobuf-dev

Commands used: mkdir -p build cd build cmake .. cmake --build .

jcoupey commented 2 months ago

Closing as duplicate of https://github.com/Project-OSRM/osrm-backend/issues/6704. See also https://github.com/Project-OSRM/osrm-backend/issues/6349#issuecomment-1686080586.