Open javaducky opened 1 year ago
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
This may then be an issue on Mac.
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.