Why nakama cannot load so modules?

Hello, I’m working on my strategy game project and i wanted to use Nakama for my game server for its stability and ease of use. I followed Nakama’s “getting started” tutorial to install the server without docker, then i wrote (copied, actually) the source code from the site and compiled it into a shared object using WSL (I’m working on windows), but, once i run the server (still in WSL), it fails loading the shared object (it’s located at .\data\modules; Here’s the error code

  1. Versions: Nakama 3.17, Windows binary, {client library (SDK) and version}
  2. Server Framework Runtime language Go
{"level":"warn","ts":"2023-10-19T16:03:13.170+0200","caller":"server/config.go:323","msg":"WARNING: insecure default parameter value, change this for production!","param":"console.username"}
{"level":"warn","ts":"2023-10-19T16:03:13.176+0200","caller":"server/config.go:327","msg":"WARNING: insecure default parameter value, change this for production!","param":"console.password"}
{"level":"warn","ts":"2023-10-19T16:03:13.176+0200","caller":"server/config.go:331","msg":"WARNING: insecure default parameter value, change this for production!","param":"console.signing_key"}
{"level":"warn","ts":"2023-10-19T16:03:13.176+0200","caller":"server/config.go:335","msg":"WARNING: insecure default parameter value, change this for production!","param":"socket.server_key"}
{"level":"warn","ts":"2023-10-19T16:03:13.176+0200","caller":"server/config.go:339","msg":"WARNING: insecure default parameter value, change this for production!","param":"session.encryption_key"}
{"level":"warn","ts":"2023-10-19T16:03:13.176+0200","caller":"server/config.go:343","msg":"WARNING: insecure default parameter value, change this for production!","param":"session.refresh_encryption_key"}
{"level":"warn","ts":"2023-10-19T16:03:13.176+0200","caller":"server/config.go:347","msg":"WARNING: insecure default parameter value, change this for production!","param":"runtime.http_key"}
{"level":"info","ts":"2023-10-19T16:03:13.176+0200","caller":"v3/main.go:104","msg":"Nakama starting"}
{"level":"info","ts":"2023-10-19T16:03:13.176+0200","caller":"v3/main.go:105","msg":"Node","name":"nakama","version":"3.17.1+258a7f35","runtime":"go1.20.6","cpu":12,"proc":12}
{"level":"info","ts":"2023-10-19T16:03:13.176+0200","caller":"v3/main.go:106","msg":"Data directory","path":"/mnt/c/Users/Gabry/Desktop/GoServer/data"}
{"level":"info","ts":"2023-10-19T16:03:13.176+0200","caller":"v3/main.go:117","msg":"Database connections","dsns":["postgres:xxxxx@127.0.0.1:5432"]}
{"level":"info","ts":"2023-10-19T16:03:13.233+0200","caller":"v3/main.go:123","msg":"Database information","version":"PostgreSQL 14.9 (Ubuntu 14.9-0ubuntu0.22.04.1) on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0, 64-bit"}
{"level":"info","ts":"2023-10-19T16:03:13.282+0200","caller":"server/leaderboard_rank_cache.go:120","msg":"Initializing leaderboard rank cache"}
{"level":"info","ts":"2023-10-19T16:03:13.289+0200","caller":"server/leaderboard_rank_cache.go:181","msg":"Leaderboard rank cache initialization completed successfully","cached":[],"skipped":[],"duration":"7.319362ms"}
{"level":"info","ts":"2023-10-19T16:03:13.299+0200","caller":"server/runtime.go:628","msg":"Initialising runtime","path":"/mnt/c/Users/Gabry/Desktop/GoServer/data/modules"}
{"level":"info","ts":"2023-10-19T16:03:13.307+0200","caller":"server/runtime.go:635","msg":"Initialising runtime event queue processor"}
{"level":"info","ts":"2023-10-19T16:03:13.307+0200","caller":"server/runtime.go:637","msg":"Runtime event queue processor started","size":65536,"workers":8}
{"level":"warn","ts":"2023-10-19T16:03:13.317+0200","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-10-19T16:03:13.321+0200","caller":"server/runtime_go.go:2672","msg":"Initialising Go runtime provider","path":"/mnt/c/Users/Gabry/Desktop/GoServer/data/modules"}
fatal error: runtime: no plugin module data

Thanks for the support, i really appreciate it.

Hello @Gabrylinux,

What is the build command you’re using to build the shared object?

1 Like

Thanks for the reply :heart_eyes:
I used this command in the same folder where main.go is located.
go build --trimpath --mod=vendor --buildmode=plugin -o ./backend.so

and then i moved the “backend.so” file into ./data/modules.

Your approach looks correct, I don’t know if this could be an issue with Windows or WSL. Perhaps it’s a permission issue with the compiled .so?

As far as I know Go plugins are not well supported on Windows but I can’t say whether that extends to the Linux subsystem or not.

I’d suggest you follow our guide to use Docker and try to compile and run the files using that.

Hope this helps.