I want to use mongodb driver.But I get the following error:
go.mongodb.org/mongo-driver/vendor/github.com/DataDog/zstd exec: "gcc": executable file not found in %PATH%
I want to use mongodb driver.But I get the following error:
go.mongodb.org/mongo-driver/vendor/github.com/DataDog/zstd exec: "gcc": executable file not found in %PATH%
The issue is that your library depends on gcc to run.
If you are running in a container, you can try two options:
CGO with the following command: RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o yourBinary
gcc into your container. If it is an alpine based container, run RUN apk update && apk add --no-cache gcc
You could also need musl-dev package, but you should try without it first.
Since MacOS and most Linux distros come with GCC, I guess you could be using Windows. In this case, you need to install MinGW.