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

Building Vapor app using Docker fails on Mac when including VaporToOpenAPI #20

Open
owainhunt opened this issue Feb 16, 2024 · 4 comments

Comments

@owainhunt
Copy link

We have a number of Vapor apps that we've started adding docs to using VaporToOpenAPI. Building in Xcode works as expected, as does building on Gitlab CI. However, when trying to build in Docker on my (M1) Mac, the build fails.

I've reproduced this on the smallest possible Vapor project (using vapor new from the command line). The docker build succeeds with the bare project, but after adding VaporToOpenAPI to the package file, the build fails at the swift build step.

Package.swift

// swift-tools-version:5.9
import PackageDescription

let package = Package(
    name: "crash-test",
    platforms: [
       .macOS(.v13)
    ],
    dependencies: [
        // 💧 A server-side Swift web framework.
        .package(url: "https://github.com/vapor/vapor.git", from: "4.89.0"),
        .package(url: "https://github.com/dankinsoid/VaporToOpenAPI.git", .upToNextMajor(from: "4.4.6"))

    ],
    targets: [
        .executableTarget(
            name: "App",
            dependencies: [
                .product(name: "Vapor", package: "vapor"),
                .product(name: "VaporToOpenAPI", package: "VaporToOpenAPI")
            ]
        ),
        .testTarget(name: "AppTests", dependencies: [
            .target(name: "App"),
            .product(name: "XCTVapor", package: "vapor"),

            // Workaround for https://github.com/apple/swift-package-manager/issues/6940
            .product(name: "Vapor", package: "vapor"),
        ])
    ]
)

Docker command:
docker build -t crash-test:latest .

Dockerfile used is the standard template provided by the Vapor project

Excerpt from the build log is below:

#5 59.49 /usr/bin/clang -target aarch64-unknown-linux-gnu -g -O2 -DSWIFT_PACKAGE=1 -fblocks -fmodules -fmodule-name=CNIOBoringSSL -I /build/.build/checkouts/swift-nio-ssl/Sources/CNIOBoringSSL/include -fmodules-cache-path=/build/.build/aarch64-unknown-linux-gnu/release/ModuleCache -D_GNU_SOURCE -D_POSIX_C_SOURCE=200112L -D_DARWIN_C_SOURCE -fPIC -fno-omit-frame-pointer -MD -MT dependencies -MF /build/.build/aarch64-unknown-linux-gnu/release/CNIOBoringSSL.build/crypto/x509/x509_req.c.d -c /build/.build/checkouts/swift-nio-ssl/Sources/CNIOBoringSSL/crypto/x509/x509_req.c -o /build/.build/aarch64-unknown-linux-gnu/release/CNIOBoringSSL.build/crypto/x509/x509_req.c.o
#5 59.58 /usr/bin/clang -target aarch64-unknown-linux-gnu -g -O2 -DSWIFT_PACKAGE=1 -fblocks -fmodules -fmodule-name=CNIOBoringSSL -I /build/.build/checkouts/swift-nio-ssl/Sources/CNIOBoringSSL/include -fmodules-cache-path=/build/.build/aarch64-unknown-linux-gnu/release/ModuleCache -D_GNU_SOURCE -D_POSIX_C_SOURCE=200112L -D_DARWIN_C_SOURCE -fPIC -fno-omit-frame-pointer -MD -MT dependencies -MF /build/.build/aarch64-unknown-linux-gnu/release/CNIOBoringSSL.build/crypto/x509/x509_obj.c.d -c /build/.build/checkouts/swift-nio-ssl/Sources/CNIOBoringSSL/crypto/x509/x509_obj.c -o /build/.build/aarch64-unknown-linux-gnu/release/CNIOBoringSSL.build/crypto/x509/x509_obj.c.o
#5 59.67 /usr/bin/clang -target aarch64-unknown-linux-gnu -g -O2 -DSWIFT_PACKAGE=1 -fblocks -fmodules -fmodule-name=CNIOBoringSSL -I /build/.build/checkouts/swift-nio-ssl/Sources/CNIOBoringSSL/include -fmodules-cache-path=/build/.build/aarch64-unknown-linux-gnu/release/ModuleCache -D_GNU_SOURCE -D_POSIX_C_SOURCE=200112L -D_DARWIN_C_SOURCE -fPIC -fno-omit-frame-pointer -MD -MT dependencies -MF /build/.build/aarch64-unknown-linux-gnu/release/CNIOBoringSSL.build/crypto/x509/x509_lu.c.d -c /build/.build/checkouts/swift-nio-ssl/Sources/CNIOBoringSSL/crypto/x509/x509_lu.c -o /build/.build/aarch64-unknown-linux-gnu/release/CNIOBoringSSL.build/crypto/x509/x509_lu.c.o
#5 59.81 /usr/bin/clang -target aarch64-unknown-linux-gnu -g -O2 -DSWIFT_PACKAGE=1 -fblocks -fmodules -fmodule-name=CNIOBoringSSL -I /build/.build/checkouts/swift-nio-ssl/Sources/CNIOBoringSSL/include -fmodules-cache-path=/build/.build/aarch64-unknown-linux-gnu/release/ModuleCache -D_GNU_SOURCE -D_POSIX_C_SOURCE=200112L -D_DARWIN_C_SOURCE -fPIC -fno-omit-frame-pointer -MD -MT dependencies -MF /build/.build/aarch64-unknown-linux-gnu/release/CNIOBoringSSL.build/crypto/x509/x509_ext.c.d -c /build/.build/checkouts/swift-nio-ssl/Sources/CNIOBoringSSL/crypto/x509/x509_ext.c -o /build/.build/aarch64-unknown-linux-gnu/release/CNIOBoringSSL.build/crypto/x509/x509_ext.c.o
#5 60.98 error: compile command failed due to signal 9 (use -v to see invocation)
------
process "/bin/sh -c swift build -c release                 --static-swift-stdlib                 -Xlinker -ljemalloc -v" did not complete successfully: exit code: 1
@alexandrehsaad
Copy link

I'm having the same issue, has there been any progress on this?

@owainhunt
Copy link
Author

owainhunt commented Apr 5, 2024

@dankinsoid any update on this please? 🙏

@dankinsoid
Copy link
Owner

hi, I'll try check

@dankinsoid
Copy link
Owner

@owainhunt Unfortunately I didn't reproduce the bug on my M2 machine, maybe it's possible with M1 only, but I don't have a M1 device

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

No branches or pull requests

3 participants