lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

On 22/03/2005, at 8:56 PM, PA wrote:

On Mar 22, 2005, at 05:18, Peter Colson wrote:

Are there particular options I need to be aware of when building the dynamic library to allow it to load and expose it's init function (I saw something about prepending function names with '_c' or similar).

Mike Pall provided the following incantation to compile modules on Mac OS X:

local CompileCommand = "gcc -O2 -fno-common -c -o"
local LinkCommand = "gcc -bundle -undefined dynamic_lookup -o"

Works like a charm.

Here is a little Lua script I use instead of make to compile stuff on Mac OS X:

The script expects to find a "lubfile" in the directory you are compiling. The "lubfile" is a Lua table with two keys:

"" = the name of the module to build
"object.names" = the source files to compile and link

Attached is an example "lubfile" to compile zlib with its lzlib bindings.


Thanks for the script. I'll try it again once I get my 5.1 build problems sorted. Did note that it gave this error, which I also see when running your commands above directly:

(info) compile: 'gcc -O2 -fno-common -c -o testlua.o testlua.c'
(info) link: 'gcc -bundle -undefined dynamic_lookup -o testlua.o' ld: flag: -undefined dynamic_lookup can't be used with MACOSX_DEPLOYMENT_TARGET environment variable set to: 10.1

I'll look at it some more here, but if it's obvious what's wrong let me know.

Peter Colson.