[tex-live] somewhat broken macOS binaries (was: Stripping LuaTeX with "strip -u -r" to allow loading modules)

Patrick Gundlach patrick at gundla.ch
Sun Apr 23 11:53:55 CEST 2017

Hi all,

I finally have a small test file to try it out:

this is the file lib.c:
#include <lua.h>
#include <lualib.h>
#include <lauxlib.h>
#include <stdlib.h>
#include <stdio.h>

static int testfunc (lua_State *L)
  const char* str = "Hello world!";
  lua_pushstring(L, str);
  return 1;

int luaopen_foo_lib(lua_State *L) {
  struct luaL_Reg myfuncs[] = {
    {"testfunc", testfunc},
    {NULL, NULL},
  lua_newtable (L);
  luaL_setfuncs (L, myfuncs, 0);
  return 1;

and this is the LaTeX file:

foolib = require("foo.lib")


The instruction to build on macOS is:

cc -c  lib.c -I /opt/homebrew/Cellar/lua/5.2.4_1/include/
cc -flat_namespace -bundle -undefined suppress -o lib.so lib.o

(adjust the path to the Lua header files)

and then copy the result into a directory "foo" relative to the TeX test file above:

cp lib.so <path to test.tex>/foo/lib.so

Now lualatex test.tex should print a "Hello world" to the console:

Hello world! (./test.aux))
 360 words of node memory still in use:
   2 hlist, 1 vlist, 1 rule, 2 glue, 4 attribute, 45 glue_spec, 4 attribute_lis
t, 2 write nodes
   avail lists: 2:7,3:1,4:1,5:5,7:1,8:1,9:1

Now: this does not work on my machine using the tl2017 binary, but with a self compiled binary from the LuaTeX source. 

It looks to me as if it _not_ a matter of stripped / not stripped but something different, which I have still no idea what it could be.


(the lib.so is available at http://download.speedata.de/private/lib.so with a MD5 of 9ce2444145108511b2f678b4d22bd777)

More information about the tex-live mailing list