# Problem compiling go for nakama 2.13 go 1.15 plugin was built with a different version of package golang.org/x/crypto/pbkdf2

**URL:** <https://forum.heroiclabs.com/t/problem-compiling-go-for-nakama-2-13-go-1-15-plugin-was-built-with-a-different-version-of-package-golang-org-x-crypto-pbkdf2/1016>\
**Category:** Local Setup\
**Created:** [October 1, 2020, 2:30pm UTC](https://forum.heroiclabs.com/t/problem-compiling-go-for-nakama-2-13-go-1-15-plugin-was-built-with-a-different-version-of-package-golang-org-x-crypto-pbkdf2/1016 "2020-10-01T14:30:57Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![oscargoldman](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/oscargoldman/32/28_2.png) [@oscargoldman](https://forum.heroiclabs.com/u/oscargoldman)\
**Post date:** [October 1, 2020, 2:30pm UTC](https://forum.heroiclabs.com/t/problem-compiling-go-for-nakama-2-13-go-1-15-plugin-was-built-with-a-different-version-of-package-golang-org-x-crypto-pbkdf2/1016/1 "2020-10-01T14:30:57Z")

</div>

Hey guys, having trouble again compiling go for the latest server build 2.13 on linux and mac. Have updated go to 1.15. I have run the mod cache clean and tidy commands as recommended before. Here are the steps we’ve taken:

Delete existing .mod, .sum and .so files.  
env GO111MODULE=on go clean -modcache  
env GO111MODULE=on go mod tidy  
go mod init “go\_source”  
go get -u “[github.com/heroiclabs/nakama-common@v1.7.3](http://github.com/heroiclabs/nakama-common@v1.7.3)”  
go build -buildmode=plugin -trimpath -o ./module.so

These are the packages that get pulled:  
go: finding module for package [github.com/jackc/pgx/v4](http://github.com/jackc/pgx/v4)  
go: downloading [github.com/golang/protobuf](http://github.com/golang/protobuf) v1.3.5  
go: finding module for package [github.com/disintegration/imaging](http://github.com/disintegration/imaging)  
go: downloading [github.com/jackc/pgx](http://github.com/jackc/pgx) v3.6.2+incompatible  
go: downloading [github.com/jackc/pgx/v4](http://github.com/jackc/pgx/v4) v4.9.0  
go: downloading [github.com/disintegration/imaging](http://github.com/disintegration/imaging) v1.6.2  
go: found [github.com/disintegration/imaging](http://github.com/disintegration/imaging) in [github.com/disintegration/imaging](http://github.com/disintegration/imaging) v1.6.2  
go: found [github.com/jackc/pgx/v4](http://github.com/jackc/pgx/v4) in [github.com/jackc/pgx/v4](http://github.com/jackc/pgx/v4) v4.9.0  
go: downloading [golang.org/x/image](http://golang.org/x/image) v0.0.0-20191009234506-e7c1f5e7dbb8  
go: downloading [github.com/jackc/pgproto3](http://github.com/jackc/pgproto3) v1.1.0  
go: downloading [golang.org/x/xerrors](http://golang.org/x/xerrors) v0.0.0-20191204190536-9bdfabe68543  
go: downloading [github.com/jackc/pgtype](http://github.com/jackc/pgtype) v1.5.0  
go: downloading [github.com/jackc/pgconn](http://github.com/jackc/pgconn) v1.7.0  
go: downloading [github.com/jackc/pgio](http://github.com/jackc/pgio) v1.0.0  
go: downloading [github.com/jackc/pgproto3/v2](http://github.com/jackc/pgproto3/v2) v2.0.5  
go: downloading [github.com/jackc/pgservicefile](http://github.com/jackc/pgservicefile) v0.0.0-20200714003250-2b9c44734f2b  
go: downloading [golang.org/x/crypto](http://golang.org/x/crypto) v0.0.0-20200622213623-75b288015ac9  
go: downloading [github.com/jackc/pgpassfile](http://github.com/jackc/pgpassfile) v1.0.0  
go: downloading [golang.org/x/text](http://golang.org/x/text) v0.3.3  
go: downloading [github.com/jackc/chunkreader](http://github.com/jackc/chunkreader) v1.0.0  
go: downloading [github.com/jackc/chunkreader/v2](http://github.com/jackc/chunkreader/v2) v2.0.1

here’s our go env:  
GO111MODULE=""  
GOARCH=“amd64”  
GOBIN=""  
GOCACHE="/home/lyriko/.cache/go-build"  
GOENV="/home/lyriko/.config/go/env"  
GOEXE=""  
GOFLAGS=""  
GOHOSTARCH=“amd64”  
GOHOSTOS=“linux”  
GOINSECURE=""  
GOMODCACHE="/home/lyriko/go/pkg/mod"  
GONOPROXY=""  
GONOSUMDB=""  
GOOS=“linux”  
GOPATH="/home/lyriko/go"  
GOPRIVATE=""  
GOPROXY=“[https://proxy.golang.org](https://proxy.golang.org),direct”  
GOROOT="/usr/local/go"  
GOSUMDB=“[sum.golang.org](http://sum.golang.org)”  
GOTMPDIR=""  
GOTOOLDIR="/usr/local/go/pkg/tool/linux\_amd64"  
GCCGO=“gccgo”  
AR=“ar”  
CC=“gcc”  
CXX=“g++”  
CGO\_ENABLED=“1”  
GOMOD=""  
CGO\_CFLAGS="-g -O2"  
CGO\_CPPFLAGS=""  
CGO\_CXXFLAGS="-g -O2"  
CGO\_FFLAGS="-g -O2"  
CGO\_LDFLAGS="-g -O2"  
PKG\_CONFIG=“pkg-config”  
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build960187612=/tmp/go-build -gno-record-gcc-switches"

Any help or recommendations would be greatly appreciated. Thanks.

---

<div class="post-metadata">

**Author:** ![oscargoldman](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/oscargoldman/32/28_2.png) [@oscargoldman](https://forum.heroiclabs.com/u/oscargoldman)\
**Post date:** [October 1, 2020, 2:34pm UTC](https://forum.heroiclabs.com/t/problem-compiling-go-for-nakama-2-13-go-1-15-plugin-was-built-with-a-different-version-of-package-golang-org-x-crypto-pbkdf2/1016/2 "2020-10-01T14:34:09Z")

</div>

oh, here is the contents of our mod file:  
module go\_source

go 1.15

require (  
[github.com/disintegration/imaging](http://github.com/disintegration/imaging) v1.6.2  
[github.com/heroiclabs/nakama-common](http://github.com/heroiclabs/nakama-common) v1.7.3  
[github.com/jackc/pgx/v4](http://github.com/jackc/pgx/v4) v4.9.0  
)

---

<div class="post-metadata">

**Author:** ![zyro](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/zyro/32/14_2.png) [@zyro](https://forum.heroiclabs.com/u/zyro)\
**Post date:** [October 1, 2020, 2:57pm UTC](https://forum.heroiclabs.com/t/problem-compiling-go-for-nakama-2-13-go-1-15-plugin-was-built-with-a-different-version-of-package-golang-org-x-crypto-pbkdf2/1016/3 "2020-10-01T14:57:13Z")

</div>

From the [2.13.0 release `vendor/modules.txt` file](https://github.com/heroiclabs/nakama/blob/v2.13.0/vendor/modules.txt#L165) the version of the crypto package should be:

```auto
golang.org/x/crypto v0.0.0-20200323165209-0ec3e9974c59

```

Make sure the version matches correctly and it should build fine.

---

<div class="post-metadata">

**Author:** ![novabyte](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/novabyte/32/1324_2.png) [@novabyte](https://forum.heroiclabs.com/u/novabyte)\
**Post date:** [October 1, 2020, 3:19pm UTC](https://forum.heroiclabs.com/t/problem-compiling-go-for-nakama-2-13-go-1-15-plugin-was-built-with-a-different-version-of-package-golang-org-x-crypto-pbkdf2/1016/4 "2020-10-01T15:19:41Z")

</div>

@oscargoldman Also note that it’s important the exact version of the build toolchain you use. Go 1.15.0 is different to Go 1.15.2 (which is the latest). The 2.13.0 release of Nakama was built with the Go 1.15.0 release of the toolchain. These will need to match for the shared object to be loaded without a mismatch in the Go runtime.

---

<div class="post-metadata">

**Author:** ![oscargoldman](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/oscargoldman/32/28_2.png) [@oscargoldman](https://forum.heroiclabs.com/u/oscargoldman)\
**Post date:** [October 1, 2020, 3:24pm UTC](https://forum.heroiclabs.com/t/problem-compiling-go-for-nakama-2-13-go-1-15-plugin-was-built-with-a-different-version-of-package-golang-org-x-crypto-pbkdf2/1016/5 "2020-10-01T15:24:57Z")

</div>

Yeah, we definitely have 1.15.0 installed:  
{“level”:“info”,“ts”:“2020-10-01T08:36:38.967-0600”,“caller”:“v2/main.go:105”,“msg”:“Node”,“name”:“nakama”,“version”:“2.13.0+ec8f5d70”,“runtime”:“go1.15”,“cpu”:1,“proc”:1}  
go version go1.15 linux/amd64  
I noticed that in the nakama source code on master [https://github.com/heroiclabs/nakama/blob/master/go.mod](https://github.com/heroiclabs/nakama/blob/master/go.mod)  
that the crypto package version is the same that we’re getting  
[golang.org/x/crypto](http://golang.org/x/crypto) v0.0.0-20200622213623-75b288015ac9, and not the version that Andrei specified, maybe that’s an update for the next release?  
Can I just add that specific version to our mod file after cleaning the cache? Or how do I specify to grab that version? Thanks for the help guys.

---

<div class="post-metadata">

**Author:** ![oscargoldman](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/oscargoldman/32/28_2.png) [@oscargoldman](https://forum.heroiclabs.com/u/oscargoldman)\
**Post date:** [October 1, 2020, 3:42pm UTC](https://forum.heroiclabs.com/t/problem-compiling-go-for-nakama-2-13-go-1-15-plugin-was-built-with-a-different-version-of-package-golang-org-x-crypto-pbkdf2/1016/6 "2020-10-01T15:42:30Z")

</div>

I have 3 modules.txt files, one in the nakama-common 1.7.3 package that doesn’t specify the crypto package, and 2 others in go installation.  
/usr/local/go/src/cmd/vendor/modules.txt  
/usr/local/go/src/vendor/modules.txt  
The both have the crypto package with the mismatched version, but commented out:  
GNU nano 4.8 /usr/local/go/src/vendor/modules.txt

# [golang.org/x/crypto](http://golang.org/x/crypto) v0.0.0-20200622213623-75b288015ac9

## explicit

[golang.org/x/crypto/chacha20](http://golang.org/x/crypto/chacha20)  
[golang.org/x/crypto/chacha20poly1305](http://golang.org/x/crypto/chacha20poly1305)  
[golang.org/x/crypto/cryptobyte](http://golang.org/x/crypto/cryptobyte)  
[golang.org/x/crypto/cryptobyte/asn1](http://golang.org/x/crypto/cryptobyte/asn1)  
[golang.org/x/crypto/curve25519](http://golang.org/x/crypto/curve25519)  
[golang.org/x/crypto/hkdf](http://golang.org/x/crypto/hkdf)  
[golang.org/x/crypto/internal/subtle](http://golang.org/x/crypto/internal/subtle)  
[golang.org/x/crypto/poly1305](http://golang.org/x/crypto/poly1305)

what’s the best way to correct the version? Thanks again.

---

<div class="post-metadata">

**Author:** ![oscargoldman](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/oscargoldman/32/28_2.png) [@oscargoldman](https://forum.heroiclabs.com/u/oscargoldman)\
**Post date:** [October 1, 2020, 3:53pm UTC](https://forum.heroiclabs.com/t/problem-compiling-go-for-nakama-2-13-go-1-15-plugin-was-built-with-a-different-version-of-package-golang-org-x-crypto-pbkdf2/1016/7 "2020-10-01T15:53:24Z")

</div>

I also noticed that the go.mod file in nakama-commomn@v1.7.3 specifies go 1.13, not sure if that’s related or not.

---

<div class="post-metadata">

**Author:** ![novabyte](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/novabyte/32/1324_2.png) [@novabyte](https://forum.heroiclabs.com/u/novabyte)\
**Post date:** [October 2, 2020, 9:51am UTC](https://forum.heroiclabs.com/t/problem-compiling-go-for-nakama-2-13-go-1-15-plugin-was-built-with-a-different-version-of-package-golang-org-x-crypto-pbkdf2/1016/8 "2020-10-02T09:51:45Z")

</div>

@oscargoldman The master branch of the server is always ahead of the official releases. You should look at the specific release tag as @zyro showed to determine the dependencies within that release:

[GitHub - heroiclabs/nakama at v2.13.0](https://github.com/heroiclabs/nakama/tree/v2.13.0)

> what’s the best way to correct the version? Thanks again.

There’s some other posts on the forum on how to pin transitive dependencies which are different due to minimal version selection. The shortest answer I can give is to create a blank import in your main.go file which specifies the dependency you want to pin:

```auto
import (
    _ "golang.org/x/crypto/pbkdf2"
)

```

This way you can control the dependency version in your modfile.

> I also noticed that the go.mod file in nakama-commomn@v1.7.3 specifies go 1.13, not sure if that’s related or not.

No that’s not relevant. The version information in the modfile simply indicates what version of the Go toolchain was used to create the file it does not indicate the minimum required version of the Go toolchain to perform builds. It’s a source of confusion with Go developers but that version info in the modfile is mostly useless.

Hope this helps.

---

<div class="post-metadata">

**Author:** ![oscargoldman](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/oscargoldman/32/28_2.png) [@oscargoldman](https://forum.heroiclabs.com/u/oscargoldman)\
**Post date:** [October 2, 2020, 6:44pm UTC](https://forum.heroiclabs.com/t/problem-compiling-go-for-nakama-2-13-go-1-15-plugin-was-built-with-a-different-version-of-package-golang-org-x-crypto-pbkdf2/1016/9 "2020-10-02T18:44:28Z")

</div>

Thanks Chris for the help. When you say main.go file, you’re referring to the go source code we’re trying to compile into a shared object? I’ve added the import as you suggested, and now when I build I see that the crypto package is added to the imports in the mod file, only it’s still the wrong version. If I change the version to the required version Andrei specified, it is just reverted each time.

I tried adding the -mod=readonly argument to the build command, but get back  
go: updates to go.mod needed, disabled by -mod=readonly  
and the build fails. Nothing I do seems to stop the crypto package from being the wrong version v0.0.0-20200622213623-75b288015ac9

---

<div class="post-metadata">

**Author:** ![oscargoldman](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/oscargoldman/32/28_2.png) [@oscargoldman](https://forum.heroiclabs.com/u/oscargoldman)\
**Post date:** [October 2, 2020, 7:09pm UTC](https://forum.heroiclabs.com/t/problem-compiling-go-for-nakama-2-13-go-1-15-plugin-was-built-with-a-different-version-of-package-golang-org-x-crypto-pbkdf2/1016/10 "2020-10-02T19:09:18Z")

</div>

OH, I got somewhere. I ran go get [golang.org/x/crypto@v0.0.0-20200323165209-0ec3e9974c59](http://golang.org/x/crypto@v0.0.0-20200323165209-0ec3e9974c59)  
and that seems to have resolved the issue with the pbkdf2 version. now I’m seeing a similar error related to the x/text/transfrom package.

---

<div class="post-metadata">

**Author:** ![oscargoldman](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/oscargoldman/32/28_2.png) [@oscargoldman](https://forum.heroiclabs.com/u/oscargoldman)\
**Post date:** [October 2, 2020, 7:12pm UTC](https://forum.heroiclabs.com/t/problem-compiling-go-for-nakama-2-13-go-1-15-plugin-was-built-with-a-different-version-of-package-golang-org-x-crypto-pbkdf2/1016/11 "2020-10-02T19:12:50Z")

</div>

I checked the text package for the 2.13 release and it needs v0.3.2 and for reasons I don’t understand I was getting version v.0.3.3. I ran go get for that version, changed the mod file, and it’s working!
