Skip to content

Instantly share code, notes, and snippets.

@lukego
Created September 20, 2013 08:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lukego/6634948 to your computer and use it in GitHub Desktop.
Save lukego/6634948 to your computer and use it in GitHub Desktop.
LuaJIT bytecode module name (luajit -b -n newname ...) bug report.
#!/bin/bash
cat > main.c <<EOF
#include <lua.h>
#include <lualib.h>
#include <lauxlib.h>
int main(int argc, char** argv) {
lua_State* L = luaL_newstate();
luaL_openlibs(L);
return luaL_dostring(L, "require \"newname\"");
}
EOF
cat > test.lua <<EOF
print "Hello, world!"
EOF
gcc -I$LUAJIT/usr/local/include/luajit-2.1 -c main.c -o main.o
luajit -b -n newname test.lua test.o
gcc -Wl,-E -Werror -Wall -o test main.o test.o $LUAJIT/src/libluajit.a -lc -ldl -lm -lrt -lpthread
./test || echo "Error:" $?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment