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: [mailto:lua-] 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":

... but without much success so far:

% make
cc -I/usr/local/include -ansi -pedantic -Wall -O2    -c -o lalarm.o
cc -o -shared lalarm.o
cc: unrecognized option `-shared'
ld: Undefined symbols:
make: *** [] 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 *.o


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

Happy coding!

Adrian Perez
GPUL/CLUG member »
Keyboard Error: Press F1 to resume.

Attachment: PGP.sig
Description: Mensaje firmado digitalmente