Go: fatal error: runtime: no plugin module data

I was attempt to build the runtime go plugin WITHOUT DOCKER by following this tutorial on my linux server and the nakama binary runs on this linux server as well.

  1. Nakama version: 3.17.1, Linux binary
  2. Server Framework Runtime language: Go
  3. OS: Ubuntu 20.04.4 LTS
  4. Go version: go1.21.1 linux/amd64
$ go mod init "mm-server"
$ go mod tidy
$ go get -u "github.com/heroiclabs/nakama-common/runtime"
$ go mod vendor

go.mod

module mm-server

go 1.21.1

require github.com/heroiclabs/nakama-common v1.28.1

require google.golang.org/protobuf v1.31.0 // indirect
$ go build -buildmode=plugin -trimpath -o /opt/nakama/data/modules/backend.so

$ nakama --database.address ... --runtime.path /opt/nakama/data/modules/
{"level":"warn","ts":"2023-09-14T07:51:28.465Z","caller":"server/config.go:323","msg":"WARNING: insecure default parameter value, change this for production!","param":"console.username"}
{"level":"warn","ts":"2023-09-14T07:51:28.465Z","caller":"server/config.go:327","msg":"WARNING: insecure default parameter value, change this for production!","param":"console.password"}
{"level":"warn","ts":"2023-09-14T07:51:28.465Z","caller":"server/config.go:331","msg":"WARNING: insecure default parameter value, change this for production!","param":"console.signing_key"}
{"level":"warn","ts":"2023-09-14T07:51:28.465Z","caller":"server/config.go:335","msg":"WARNING: insecure default parameter value, change this for production!","param":"socket.server_key"}
{"level":"warn","ts":"2023-09-14T07:51:28.465Z","caller":"server/config.go:339","msg":"WARNING: insecure default parameter value, change this for production!","param":"session.encryption_key"}
{"level":"warn","ts":"2023-09-14T07:51:28.465Z","caller":"server/config.go:343","msg":"WARNING: insecure default parameter value, change this for production!","param":"session.refresh_encryption_key"}
{"level":"warn","ts":"2023-09-14T07:51:28.465Z","caller":"server/config.go:347","msg":"WARNING: insecure default parameter value, change this for production!","param":"runtime.http_key"}
{"level":"info","ts":"2023-09-14T07:51:28.465Z","caller":"v3/main.go:104","msg":"Nakama starting"}
{"level":"info","ts":"2023-09-14T07:51:28.465Z","caller":"v3/main.go:105","msg":"Node","name":"nakama","version":"3.17.1+258a7f35","runtime":"go1.20.6","cpu":1,"proc":1}
{"level":"info","ts":"2023-09-14T07:51:28.465Z","caller":"v3/main.go:106","msg":"Data directory","path":"/home/user/code/nakama-common/data"}
{"level":"info","ts":"2023-09-14T07:51:28.465Z","caller":"v3/main.go:117","msg":"Database connections","dsns":["root:xxxxx@127.0.0.1:5432"]}
{"level":"info","ts":"2023-09-14T07:51:28.475Z","caller":"v3/main.go:123","msg":"Database information","version":"PostgreSQL 12.16 (Ubuntu 12.16-0ubuntu0.20.04.1) on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0, 64-bit"}
{"level":"info","ts":"2023-09-14T07:51:28.481Z","caller":"server/leaderboard_rank_cache.go:120","msg":"Initializing leaderboard rank cache"}
{"level":"info","ts":"2023-09-14T07:51:28.481Z","caller":"server/runtime.go:628","msg":"Initialising runtime","path":"/opt/nakama/data/modules/"}
{"level":"info","ts":"2023-09-14T07:51:28.481Z","caller":"server/runtime.go:635","msg":"Initialising runtime event queue processor"}
{"level":"info","ts":"2023-09-14T07:51:28.481Z","caller":"server/runtime.go:637","msg":"Runtime event queue processor started","size":65536,"workers":8}
{"level":"warn","ts":"2023-09-14T07:51:28.481Z","caller":"satori/satori.go:64","msg":"Satori configuration invalid: api_key_name not set, api_key not set, signing_key not set."}
{"level":"info","ts":"2023-09-14T07:51:28.482Z","caller":"server/runtime_go.go:2672","msg":"Initialising Go runtime provider","path":"/opt/nakama/data/modules/"}
{"level":"info","ts":"2023-09-14T07:51:28.486Z","caller":"server/leaderboard_rank_cache.go:181","msg":"Leaderboard rank cache initialization completed successfully","cached":[],"skipped":[],"duration":"5.689774ms"}
fatal error: runtime: no plugin module data

goroutine 1 [running]:
runtime.throw({0x1f15e1c?, 0xb1011b?})
        runtime/panic.go:1047 +0x5d fp=0xc0003434d0 sp=0xc0003434a0 pc=0xadcbdd
plugin.lastmoduleinit()
        runtime/plugin.go:20 +0x8b0 fp=0xc0003435b8 sp=0xc0003434d0 pc=0xb0ff50
plugin.open({0xc000044660, 0x23})
        plugin/plugin_dlopen.go:77 +0x3ef fp=0xc000343828 sp=0xc0003435b8 pc=0x14ff8ef
plugin.Open(...)
        plugin/plugin.go:80
github.com/heroiclabs/nakama/v3/server.openGoModule(0xc000044680?, {0x7ffd85f95723?, 0x0?}, {0xc000044660, 0x23})
        github.com/heroiclabs/nakama/v3/server/runtime_go.go:2766 +0x13b fp=0xc000343a38 sp=0xc000343828 pc=0x198333b
github.com/heroiclabs/nakama/v3/server.NewRuntimeProviderGo({_, _}, _, _, _, _, {_, _}, {0x26a7704, 0x6}, ...)
        github.com/heroiclabs/nakama/v3/server/runtime_go.go:2682 +0xba5 fp=0xc000343d68 sp=0xc000343a38 pc=0x1981865
github.com/heroiclabs/nakama/v3/server.NewRuntime({0x26c0950, 0xc0003d66e0}, 0xc0003f03f0?, 0xc0003f03f0?, _, _, _, {_, _}, {0x26a7704, ...}, ...)
        github.com/heroiclabs/nakama/v3/server/runtime.go:641 +0x696 fp=0xc00034d708 sp=0xc000343d68 pc=0x19213d6
main.main()
        github.com/heroiclabs/nakama/v3/main.go:154 +0x18ec fp=0xc00034df80 sp=0xc00034d708 pc=0x1b75c0c
runtime.main()
        runtime/proc.go:250 +0x207 fp=0xc00034dfe0 sp=0xc00034df80 pc=0xadf827
runtime.goexit()
        runtime/asm_amd64.s:1598 +0x1 fp=0xc00034dfe8 sp=0xc00034dfe0 pc=0xb15721

...

Problem solved by rebuild the plugin with Go version 1.20.8