lua-users home
lua-l archive

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


On Thu, Mar 15, 2007 at 01:21:32PM -0700, Wesley Smith wrote:
> Thanks.  I should have replied to myself earlier.  Indeed I got it to
> build with similar options.  I also have an xcode project that uses
> the bundle template and runs a custom build script that sheds the
> bundle folder structure, just giving the binary  file.  When I use
> this project, things work great when the binary is loaded by a
> particular Carbon application, but when I rty to load the same bundle
> from the command-line Lua or other Carbon applications, I get the
> double free errors I described earlier.  I still don't fully
> inderstand how dyld works on OSX, but if I build the binary using the
> options you suggested on the command line, things works fine and I
> don't have any double free errors.  Wierd!

It should be possible to see what the commands Xcode is running to build
the bundle. Can you find them?

I've a suggestion, I wonder if the lpeg.so bundle you built with Xcode
have the lua runtime (liblua.a) linked into it? And if your app does,
too? If the same code is linked into your app in several places, it
might cause this kind of strangeness.

Have you seen the advice on building lua modules on OS X here:

  http://lua-users.org/wiki/BuildingModules

Particularly the advice at the end under the heading

  Do Not Link Modules to the Lua Core Libraries

Cheers,
Sam

> On 3/15/07, Roberto Ierusalimschy <roberto@inf.puc-rio.br> wrote:
> >> Has anyone built lpeg for OSX?  My builds are giving me massive double
> >> free/malloc errors for some reason.
> >
> >I (just) did. It worked OK, with the following options:
> >
> >export MACOSX_DEPLOYMENT_TARGET=10.3
> >gcc -I../.. -Wall -O2 -bundle -undefined dynamic_lookup -o  lpeg.so lpeg.c
> >
> >-- Roberto
> >