[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: bus error on MacOS Snow Leopard in Lua->C->Lua callback
- From: Diab Jerius <dj@...>
- Date: Thu, 15 Sep 2011 00:39:03 -0400
On Thu, 2011-09-15 at 15:07 +1200, Geoff Leyland wrote:
> On 15/09/2011, at 2:52 PM, Diab Jerius wrote:
>
> > This code is so simple I must be doing something obviously wrong. Would
> > someone please point out my error?
>
> I'm not sure I can point out the right error, but
> - I don't think you need to link against liblua for either platform
> (and a possible problem is your module getting linked to two separate
> copies of Lua)
> - for OS X, you'll need to link with -undefined dynamic_lookup
BINGO! Removing the link against the lua library and adding the
-undefined dynamic lookup did the trick. I'm using libtool to
perform the linking and it originally had that flag in there; I
inadvertently removed it when trying to isolate the problem.
The working link command is
gcc -Wl,-undefined -Wl,dynamic_lookup -bundle -o ifc.so ifc.o
> - I don't think you need -ldl any more on OS X (What version is it?)
It's 10.6. The -ldl came from libtool when I instructed it to link
against liblua. After I stopped doing that the -ldl disappeared.
> - I think you can use -fPIC on OS X
I have it in there (in any case, the gcc documentation indicates it's
the default on Darwin & Mac OS X).
Thanks very much for your help!
Diab