Errors loading Go module into Nakama on Mac

We ran into this issue before, and it somehow fixed itself after repeatedly trying, but now doesn’t seem to want to work. We have our dev environment running on a mac mini, we’re using the mac binary of nakama v 2.8.0. Compiling our go source code for linux for our production environment using the docker build tool works as expected and loads into Nakama. On mac though, using the same docker tool - the module compiles fine without any errors, but will not load into nakama. We get the following errors:
{“level”:“error”,“ts”:“2019-12-19T09:40:22.152-0500”,“msg”:“Could not open Go module”,“path”:"/Users/Shared/Jenkins/nakama_server/data/modules/go_source/module.so",“error”:“plugin.Open(”/Users/Shared/Jenkins/nakama_server/data/modules/go_source/module.so"): dlopen(/Users/Shared/Jenkins/nakama_server/data/modules/go_source/module.so, 10): no suitable image found. Did find:\n\t/Users/Shared/Jenkins/nakama_server/data/modules/go_source/module.so: unknown file type, first eight bytes: 0x7F 0x45 0x4C 0x46 0x02 0x01 0x01 0x00\n\t/Users/Shared/Jenkins/nakama_server/data/modules/go_source/module.so: stat() failed with errno=60",“stacktrace”:“github.com/heroiclabs/nakama/v2/server.openGoModule\n\tgithub.com/heroiclabs/nakama/v2@/server/runtime_go.go:1944\ngithub.com/heroiclabs/nakama/v2/server.NewRuntimeProviderGo\n\tgithub.com/heroiclabs/nakama/v2@/server/runtime_go.go:1858\ngithub.com/heroiclabs/nakama/v2/server.NewRuntime\n\tgithub.com/heroiclabs/nakama/v2@/server/runtime.go:448\nmain.main\n\tgithub.com/heroiclabs/nakama/v2@/main.go:130\nruntime.main\n\truntime/proc.go:203”}

{“level”:“error”,“ts”:“2019-12-19T09:40:22.153-0500”,“msg”:“Error initialising Go runtime provider”,“error”:“plugin.Open(”/Users/Shared/Jenkins/nakama_server/data/modules/go_source/module.so"): dlopen(/Users/Shared/Jenkins/nakama_server/data/modules/go_source/module.so, 10): no suitable image found. Did find:\n\t/Users/Shared/Jenkins/nakama_server/data/modules/go_source/module.so: unknown file type, first eight bytes: 0x7F 0x45 0x4C 0x46 0x02 0x01 0x01 0x00\n\t/Users/Shared/Jenkins/nakama_server/data/modules/go_source/module.so: stat() failed with errno=60",“stacktrace”:“github.com/heroiclabs/nakama/v2/server.NewRuntime\n\tgithub.com/heroiclabs/nakama/v2@/server/runtime.go:450\nmain.main\n\tgithub.com/heroiclabs/nakama/v2@/main.go:130\nruntime.main\n\truntime/proc.go:203”}

{“level”:“fatal”,“ts”:“2019-12-19T09:40:22.153-0500”,“msg”:“Failed initializing runtime modules”,“error”:“plugin.Open(”/Users/Shared/Jenkins/nakama_server/data/modules/go_source/module.so"): dlopen(/Users/Shared/Jenkins/nakama_server/data/modules/go_source/module.so, 10): no suitable image found. Did find:\n\t/Users/Shared/Jenkins/nakama_server/data/modules/go_source/module.so: unknown file type, first eight bytes: 0x7F 0x45 0x4C 0x46 0x02 0x01 0x01 0x00\n\t/Users/Shared/Jenkins/nakama_server/data/modules/go_source/module.so: stat() failed with errno=60",“stacktrace”:“main.main\n\tgithub.com/heroiclabs/nakama/v2@/main.go:132\nruntime.main\n\truntime/proc.go:203”}

We are using the same steps as outlined in the documentation. We have go v 1.13.4 installed, and run
go mod init “go_source”
go get -u “github.com/heroiclabs/nakama-common@v1.2.0
and
docker run --rm -w “/builder” -v “${PWD}:/builder” heroiclabs/nakama-pluginbuilder:2.8.0 build -buildmode=plugin -trimpath -o ./module.so

Any ideas on why the .so won’t load into nakama? Thanks in advance.

Just to clarify: you’ve built the plugin using the docker nakama-pluginbuilder and are attempting to load it into a native macOS binary build of Nakama? If this is the case then it will never work, and I think this has been discussed in previous forum posts.

Shared objects will only work on the platform and architecture they’re built for. This is not something Nakama has decided, it’s a consequence of platform/architecture differences.

If you run a macOS Nakama binary, the plugin has to be built on macOS. If you run a Linux x86-64 Nakama binary, the plugin has to be built on Linux x86-64.

Oh I missed the bit in that post that specified that the nakama-pluginbuilder generates a Linux based go module. I thought it generated it based on the platform the docker tool was being run on. OK, so we need to use the native go took chain to produce the plugin for mac os binary. Hmm I don’t recall doing this before and we had this module running in our dev environment, but we’ll check it out - thanks!