lua-users home
lua-l archive

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



El 05/02/2005, a las 23:43, Vijay Aswadhati escribió:



-----Original Message-----
From: lua-bounces@bazar2.conectiva.com.br [mailto:lua-
bounces@bazar2.conectiva.com.br] On Behalf Of PA
Sent: Saturday, February 05, 2005 4:24 AM
To: Lua list
Subject: Re: coroutine & busy wait?

I tried to follow Luiz's instruction at "Installing my Lua Libraries":

http://www.tecgraf.puc-rio.br/~lhf/ftp/lua/install.html

... but without much success so far:

% make
cc -I/usr/local/include -ansi -pedantic -Wall -O2    -c -o lalarm.o
lalarm.c
cc -o lalarm.so -shared lalarm.o
cc: unrecognized option `-shared'
ld: Undefined symbols:
_main
_lua_call
_lua_error
_lua_gethook
_lua_gethookmask
_lua_gettable
_lua_gettop
_lua_pushcclosure
_lua_pushlstring
_lua_pushnil
_lua_pushnumber
_lua_pushvalue
_lua_setfield
_lua_sethook
_lua_settable
_lua_tonumber
_lua_type
make: *** [lalarm.so] Error 1

Does anyone has a make file for Mac OS X?

For the record, I'm using lua-5.1-work4 on Mac OS X 10.3.7.

I am bit rusty with *nix these days as I have been working on WinXP. FWIW, these errors indicate that the linker is unable to find the Lua library.
Check the manual for a "-L" option to tell the linker where to look for
libraries and "-l" option to specify the library for static linking (as in a
*lib.a archive, I think).

That's right. Libraries in MacOS X cannot have undefined symbols (but they can be unresolved and then resolved when the library is loaded, of course), that's the reason why you need to link to the Lua libraries. Or, if you're compiling a loadable module (i.e: you want to load it with loadlib()), you can specify which is the executable that will load the module, and symbols will be resolved from there, too. Just the last bit: -shared won't work on OSX because it distinguishes libraries vs- bundles (aka modules), sou you will end linking with:

  $ gcc -bundle -llua -llualib -L/path/to/lualibsdir -o whatever.so *.o

or:

$ gcc -bundle -Wl,-executable_name,/path/to/luabinary -o whatever.so *.o

Happy coding!

--
Adrian Perez
GPUL/CLUG member » http://gpul.org
Keyboard Error: Press F1 to resume.

Attachment: PGP.sig
Description: Mensaje firmado digitalmente