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

build-protobuf crashes with segmentation fault on Apple M1 #42

Open
yvrhdn opened this issue May 4, 2021 · 2 comments
Open

build-protobuf crashes with segmentation fault on Apple M1 #42

yvrhdn opened this issue May 4, 2021 · 2 comments

Comments

@yvrhdn
Copy link

yvrhdn commented May 4, 2021

Hi! We use the otel/build-protobuf image in Tempo, it is run as part of make vendor-check:
https://github.com/grafana/tempo/blob/055573362709a02e2ca6aa98400a3de38c91c4a1/Makefile#L123

I'm the first person on the team using the Apple M1 and using this image results in an error (full log at the end):

qemu: uncaught target signal 11 (Segmentation fault) - core dumped

The recommended way to solve this is by providing multi-arch Docker images. Similar work was done in Tempo itself: this requires the pipeline to be adapted so it builds both amd64 and arm64 images and the Dockerfile is parameterised to accept a target arch.

Is this work you would consider accepting?

Full log:

$ make vendor-check

...

--
-- Gen proto --
--
docker run --rm -u 501 -v/Users/koenraad/Repositories/grafana/tempo:/Users/koenraad/Repositories/grafana/tempo -w/Users/koenraad/Repositories/grafana/tempo otel/build-protobuf:0.2.1 --proto_path=/Users/koenraad/Repositories/grafana/tempo -Ipkg/.patched-proto --gogofaster_out=plugins=grpc,paths=source_relative:./pkg/tempopb/ pkg/.patched-proto/common/v1/common.proto
WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
qemu: uncaught target signal 11 (Segmentation fault) - core dumped
--gogofaster_out: protoc-gen-gogofaster: Plugin killed by signal 11.
make: *** [gen-proto] Error 1
@bogdandrutu
Copy link
Member

I don't have an M1 so hard to test, but I can review a PR :)

@yvrhdn
Copy link
Author

yvrhdn commented Jun 29, 2021

This isn't really a solution yet, but for documentation sake:

When I apply the following changes and rebuild the Docker image it works on Apple M1:

diff --git a/protobuf/Dockerfile b/protobuf/Dockerfile
index 14b92c9..73be1fd 100644
--- a/protobuf/Dockerfile
+++ b/protobuf/Dockerfile
@@ -99,7 +99,7 @@ RUN cd / && \
     mkdir -p /protoc-gen-lint-out && \
     cd /protoc-gen-lint-out && \
     unzip -q /protoc-gen-lint_linux_amd64.zip && \
-    install -Ds /protoc-gen-lint-out/protoc-gen-lint /out/usr/bin/protoc-gen-lint
+    install -D /protoc-gen-lint-out/protoc-gen-lint /out/usr/bin/protoc-gen-lint

 ARG GRPC_GATEWAY_VERSION
 RUN mkdir -p ${GOPATH}/src/github.com/grpc-ecosystem/grpc-gateway && \
@@ -121,7 +121,7 @@ FROM alpine:${ALPINE_VERSION} as packer
 RUN apk add --no-cache curl

 ARG UPX_VERSION
-RUN mkdir -p /upx && curl -sSL https://github.com/upx/upx/releases/download/v${UPX_VERSION}/upx-${UPX_VERSION}-amd64_linux.tar.xz | tar xJ --strip 1 -C /upx && \
+RUN mkdir -p /upx && curl -sSL https://github.com/upx/upx/releases/download/v${UPX_VERSION}/upx-${UPX_VERSION}-arm64_linux.tar.xz | tar xJ --strip 1 -C /upx && \
     install -D /upx/upx /usr/local/bin/upx

 # Use all output including headers and protoc from protoc_builder

I am not sure why only UPX needs that arm64 version, the amd64 version causes a segmentation fault 🤷🏻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants