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

Unable to compile protoc plugin for ARM64 arch #1663

Closed
strophy opened this issue Oct 5, 2023 · 1 comment
Closed

Unable to compile protoc plugin for ARM64 arch #1663

strophy opened this issue Oct 5, 2023 · 1 comment
Labels

Comments

@strophy
Copy link

strophy commented Oct 5, 2023

What are you trying to achieve?

I am trying to include grpc-swift in https://github.com/rvolosatovs/docker-protobuf, an all-inclusive Dockerised bundle of protoc compilers. Our CI runs on x86_64, and we use Docker with QEMU to build an ARM64 image. I'm having a lot of difficulty with random crashes at various points in the compilation process, and these crashes do not occur when running on native ARM64.

Simplified Dockerfile to reproduce the issue:

FROM swift:5.9
RUN apt-get update
RUN apt-get install -y \
        build-essential \
        curl \
        libnghttp2-dev \
        libssl-dev \
        patchelf \
        unzip \
        zlib1g-dev
RUN mkdir -p /protoc-gen-swift && \
    mkdir -p /grpc-swift
RUN curl -sSL https://api.github.com/repos/grpc/grpc-swift/tarball/1.19.1 | tar xz --strip 1 -C /grpc-swift
WORKDIR /grpc-swift
RUN make
RUN make plugins

Running docker buildx build --platform linux/arm64 . results in the following error:

119.4 Creating working copy for https://github.com/apple/swift-nio.git
120.6 Working copy of https://github.com/apple/swift-nio.git resolved at 2.59.0
125.6 error: 'swift-nio-extras': Invalid manifest (compiled with: ["/usr/bin/swiftc", "-vfsoverlay", "/tmp/TemporaryDirectory.xvbRB2/vfs.yaml", "-L", "/usr/lib/swift/pm/ManifestAPI", "-lPackageDescription", "-Xlinker", "-rpath", "-Xlinker", "/usr/lib/swift/pm/ManifestAPI", "-swift-version", "5", "-I", "/usr/lib/swift/pm/ManifestAPI", "-package-description-version", "5.6.0", "/grpc-swift/.build/checkouts/swift-nio-extras/Package.swift", "-Xfrontend", "-disable-implicit-concurrency-module-import", "-Xfrontend", "-disable-implicit-string-processing-module-import", "-o", "/tmp/TemporaryDirectory.7Tvpa4/swift-nio-extras-manifest"])
125.6 swift-runtime: unable to suspend thread 2739
125.6 swift-runtime: unable to suspend thread 2739
140.0 make: *** [Makefile:25: all] Error 1

What have you tried so far?

I've had issues open on the Swift Forums since Swift 5.6 to try and get this working. The errors have changed now with Swift 5.9, but successfully compiling the plugin is still impossible. Compiler devs have suggested that grpc-swift may be using fatalError() to report expected error messages to the user. I wonder if devs here could confirm they are able to reproduce this and maybe join the discussion at https://forums.swift.org/t/swift-runtime-unable-to-suspend-thread-when-compiling-in-qemu/67676 or help us out by suggesting an alternative method to build a plugin binary for ARM64 in CI. Thanks!

@Lukasa
Copy link
Collaborator

Lukasa commented Oct 6, 2023

Thanks for this issue! Unfortunately I recommend continuing to pursue this with the Swift team on the forums. We cannot trigger this error message with our own package code, and we do not. The packages compile fine under Rosetta for Linux so it’s highly likely this is specifically an interaction between QEMU and either Swift or SwiftPM.

@Lukasa Lukasa closed this as completed Oct 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants