JakobOvrum/LuaD

dub compilation for osx and lua 5.1

Opened this issue · 3 comments

os x homebrew has a package lua51
when i install this and try to compile a sample program it fails since the lua library is
/usr/local/lib/liblua5.1.dylib

however when i do

dmd -w -wi -ignore -m64 -I../luad/ -L-L../luad/lib -L-lluad -L-llua5.1 -debug -gc -ofx source/app.d

where ../luad/ is a checked out version of luad it works.
i'm not completely sure how/where this needs to be fixed

"libs-posix": ["dl", "lua5.1"]

did the trick

The repository includes custom-compiled Lua binaries for Linux and Windows platforms because of #35, so adding the default system library to all POSIX configurations is not an option. Do you know if D exceptions work with typical Lua libraries built for OSX?

@JakobOvrum not sure what you mean by that, but when you throw an exception within d code that is called from within a lua state then its not caught by lua state and the program crashes as follows:

luad.error.LuaErrorException@luad/state.d(55): [string "..."]:4: object.Exception@source/app.d(10): what is love
----------------
5   test-luad                           0x000000010b6a78bc int luad.conversions.functions.callFunction!(void function(const(char)[])*).callFunction(luad.c.lua.lua_State*, void function(const(char)[])*, const(char)[]) + 48
6   test-luad                           0x000000010b6a782d extern (C) int luad.conversions.functions.functionWrapper!(void function(const(char)[])*).functionWrapper(luad.c.lua.lua_State*) + 145
7   liblua.5.1.dylib                    0x000000010b82138b luaD_precall + 540
8   liblua.5.1.dylib                    0x000000010b82a5bf luaV_execute + 1748
9   liblua.5.1.dylib                    0x000000010b8217eb luaD_call + 98
10  liblua.5.1.dylib                    0x000000010b820ed3 luaD_rawrunprotected + 85
11  liblua.5.1.dylib                    0x000000010b821a54 luaD_pcall + 68
12  liblua.5.1.dylib                    0x000000010b81deae lua_pcall + 100
13  test-luad                           0x000000010b6b60bf void luad.state.LuaState.doChunk!(luaL_loadstring).doChunk(const(char[]), luad.state.LuaErrorHandler) + 119
14  test-luad                           0x000000010b6b5f00 @trusted luad.base.LuaObject[] luad.state.LuaState.doString(const(char[]), luad.state.LuaErrorHandler) + 144
15  test-luad                           0x000000010b6a43f2 _Dmain + 402
16  test-luad                           0x000000010b6cc2b0 D2rt6dmain211_d_run_mainUiPPaPUAAaZiZ6runAllMFZ9__lambda1MFZv + 40
17  test-luad                           0x000000010b6cc1f5 void rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).tryExec(scope void delegate()) + 45
18  test-luad                           0x000000010b6cc255 void rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).runAll() + 45
19  test-luad                           0x000000010b6cc1f5 void rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).tryExec(scope void delegate()) + 45
20  test-luad                           0x000000010b6cc16b _d_run_main + 499
21  test-luad                           0x000000010b6a45da main + 34
22  libdyld.dylib                       0x00007fff8b0945c9 start + 1
23  ???                                 0x0000000000000001 0x0 + 1
----------------
5   liblua.5.1.dylib                    0x000000010b820e5c luaD_throw + 139
6   liblua.5.1.dylib                    0x000000010b81e111 lua_error + 9
7   test-luad                           0x000000010b6b60d0 void luad.state.LuaState.doChunk!(luaL_loadstring).doChunk(const(char[]), luad.state.LuaErrorHandler) + 136
8   test-luad                           0x000000010b6b5f00 @trusted luad.base.LuaObject[] luad.state.LuaState.doString(const(char[]), luad.state.LuaErrorHandler) + 144
9   test-luad                           0x000000010b6a43f2 _Dmain + 402
10  test-luad                           0x000000010b6cc2b0 D2rt6dmain211_d_run_mainUiPPaPUAAaZiZ6runAllMFZ9__lambda1MFZv + 40
11  test-luad                           0x000000010b6cc1f5 void rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).tryExec(scope void delegate()) + 45
12  test-luad                           0x000000010b6cc255 void rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).runAll() + 45
13  test-luad                           0x000000010b6cc1f5 void rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).tryExec(scope void delegate()) + 45
14  test-luad                           0x000000010b6cc16b _d_run_main + 499
15  test-luad                           0x000000010b6a45da main + 34
16  libdyld.dylib                       0x00007fff8b0945c9 start + 1
17  ???                                 0x0000000000000001 0x0 + 1