Hard Light Productions Forums
Modding, Mission Design, and Coding => FS2 Open Coding - The Source Code Project (SCP) => Cross-Platform Development => Topic started by: Steel01 on December 17, 2013, 02:27:09 pm
-
Has it really been six years since I posted around here? Wow...
Anyways, I upgraded my gaming desktop and buildbot to Fedora 20 and noticed my rpm build failed for fs2_open current svn trunk. Seems Fedora is now shipping LUA 5.2, which isn't supported by fs2_open yet. I don't know how much changed between 5.1 and 5.2, but it seems fairly small. After removing the configure.ac version cap, I got one warning and three errors, but I know how those can spiderweb. I can post logs later if that would help. If Fedora is shipping it now, other distros will likely follow suit soon.
In other news, I've got a lot to catch up on around here now that I'm out of college and have somewhat more time. A lot of good changes have happened in that time. Good job, devs.
Steel01
-
I threw the lua < 5.2 check into configure.ac because there were reports of it not working properly in FSO. And unfortunately Fedora20 doesn't seem to provide lua5.1 as a separate package. IIRC, there has been some discussion about adding 5.2 support, or moving to luajit. I can't remember exactly what the status of that is though.
Anyway - posting the logs would be good anyway - were they build errors or FSO errors?
-
I think my Ubuntu VM has both 5.1 and 5.2 available so I think I can experiment a bit with 5.2.
-
Build errors. They're at the end of the post. And yeah, not surprised F20 doesn't ship the last version. Bleeding edge distro and all. I've come to expect this, and it's half the fun. If y'all get a patch that needs testing, let me know. I've got a 64-bit F20 install to run on and a 32-bit F20 build bot with a 64-bit compiler grafted in available for testing.
Steel01
parse/lua.cpp: In function ‘int l_Object___tostring_f(lua_State*)’:
parse/lua.cpp:4786:68: warning: format ‘%ld’ expects argument of type ‘long int’, but argument 3 has type ‘int’ [-Wformat=]
sprintf(buf, "Object %ld [%d]", OBJ_INDEX(objh->objp), objh->sig);
^
parse/lua.cpp: In member function ‘int script_state::CreateLuaState()’:
parse/lua.cpp:14615:26: error: ‘lua_open’ was not declared in this scope
lua_State *L = lua_open();
^
parse/lua.cpp:14629:16: error: ‘LUA_GLOBALSINDEX’ was not declared in this scope
lua_rawget(L, LUA_GLOBALSINDEX);
^
parse/lua.cpp: In member function ‘int ade_table_entry::SetTable(lua_State*, int, int)’:
parse/lua.cpp:15454:20: error: ‘LUA_GLOBALSINDEX’ was not declared in this scope
if(p_amt_ldx != LUA_GLOBALSINDEX)
^
make[1]: *** [lua.o] Error 1
Edit: Just for kicks, I fired off the executable from my last F19 rpm build. Runs like a charm. Guess the vanilla fs2 campaign doesn't use lua. That or fs2_open gracefully handles the failure to open the lua interpreter and doesn't output any errors to stdout about it.
Edit to my edit: Or it's statically linked. Brain cramp moment... *scurries back off*
-
LuaJIT works fine (see my cmake branch) but it exposes the Lua 5.1 API so if we want to switch to luajit at some point we will have to keep using Lua 5.1.
-
LuaJIT works fine (see my cmake branch) but it exposes the Lua 5.1 API so if we want to switch to luajit at some point we will have to keep using Lua 5.1.
Does it? IIRC debug builds segfault, although it was along time ago I played with LuaJIT so things might have changed.
-
It works for me on windows but you could try it on Linux as I am not able to run FSO in my VM (I would also appreciate any testing done with the cmake changes). If you are interested I could give you further instructions.
-
Are there any news regarding the support for lua 5.2?
-
I'm also interested in seeing where m!m's good work on LuaJIT got to.
Is there a thread with link to the Github code or patches that can be bumped for review m!m?
-
The LuaJIT integration is included in the CMake branch: https://github.com/asarium/fs2open.github.com/tree/cmake
Just set FSO_USE_LUAJIT to ON and you are ready to go (at least on Windows or on Linux, I can't test the project files for Mac so I couldn't do much to support it).
-
LuaJIT still needs Lua 5.1, doesn't it?
-
Yes, LuaJIT only implements Lua 5.1 which is also why we are not moving to Lua 5.2 with the engine.
-
I'm also interested in fs2_open in Fedora 20. When I try to build the cmake branch, I get the following error:
[ 16%] Building CXX object code/CMakeFiles/code.dir/ai/aiturret.cpp.o
In file included from /builddir/build/BUILD/fs2_open_3_7_0cmake/lib/lua/luajit/s
rc/luajit/src/lua.h:16:0,
from /builddir/build/BUILD/fs2_open_3_7_0cmake/lib/lua/luajit/src/luajit/src/lauxlib.h:15,
from /builddir/build/BUILD/fs2_open_3_7_0cmake/code/parse/lua.h:5,
from /builddir/build/BUILD/fs2_open_3_7_0cmake/code/parse/scripting.h:6,
from /builddir/build/BUILD/fs2_open_3_7_0cmake/code/ai/aiturret.cpp:24:
/builddir/build/BUILD/fs2_open_3_7_0cmake/lib/lua/luajit/src/luajit/src/luaconf.h:118:28: error: expected constructor, destructor, or type conversion before '(' token
#define LUA_API __declspec(dllimport)
^
/builddir/build/BUILD/fs2_open_3_7_0cmake/lib/lua/luajit/src/luajit/src/lua.h:110:1: note: in expansion of macro 'LUA_API'
LUA_API lua_State *(lua_newstate) (lua_Alloc f, void *ud);
^
Would it also be possible to modify the source to check if luajit is already available instead of downloading and building from source? Fedora 20 already has luajit 2.0.2.
-
The problem is that the luajit libraries are not named the same way everywhere which makes finding them hard.
If you can post the necessary changes I can add support for that but I won't be able to do the necessary changes myself.
-
Here is a sample patch I added to find luajit library without downloading and compiling, and it seems to detect the library.
--- lib/lua/CMakeLists.txt.orig 2014-05-04 09:22:58.000000000 -0700
+++ lib/lua/CMakeLists.txt 2014-05-27 01:16:11.692412543 -0700
@@ -2,6 +2,12 @@
IF(FSO_USE_LUAJIT)
MESSAGE(STATUS "Using luajit as lua interpreter")
+ FIND_PACKAGE(PkgConfig REQUIRED)
+ pkg_check_modules(LUA luajit)
+ IF(LUA_FOUND)
+ INCLUDE(util)
+ ADD_IMPORTED_LIB(lua "${LUA_INCLUDE_DIRS}" "${LUA_LIBRARIES}" SHARED)
+ ELSE(LUA_FOUND)
INCLUDE(ExternalProject)
INCLUDE(util)
@@ -78,6 +84,7 @@ IF(FSO_USE_LUAJIT)
FILE(MAKE_DIRECTORY "${source_dir}/src")
SET(LUA_LIBS luajit_lib CACHE INTERNAL "LuaJIT library")
+ ENDIF(LUA_FOUND)
ELSE(FSO_USE_LUAJIT)
IF(NOT FSO_BUILD_INCLUDED_LIBS)
FIND_PACKAGE(Lua51 QUIET)
Now I have the following problem. How/where do I add LUA_INCLUDE_DIRS in cmake configuration so it can find the include header? I'm not familiar with cmake.
[ 12%] Building CXX object code/CMakeFiles/code.dir/ai/aiturret.cpp.o
In file included from /builddir/build/BUILD/fs2_open_3_7_0cmake/code/parse/scripting.h:6:0,
from /builddir/build/BUILD/fs2_open_3_7_0cmake/code/ai/aiturret.cpp:24:
/builddir/build/BUILD/fs2_open_3_7_0cmake/code/parse/lua.h:5:22: fatal error: lauxlib.h: No such file or directory
#include <lauxlib.h>
^
compilation terminated.
-
Thanks, I think I fixed your issue on my side (at least it works if I try it :nervous:) and pushed my changes to the github branch.