Building go modules to use with test setup on RPI

I am running a test server on raspberry pi. The architecture is arm64 so I use the 3.31.0 version of Nakama. It works fine for my tests. However, now I want to build and use modules written in GO, so I installed Go 1.25.0 (same version that is used for compiling Nakama 3.31.0)

I build the so file from go script using go 1.25.0

Then I put the so file to the data/modules folder.

Now I get the following error while starting Nakama:

nakama_1 | {“level”:“error”,“ts”:“2025-09-15T23:11:42.251Z”,“caller”:“server/runtime_go.go:3052”,“msg”:“Could not open Go module”,“path”:“data/modules/email_plugin.so”,“error”:“plugin.Open(“data/modules/email_plugin”): plugin was built with a different version of package internal/goarch”}
nakama_1 | {“level”:“error”,“ts”:“2025-09-15T23:11:42.252Z”,“caller”:“server/runtime.go:692”,“msg”:“Error initialising Go runtime provider”,“error”:“plugin.Open(“data/modules/email_plugin”): plugin was built with a different version of package internal/goarch”}
nakama_1 | {“level”:“fatal”,“ts”:“2025-09-15T23:11:42.252Z”,“caller”:“main.go:204”,“msg”:“Failed initializing runtime modules”,“error”:“plugin.Open(“data/modules/email_plugin”): plugin was built with a different version of package internal/goarch”}

what is wrong ?

How can I build the plugin ?

maybe someone can share how the nakama 3.31 arm build was made ?

Was it done one a arm64 platform with go 1.25.0 ?

Or was it on a amd64 platform using cross compile to arm64 ?

any useful info for compiling modules to arm64 platform ?

Hi @ilkeraktuna,

In your plugin go.mod, do you have the same Go version as here: nakama/go.mod at v3.31.0 · heroiclabs/nakama · GitHub ?

yes

module email_plugin

go 1.25.0

require v1.41.0

require v1.36.8 // indirect~

Are you building directly on the RPI? Otherwise you’ll have to cross compile for ARM, it’s probably easier if you use Docker if you intend to do so.

I am building on RPI.

I tried both compiling on the host (RPI) and also inside the container. Both have the same result.

I also tried building using a Dockerfile

All 3 have failed with same error message in the log.

I suspect that the RPI ARM ABI is not the same we provide binaries for (ARM64). I think the easiest is to try to build the server from source too on your RPI.

Clone the Nakama repo and checkout v3.31.0 then build it with go build --trimpath --mod=vendor and make sure you build your plugin with:

go build --trimpath --mod=vendor --buildmode=plugin -o ./plugin.so

If this does not work, I’m afraid we cannot provide much assistance as this is not a use-case we’re looking to support officially.

1 Like

is it that easy ?

just download the source and then 1 command to build as you wrote ?

“go build --trimpath --mod=vendor --buildmode=plugin -o ./plugin.so”

how can I put it in docker image then ? I want to run in a container.

Yes, it should be that easy, but this is assuming you’ll run it on the RPI directly. Honestly, I think this would be the easiest solution.

If you plan to run Docker, then as long as you use our provided pluginbuilder workflow you shouldn’t have issues I think, but I’m not certain given that the platform running Docker is on a architecture I have no experience with.

YMMV, and unfortunately as stated previously we cannot provide a lot of support for these non-standard use-cases.

1 Like

thanks. compiled as you suggested and now it works. But seriously, are you considering this as “non-standard use-case“ ?

All I do is running a test server on arm64 platform , which Nakama has an official build for. And then I am trying to compile and use a custom module written in Go. Which part of this is “non-standard” ?

I suspect that the RPI ARM ABI is not the same we provide binaries for (ARM64)

If it was the same ABI, I’d expect our provided ARM64 binaries to work out-of-the-box, so I’d consider this non-standard. Either way, glad you’re up and running.

maybe I was not clear enough.

On my RPI , the default arm64 binary from here works out of the box:

https://hub.docker.com/r/heroiclabs/nakama/tags

I just could not compile a plugin for it.

I see, perhaps then it’s just a case that the Go version used to build the plugin wasn’t the same that was used to build Nakama. If you try to use the specific Go version in the Nakama’s release you’re using go.mod file to also build your plugin then you may not need to also build the server from source.

You can use:

go install golang.org/dl/go1.24.5@latest
go1.24.5 download
go1.24.5 <go cmd> 

to switch between specific go versions.

Either way, using our binaries or building from source by checking out the corresponding release tag are equivalent.

By the way, the official builds are cross-compiled.

I think that was my issue. When using the official build, I was building right on the arm64 architecture. (no cross compile) and it was failing. Then I built the server on same arm64 arch. The problem is gone.