aarzilli / golua

Go bindings for Lua C API - in progress
MIT License
651 stars 160 forks source link

cjson.so: undefined symbol: `lua_checkstack` #117

Open ayoubfaouzi opened 3 weeks ago

ayoubfaouzi commented 3 weeks ago

Hello @aarzilli

Environment:

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.

aarzilli commented 3 weeks ago

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

ayoubfaouzi commented 2 weeks ago

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