golua icon indicating copy to clipboard operation
golua copied to clipboard

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

Open ayoubfaouzi opened this issue 1 year ago • 1 comments

Hello @aarzilli

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

Environment:

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

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.

ayoubfaouzi avatar Jun 08 '24 04:06 ayoubfaouzi

Try removing the -static flag.

aarzilli avatar Jun 08 '24 05:06 aarzilli

That actually worked, thank you @aarzilli .

ayoubfaouzi avatar Nov 01 '24 20:11 ayoubfaouzi