Skip to content
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

Docker image does not support CGO_ENABLED on Mac #65

Open
javaducky opened this issue Apr 11, 2023 · 2 comments
Open

Docker image does not support CGO_ENABLED on Mac #65

javaducky opened this issue Apr 11, 2023 · 2 comments
Labels
help wanted Extra attention is needed

Comments

@javaducky
Copy link
Contributor

Some extensions depend on libraries written in C, requiring the CGO_ENABLED=1 environment setting. An example is xk6-sql to support using SQLite3 databases. The preference, of course, would be for extensions to utilize pure-Go libraries strictly, but this will not always be the case.

We need the xk6 builder image to allow for the CGO runtime.

@imiric
Copy link
Contributor

imiric commented Apr 11, 2023

The golang image the grafana/xk6 image is based on already has gcc installed.

So to compile a binary that requires cgo, you only need to set CGO_ENABLED=1 in the container.

E.g. this works for xk6-sql:

docker run --rm -it -u "$(id -u):$(id -g)" -v "${PWD}:/xk6" -e CGO_ENABLED=1 grafana/xk6 build \
  --with github.com/grafana/xk6-sql

@imiric imiric closed this as not planned Won't fix, can't repro, duplicate, stale Apr 11, 2023
@javaducky javaducky reopened this Apr 11, 2023
@javaducky
Copy link
Contributor Author

This may then be an issue on Mac.

image

@javaducky javaducky changed the title Docker image does not support CGO_ENABLED Docker image does not support CGO_ENABLED on Mac Apr 11, 2023
@imiric imiric added the help wanted Extra attention is needed label Apr 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants