[luatex] Using a Lua C .so module with LuaLaTeX

Deepak Jois deepak.jois at gmail.com
Mon Nov 16 18:22:06 CET 2015


On Mon, Nov 16, 2015 at 9:44 PM, luigi scarso <luigi.scarso at gmail.com> wrote:
>
> CC=gcc
> L=$SVN/trunk/source/libs/lua52/lua-5.2.4/src
> rm -rf *.o *.la *.lo .libs/
> $CC -O2 -fpic -I$L -c harfbuzz.c
> $CC -O -shared -fpic -o harfbuzz.so harfbuzz.o
> $SVN/bin/luatex -luaonly test.lua
>

Looks like things work fine on Linux. I tried again on OS X, using
exactly the commands you are using, but with two modifications:

* As listed on http://lua-users.org/wiki/BuildingModules for OS X:
“However, unlike GCC on other platforms, you must still link with the
option '-undefined dynamic_lookup' to avoid getting undefined
references to liblua”

* I seem to have luatex inside $SVN/trunk/build/texk/web2c/ instead of
$SVN/trunk/bin, so I changed that

> cat compile.sh
CC=gcc
SVN=/Users/deepak/code/personal
L=$SVN/trunk/source/libs/lua52/lua-5.2.4/src
rm -rf *.o *.la *.lo .libs/
$CC -O2 -fpic -c harfbuzz.c
$CC -O -shared -fpic -undefined dynamic_lookup -o harfbuzz.so harfbuzz.o
$SVN/trunk/build/texk/web2c/luatex -luaonly test.lua

> ./compile.sh
error loading module 'harfbuzz' from file './harfbuzz.so':
        dlopen(./harfbuzz.so, 6): Symbol not found: _luaL_setfuncs
  Referenced from: ./harfbuzz.so
  Expected in: flat namespace
 in ./harfbuzz.so

However with my standard Lua installation on OS X, I get the expected result:

> which lua
/usr/local/bin/lua

> lua test.lua
Deepak



More information about the luatex mailing list