Closed giuseppe closed 1 year ago
@valyala PTAL
The Podman team is waiting on this to merge.
@valyala PTAL
@giuseppe , sorry for the delay and thanks for the pull request! I'm unsure this is a good way to go, since it allows building github.com/valyala/gozstd
without cgo
, but the resulting build is unusable - it is just a stub. Probably the approach taken in VictoriaMetrics is better - e.g. to create a wrapper package containing two files:
cgo
is enabled. It imports github.com/valyala/gozstd
cgo
is disabled. It imports github.com/klauspost/compress/zstd
See https://github.com/VictoriaMetrics/VictoriaMetrics/tree/master/lib/encoding/zstd .
We are fine with that. The issue we are seeing when we vendor in your code into a package, it blows up on compile, even if we are not using gozstd in the revendored package.
The issue we are seeing when we vendor in your code into a package, it blows up on compile, even if we are not using gozstd in the revendored package.
This sounds strange, since VictoriaMetrics is successfully built with both CGO_ENABLED=0
and CGO_ENABLED=1
when using the trick described above. Make sure that the github.com/valyala/gozstd
is imported in the file, which compiles only for CGO_ENABLED=1
. See build instructions and this particular section for details.
we have moved from github.com/klauspost/compress to github.com/valyala/gozstd in github.com/containers/storage for performance reasons when pulling container images, but unfortunately we need to support build also on targets where cgo is missing: https://github.com/containers/podman/pull/12794
Without this PR, I get:
now the build works fine
Signed-off-by: Giuseppe Scrivano gscrivan@redhat.com