aarzilli / golua

Go bindings for Lua C API - in progress
MIT License
645 stars 161 forks source link

Dynamic loading not supported when trying to require("module.so") #112

Closed LordNoteworthy closed 1 week ago

LordNoteworthy commented 5 months ago

Hello @aarzilli

Thanks a lot for your work to create a go binding for lua C APIs.

Environment:

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

go build  -ldflags '-extldflags "-static"' -tags "luaa lua54 yara_static" -o app main.go

Compilation works fine, except that when my Lua file try to require a module (require 'rapidjson' that I installed via luarocks, it fails with: `error loading module 'rapidjson' from file '/where/lib/was/built/rapidjson.so':\n\tDynamic loading not supported".

Do you know why this is failing ?

Cheers.

aarzilli commented 5 months ago

Try removing the -static flag.

LordNoteworthy commented 1 week ago

That actually worked, thank you @aarzilli .