Open Habbie opened 7 years ago
Hi Habbie, sorry for the long wait, I somehow missed your pull request.
As far as I know, at least on Linux, Lua extension modules (when built as a dynamic library, eg. luanacha.so) do not need to be linked with liblua.a. All the liblua symbols are defined within the lua executable, and are resolved when the extension is dynamically loaded.
I don't know about Lua build and modules on MacOS or OS X. You may find useful information at http://lua-users.org/wiki/BuildingModules (see section Mac OS X shared libraries)
It looks like the " -shared " link option should be replaced with " -bundle -undefined dynamic_lookup "
See also for example the well-known LFS (LuaFileSystem) Makefile https://github.com/keplerproject/luafilesystem
Hope it helps,
Phil
Hello Phil,
and I somehow missed your comment 🙈
Indeed -bundle -undefined dynamic_lookup
does the trick. Would you accept a PR fixing that for OSX? Do you have a preferred approach to making this conditional? How about libtool?
Thanks to confirm it works (I have no way to test on a Mac).
For the moment, I will at least add a comment in the Makefile with a LDFLAGS definition for OSX.
What would you suggest to improve this? would a distinct 'Makefile.OSX' be better?
Re libtools: I really dislike libtooI and autotools, maybe because I don't know them well enough! ;-) I also want to keep the build as minimal as possible.
With these changes,
make LUA=$(which lua-5.2) LUADIR=/usr/local/opt/lua clean luanacha.so test
works on macOS for me (afterbrew install lua
which installs 5.2).I am unsure how your Makefile can work on any system as it does not link in liblua at all. How did you make
make test
work for you?