[luatex] Dynamic loading on Mac OS X
luigi.scarso at gmail.com
Mon Dec 7 15:58:14 CET 2009
On Mon, Dec 7, 2009 at 1:43 PM, Taco Hoekwater <taco at elvenkind.com> wrote:
> Patrick Gundlach wrote:
>> 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,
Undefined symbol is also managed directly by gcc
You can also use
Pretend the symbol SYMBOL is undefined, to force linking of
library modules to define it. You can use `-u' multiple times with
different symbols to force loading of additional library modules.
is the way to pass the -u option to the linker ld
Force symbol to be entered in the output file as an undefined symbol.
Doing this may, for example, trigger linking of additional modules
from standard libraries. -u may be repeated with different option
arguments to enter additional undefined symbols. This option is
equivalent to the "EXTERN" linker script command.
I think that these are the same
but I prefear the last.
More information about the luatex