-
Notifications
You must be signed in to change notification settings - Fork 661
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
With go 1.9.4, static build of applications fails with "invalid pkg-config package name: --static" #137
Comments
We'll have to wait for Golang to be updated to allow the -static flag (mentioned on the referenced issues). |
Building of confluent-kafka-go is currently broken on go v1.9.4 which is currently shipping with alpine:edge [1]. This switches the image build to alpine:3.7 which does now have this problem, however we may run into issues upgrading to later versions if confluent-kafka-go doesn't find a workaround for the underlying problem. [1] confluentinc/confluent-kafka-go#137 Signed-off-by: Tim Buckley <timothy.jas.buckley@hpe.com>
I just hit this issue rebuilding a docker image (alpine 3.7). I'm having some trouble getting any workarounds to work. Does anybody have any kind of hack to get around this until it's fixed? What would be the best way to hard code the linker flags? Just getting into go recently, so I may be missing something obvious. |
-tags static appears to work fine with go 1.10, if upgrading go version is an option |
Since pkg-config --static is problematic (with and without Go) I'm looking into providing separate .pc files for dynamic and static linking of librdkafka, that should solve this issue as well. |
I see this issue being closed, does that mean I can now statically build a go application that uses confluent-kafka-go inside a small alpine image? How would I go about doing that? and does anyone have a dockerfile that uses multi-staging? eg you first make install librdkafka, go get confluent-kafka then transfer the executable to a new clean alpine image? seems like a standard use-case |
I haven't tried building on Alpine, please report your findings. |
I switched to a pure Go implementation, which resulted in about a 6.5 MB container. When I have the rest of the system up (Probably in a week or so), I will measure the performance of that small container, against a normal librdkafka-client container. And then decide if I need to switch back and solve this compile issue I had when trying to get everything down to one single binary file. I'll be sure to report my findings unless someone beats me too it. |
Maybe we should have an alpine-docker build in .travis.yml to verify that it works if this is a common use-case (PRs welcome!) |
Description
For security reasons, Go 1.9.4 compiler uses whitelist to filter out most of the flags that can be used in //cgo <...> directive, see here:
golang/go#23672
(See also golang/go#23749 for lots of other people complains and some workarounds)
How to reproduce
Use Go 1.9.4. compiler;
Get libdrkafka, build it;
Get confluent-kafka-go package;
cd to .../src/github.com/confluentinc/confluent-kafka-go/kafkatest/go_verifiable_consumer ;
run "go build -tags static";
see the error message: "go build github.com/confluentinc/confluent-kafka-go/kafka: invalid pkg-config package name: --static"
Checklist
Please provide the following information:
LibraryVersion()
):ConfigMap{...}
"debug": ".."
as necessary)The text was updated successfully, but these errors were encountered: