lua-users home
lua-l archive

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

Josh Haberman <jhaberman <at>> writes:
> This leads me to believe that it's got to be something about how I'm
> building the extension.  But what?  My build/link line is:
>   gcc -std=c99 -Isrc -Itests -I. -Wall -Wextra -Wno-missing-field-initializers 
>   -I/usr/include/lua5.1 -fpic -shared -o lang_ext/lua/ lang_ext/lua/upb.c
>   src/libupb_pic.a -L/usr/local/lib -llua
> Maybe I shouldn't be linking against Lua at this point -- since the lua
> binary is already linked against it, maybe I'm loading Lua twice as Luiz
> suggested.  But if I don't link against Lua at this point I get undefined
> reference errors (even though I'm compiling with -shared).

Ok, I added "-undefined dynamic_lookup" to the link line and removed
-llua and now everything works fine.  I'll update the wiki page:

Currently it suggests that building on OSX is the same as on Linux GCC,
but OS X has the unique requirement that you pass:

  -undefined dynamic_lookup

...even when you're compiling with -shared, which Linux does not.