LuaJIT cross compilation

374 views
Skip to first unread message

weitjong

unread,
Oct 8, 2013, 12:44:28 AM10/8/13
to urh...@googlegroups.com
I wonder why GitHub does not automatically include new branch creation into its news entry. So, I am here to break the news myself :)

I have just pushed a new remote branch called 'luajit' containing my changes to fix LuaJIT compilation issue on Linux (at least it was on my Fedora 64-bit system) and also to enable it to cross-compile for Android and Rasperry Pi. I have not merged the changes to master branch yet because I have not tested all the platforms (namely on Windows side). So far, I have verified it to be building and running fine on Linux and Android. Raspi builds fine but not test run yet as my Raspberry Pi is currently unplugged. For those who are interested, please kindly help to test this branch and report back on any issues. Thanks.

Raster Ron

unread,
Oct 8, 2013, 12:57:06 AM10/8/13
to urh...@googlegroups.com

I'm using Windows mainly and would like to help. So luajit branch on Windows? checking it out now..

Raster Ron

unread,
Oct 8, 2013, 1:42:09 AM10/8/13
to urh...@googlegroups.com
I'm getting a warning on cmake:

warning did not find file compiler/msvc-asm

and 3 errors on Build (VS2010):

Error 3 error C1189: #error :  "Missing soft-float definitions for target architecture" E:\luajit\Source\ThirdParty\LuaJIT\src\lj_ircall.h 224 1 buildvm
Error 64 error LNK1104: cannot open file '..\..\ThirdParty\LuaJIT\Debug\LuaJIT.lib' E:\luajit\Build\Tools\Urho3D\LINK Urho3D
Error 10 error MSB6006: "cmd.exe" exited with code 9009. Microsoft.CppCommon.targets 151 6 LuaJIT

weitjong

unread,
Oct 8, 2013, 3:07:09 AM10/8/13
to urh...@googlegroups.com
I see the problem. I will commit a patch soon.

weitjong

unread,
Oct 8, 2013, 3:58:37 AM10/8/13
to urh...@googlegroups.com
The change is pushed to remote 'luajit' branch. Please test again at your convenience time.

Now that the 'luajit' branch is available remotely on GitHub, I can also test it on my Win7 VM. I have just installed GitHub client for Windows on it and checked the branch out myself. No more CMake error and MSVC builds OK and Urho3D runs LuaScripts samples just fine (with some expected artifacts caused by VirtualBox Direct3D emulated driver).

Lasse Öörni

unread,
Oct 8, 2013, 4:53:59 AM10/8/13
to urh...@googlegroups.com
I managed to compile vs2008 32bit mode fine, vs2008 64bit mode gives the following errors:

1>..\..\..\Source\ThirdParty\LuaJIT\src\lj_err.c(381) : error C2061: syntax error : identifier 'PEXCEPTION_ROUTINE'
1>..\..\..\Source\ThirdParty\LuaJIT\src\lj_err.c(383) : error C2061: syntax error : identifier 'HistoryTable'
1>..\..\..\Source\ThirdParty\LuaJIT\src\lj_err.c(383) : error C2059: syntax error : ';'
1>..\..\..\Source\ThirdParty\LuaJIT\src\lj_err.c(386) : error C2059: syntax error : '}'
1>..\..\..\Source\ThirdParty\LuaJIT\src\lj_err.c(407) : error C2143: syntax error : missing ')' before '*'
1>..\..\..\Source\ThirdParty\LuaJIT\src\lj_err.c(407) : error C2081: 'UndocumentedDispatcherContext' : name in formal parameter list illegal
1>..\..\..\Source\ThirdParty\LuaJIT\src\lj_err.c(407) : error C2143: syntax error : missing '{' before '*'
1>..\..\..\Source\ThirdParty\LuaJIT\src\lj_err.c(407) : error C2059: syntax error : ')'
1>..\..\..\Source\ThirdParty\LuaJIT\src\lj_err.c(408) : error C2054: expected '(' to follow 'dispatch'

This appears like WinNT.h is refusing to define that identifier. It might be possible vs2008 64bit is unsupported. I will be able to test vs2010 64bit later in the day.

Raster Ron

unread,
Oct 8, 2013, 5:19:17 AM10/8/13
to urh...@googlegroups.com
Hey guys, ok just got the update and it builds ok now on 32 and 64bit release build (VC2010)

Lasse Öörni

unread,
Oct 8, 2013, 5:47:04 AM10/8/13
to urh...@googlegroups.com
Pushed a crude workaround for the exception handling code in VS2008 64-bit mode. I'm not actually sure if exception handling will work, but at least it compiles and runs Lua script properly.

Lasse Öörni

unread,
Oct 8, 2013, 6:21:54 AM10/8/13
to urh...@googlegroups.com
Forgot to add that on VS2010, 32bit and 64bit compilation worked out of the box for me as well.

weitjong

unread,
Oct 8, 2013, 1:15:37 PM10/8/13
to urh...@googlegroups.com
Tested OK on Mac OS X desktop build for 32-bit and 64-bit too.

Could not yet build for iOS device because the way currently CMakeLists.txt detects the target architecture information required a true cross-compiling tool chain setup. So, currently instead of detecting the target iOS architecture, it actually just returns back the same host machine architecture information. Probably would have to hand coded IOS device target architecture information similar to how it is done for Windows. Having said that, it actually builds and runs fine on 32-bit iOS Simulator. As I have no way to verify on an actual iOS device at the moment, I will not attempt to hand code the iOS device information myself. Anyone can help?

Since most of the platforms are tested OK, I propose to merge this topic branch soon into master as I see we have another topic branch coming from Aster. Lasse, are you OK with that?

Lasse Öörni

unread,
Oct 8, 2013, 1:26:46 PM10/8/13
to urh...@googlegroups.com
Yes, by me this is certainly OK to be merged into trunk. Great work!

I believe on iOS you're not allowed to use LuaJIT fully (to actually compile machine code during runtime) but to use it only as an enhanced bytecode interpreter, so to me it's a non-issue.

Alex Fuller

unread,
Oct 8, 2013, 9:51:39 PM10/8/13
to urh...@googlegroups.com
Just curious, has anyone tried lua-llvm before? I think it supports AOT static compiles which sounds interesting for iOS if bytecode interpretation is slow.

I'm interested in Lua now after discovering Moonscript makes it very Python-like :)

-Alex
Reply all
Reply to author
Forward
0 new messages