[GODRIVER-2164] Unable to use go install with mongo driver for Go 1.17 onwards Created: 26/Sep/21  Updated: 28/Oct/23  Resolved: 30/Sep/21

Status: Closed
Project: Go Driver
Component/s: None
Affects Version/s: None
Fix Version/s: 1.7.3

Type: Bug Priority: Blocker - P1
Reporter: Mukul N/A Assignee: Benji Rewis (Inactive)
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: File mongoSample.go    
Backwards Compatibility: Fully Compatible
Documentation Changes: Not Needed

 Description   

I am trying to run the following command on my Linux machine before building my binary for the code that is shown below.

The command I ran:

```

go install -linkshared -buildmode=shared
go.mongodb.org/mongo-driver/bson/ go.mongodb.org/mongo-driver/event/ go.mongodb.org/mongo-driver/mongo/options

```

Since go 1.17+ I am not able to run the above command, as I always get the following error. I can't seem to understand what this error actually means and I am stuck at this.

 

Error:

```

  1. go.mongodb.org/mongo-driver/vendor/github.com/klauspost/compress/zstd/internal/xxhash# go.mongodb.org/mongo-driver/vendor/github.com/klauspost/compress/zstd/internal/xxhashasm: xxhash_amd64.s:120: when dynamic linking, R15 is clobbered by a global variable access and is used here: 00092 (/usr/local/go/src/go.mongodb.org/mongo-driver/vendor/github.com/klauspost/compress/zstd/internal/xxhash/xxhash_amd64.s:120) ADDQ R15, AXasm: assembly failed

```

 

The code I want to build is attached here.



 Comments   
Comment by Benji Rewis (Inactive) [ 30/Sep/21 ]

The updated dependency should be available in the upcoming version 1.7.3 of the Go driver, subhanshu.25197@gmail.com. Until then, you can always specify v1.13.6 of klauspost/compress in your own go.mod to avoid the dynamic linking error.

Comment by Githook User [ 30/Sep/21 ]

Author:

{'name': 'Benjamin Rewis', 'email': '32186188+benjirewis@users.noreply.github.com', 'username': 'benjirewis'}

Message: GODRIVER-2164 Upgrade klauspost/compress dependency (#759)
Branch: release/1.7
https://github.com/mongodb/mongo-go-driver/commit/34a4b6d5e1292b9a84db756b91d8d7fc4e357c05

Comment by Githook User [ 30/Sep/21 ]

Author:

{'name': 'Benjamin Rewis', 'email': '32186188+benjirewis@users.noreply.github.com', 'username': 'benjirewis'}

Message: GODRIVER-2164 Upgrade klauspost/compress dependency (#759)
Branch: master
https://github.com/mongodb/mongo-go-driver/commit/2dee703bff5677f26bd89c3fba51b84e73f10482

Comment by Benji Rewis (Inactive) [ 28/Sep/21 ]

Thanks again for your report subhanshu.25197@gmail.com.

This is a bug in one of our dependencies: klauspost/compress. The bug was fixed in v1.13.6 (the latest version) of klauspost/compress, so we'll just have to update our dependency. That should fix your build error.

Here's a PR to do so: https://github.com/mongodb/mongo-go-driver/pull/759

Comment by Mukul N/A [ 28/Sep/21 ]

Even while trying to build the application using go build I am getting the same error. 

Comment by Benji Rewis (Inactive) [ 28/Sep/21 ]

Thanks for your bug report subhanshu.25197@gmail.com! We're taking a look now.

Generated at Thu Feb 08 08:37:57 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.