golua icon indicating copy to clipboard operation
golua copied to clipboard

cjson.so: undefined symbol: `lua_checkstack`

Open ayoubfaouzi opened this issue 1 year ago • 2 comments

Hello @aarzilli

Environment:

  • Golang: 1.23
  • Lua: 5.4.6
  • golua: last version

I am building a static go binary with the following command:

go build -tags "luaa lua54 yara_static" -o behavior-svc  cmd/behavior/behavior.go

Compilation works fine, except that when my Lua file try to require a module (require 'rapidjson' or lua-cjson that I installed via luarocks, it fails with:

{"level":"error","ts":1730523563.6323617,"caller":"behavior/behavior.go:41","msg":"failed to run the server: error loading module 'cjson' from file 'cjson.so' undefined symbol: lua_checkstack",}

Running the lua script though lua interpreter directly works fine.

Do you know why this is failing ?

Cheers.

ayoubfaouzi avatar Nov 02 '24 05:11 ayoubfaouzi

Presumably the linker is picking up a static build of lua (as in libluasomething.a).

aarzilli avatar Nov 02 '24 06:11 aarzilli

Just some context: It used to work in go v1.20, when I upgraded to v1.23, I started seeing this issue.

ayoubfaouzi avatar Nov 02 '24 20:11 ayoubfaouzi