solarus-games / solarus-quest-editor

This repository was moved to GitLab: https://gitlab.com/solarus-games/solarus-quest-editor
Other
96 stars 30 forks source link

[Ubuntu] Final linking w/LuaJIT fails with multiple `undefined reference` errors #347

Closed Fordi closed 6 years ago

Fordi commented 6 years ago

Building on Ubuntu 17.10, confirmed necessary packages are present.

When building with cmake .., build fails with the following error:

[ 86%] Linking CXX executable solarus-quest-editor
CMakeFiles/solarus-quest-editor.dir/src/widgets/external_script_dialog.cpp.o: In function `SolarusEditor::ExternalScriptDialog::run_script()':
external_script_dialog.cpp:(.text+0x11a3): undefined reference to `lua_setglobal'
external_script_dialog.cpp:(.text+0x135e): undefined reference to `lua_pcallk'
external_script_dialog.cpp:(.text+0x1374): undefined reference to `lua_pcallk'
external_script_dialog.cpp:(.text+0x1823): undefined reference to `lua_pcallk'
collect2: error: ld returned 1 exit status
CMakeFiles/solarus-quest-editor.dir/build.make:3490: recipe for target 'solarus-quest-editor' failed
make[2]: *** [solarus-quest-editor] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/solarus-quest-editor.dir/all' failed
make[1]: *** [CMakeFiles/solarus-quest-editor.dir/all] Error 2
Makefile:129: recipe for target 'all' failed
make: *** [all] Error 2

With cmake -DSOLARUS_USE_LUAJIT=OFF .., build succeeds.

Fordi commented 6 years ago

By adding the following after #include <lua.hpp> in external_script_dialog.cpp, I can build with LuaJIT:

extern "C" {
  #include <lua.h>
}

Dunno if that's a dirty hack or not, since lua.hpp includes lua.h the same way, I assume to get lua.h's symbols into the cpp file including it.

Fordi commented 6 years ago

Discovered this was environmental, due to my having a locally-built lua 5 in /usr/local. Closing.