[luatex] Dynamic loading on Mac OS X

Taco Hoekwater taco at elvenkind.com
Mon Dec 7 13:43:05 CET 2009



Patrick Gundlach wrote:
> Hi,
> 
> I want to try out the (experimental) dynamic library loading on MacOS
> X with luaexpat (http://www.keplerproject.org/luaexpat/). This is
> what I do:
> 
> * compile luaexpat to get a lxp.so.1.1.0, I create a link to lxp.so *
> compile luatex, put the executable into current dir with the name
> texlua * create this file under "foo.lua": "require("lxp")" * run
> texlua: ./texlua foo.lua
> 
> I get this error:
> 
> error loading module 'lxp' from file './lxp.so': dlopen(./lxp.so, 2):
> Symbol not found: _luaL_addlstring Referenced from:
> /Users/patrick/tmp/expattest/lxp.so Expected in: dynamic lookup

The problem here is that lxp.so is using a lua utility function that
is not used by luatex itself. During the luatex linking phase, such
functions are stripped out of the executable, and that leads to the
dynamic lookup error. This sort of thing is one reason why dynamic
loading is experimental.

Not a proper solution, but as a hack, you could try adding

	-Wl,-u -Wl,_luaL_addlstring

to the final compilation line of luatex, perhaps without leading
underscore, if it doesn't work. To do that, do a normal build,
then cd to build/texk/web2c, copy the terminal command line(s) that
starts with ./CXXLD.sh and glue the above in it somewhere at the start.

Best wishes,
Taco




More information about the luatex mailing list