-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to build using CGO_ENABLED=0 flag #12
Comments
@kidambisrinivas I am struggling with the same problem. Did you maybe find another solution? I'm trying to build this for aws Lambda, in a Serverless environment, so it cannot use any outside c functions. |
@dikki0 I was mostly interested in support for
The |
Thanks for your answer. |
For anyone who comes across this later, I've made a CGo-free port of pcre2 at go.arsenm.dev/pcre. It does not build on Windows, but works on Linux and macOS (both Intel and M1). |
How do we build a service using this library with CGO_ENABLED=0
Typically I build using this command:
CGO_ENABLED=0 GOOS=linux go build ./cmd/test_scripts
I got this error: go build github.com/myuser/myservice/vendor/github.com/glenn-brown/golang-pkg-pcre/src/pkg/pcre: build constraints exclude all Go files in /home/myuser/gocode/src/github.com/myuser/myservice/vendor/github.com/glenn-brown/golang-pkg-pcre/src/pkg/pcre
I tried this, but still get the same error
CGO_ENABLED=0 CGO_LDFLAGS="-lpcre" CGO_CFLAGS="-I/usr/lib/x86_64-linux-gnu" GOOS=linux go build -ldflags="-lpcre" -gcflags="-I/usr/lib/x86_64-linux-gnu" ./cmd/test_scripts
The text was updated successfully, but these errors were encountered: