noggit3
noggit3 copied to clipboard
Compiling fails on Fedora 35 with scripting enabled
Attempting to compile with scripting results in a large amount of sol2 errors when following the guide in the README at the point of make -j $(nproc) at [100%] Linking CXX executable bin/noggit.
/usr/bin/ld: CMakeFiles/noggit.dir/src/noggit/scripting/script_context.cpp.o: in function `void sol::state_view::open_libraries<sol::lib, sol::lib, sol::lib>(sol::lib&&, sol::lib&&, sol::lib&&)':
script_context.cpp:(.text._ZN3sol10state_view14open_librariesIJNS_3libES2_S2_EEEvDpOT_[_ZN3sol10state_view14open_librariesIJNS_3libES2_S2_EEEvDpOT_]+0x1ea): undefined reference to `luaopen_bit'
/usr/bin/ld: script_context.cpp:(.text._ZN3sol10state_view14open_librariesIJNS_3libES2_S2_EEEvDpOT_[_ZN3sol10state_view14open_librariesIJNS_3libES2_S2_EEEvDpOT_]+0x2d3): undefined reference to `luaopen_ffi'
/usr/bin/ld: script_context.cpp:(.text._ZN3sol10state_view14open_librariesIJNS_3libES2_S2_EEEvDpOT_[_ZN3sol10state_view14open_librariesIJNS_3libES2_S2_EEEvDpOT_]+0x30b): undefined reference to `luaopen_jit'
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/noggit.dir/build.make:1958: bin/noggit] Error 1
make[1]: *** [CMakeFiles/Makefile2:845: CMakeFiles/noggit.dir/all] Error 2
make: *** [Makefile:166: all] Error 2
After replacing the sol2 headers with v3.2.2's headers (https://github.com/ThePhD/sol2/releases) at build/_deps/sol2-src/include/sol, the terminal dumps the following errors at [ 81%] Building CXX object CMakeFiles/noggit.dir/src/noggit/scripting/script_exception.cpp.o
terminaldump.txt
The linker error indicates that Lua isn't correctly linked. The given symbol names seem to be unconditionally compiled in luajit, so there might have been an issue when installing luajit or when giving it to CMake when building Noggit. Please double-check the paths used. If you're 100% sure it is correct, verify that the path given to -DLUA_LIBRARIES= contains the symbols using nm that/path.so | grep -E 'luaopen_(bit|ffi|jit)'. It should give three lines that are not prefixed with an U.
The compiler error is probably not worth debugging: You have partially replaced files from the sol repository, which probably does not go well by definition: you didn't replace the entire source as well. The issue at hand was fixed in sol 3.2.3 though: https://github.com/ThePhD/sol2/commit/e5e6466e09b632677d24a8f204d6a0ea0a8862b1#diff-c96c96c60cfc1ade13e4c968883c2f6bb4b37befebb8e858d158b939b8e989da. The version Noggit uses by default includes that fix: https://github.com/ThePhD/sol2/blob/b9c83d5ec/include/sol/stack_core.hpp#L43, so by not modifying the sources you should already have a working version.