lua-users home
lua-l archive

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


Wow ! It worked.
Can I ask how I was suppose to know something like that? Is it a well
known bug/trick/idiom for building things on Mac OS X? I think I will
try to do the same with the other Lua libraries I built.

Very much thanks anyway. I hope this will help other non C programers
and/or compilation gurus or whatever like me.

-- Cédric



On Wed, Aug 4, 2010 at 15:32, Thomas Harning Jr. <harningt@gmail.com> wrote:
> On Wed, Aug 4, 2010 at 9:20 AM, Cedric Mauclair
> <cedric.mauclair@gmail.com> wrote:
>> In my libs directory, I have a liblua.a  (which is a static library if
>> I understand correctly). I used the following to compile LPeg library:
>>
>> gcc -Wall -Wextra -pedantic -Waggregate-return -Wbad-function-cast
>> -Wcast-align -Wcast-qual -Wdeclaration-after-statement
>> -Wdisabled-optimization -Wmissing-prototypes -Wnested-externs
>> -Wpointer-arith -Wshadow -Wsign-compare -Wstrict-prototypes -Wundef
>> -Wwrite-strings  -O2 -DNDEBUG -ansi -I/opt/include   -c -o lpeg.o
>> lpeg.c
>>
>> gcc -shared  -L/opt/lib -llua lpeg.o -o lpeg.so
> You need to use
> gcc -bundle -undefined dynamic_lookup -o lpeg.so lpeg.o
>
> for Mac OSX to safely work.  The -undefined dynamic_lookup makes it
> search the namespace of the current process for undefined symbols.
> --
> Thomas Harning Jr.
>