Vapor: failed to fetch an image or build from source

Hey there!

I'm a bit new into Swift on the server and I'm trying to deploy a Vapor app to Fly.io platform. Vapor's template with default Dockerfile works fine and I was able to deploy a version and use it. The problem came when I introduced an external package as a dependency and the deploy process started failing. The error appears to happen when running the build command:

Error: failed to fetch an image or build from source: error building: failed to solve: process "/bin/sh -c swift build -c release --static-swift-stdlib -Xlinker -ljemalloc" did not complete successfully: exit code: 1

And a bunch of logs that I'm not able to understand are printed during the process:

516.5 [986/988] Compiling Parsing OneOfBuilder.swift
526.2 error: compile command failed due to signal 6 (use -v to see invocation)
526.2 SIL memory lifetime failure in @$s10URLRouting5FieldV5parsey6OutputQzAA14URLRequestDataV6FieldsVzKF: store-borrow location cannot be written
526.2 at instruction:   %20 = unchecked_take_enum_data_addr %15 : $*Optional<ArraySlice<Optional<Substring>>>, #Optional.some!enumelt // user: %21
526.2
526.2 in function:
526.2 // Field.parse(_:)
526.2 sil [serialized] [ossa] @$s10URLRouting5FieldV5parsey6OutputQzAA14URLRequestDataV6FieldsVzKF : $@convention(method) <Value where Value : Parser, Value.Input == Substring> (@inout URLRequestData.Fields, @in_guaranteed Field<Value>) -> (@out Value.Output, @error any Error) {

...

526.2 0.	Program arguments: /usr/bin/swift-frontend -frontend -c /build/.build/checkouts/swift-url-routing/Sources/URLRouting/Body.swift /build/.build/checkouts/swift-url-routing/Sources/URLRouting/Builders/Variadics.swift /build/.build/checkouts/swift-url-routing/Sources/URLRouting/Client/Client.swift /build/.build/checkouts/swift-url-routing/Sources/URLRouting/Cookies.swift /build/.build/checkouts/swift-url-routing/Sources/URLRouting/Exports.swift /build/.build/checkouts/swift-url-routing/Sources/URLRouting/Field.swift /build/.build/checkouts/swift-url-routing/Sources/URLRouting/FormData.swift /build/.build/checkouts/swift-url-routing/Sources/URLRouting/Fragment.swift /build/.build/checkouts/swift-url-routing/Sources/URLRouting/Headers.swift /build/.build/checkouts/swift-url-routing/Sources/URLRouting/Host.swift /build/.build/checkouts/swift-url-routing/Sources/URLRouting/Internal/AnyEquatable.swift /build/.build/checkouts/swift-url-routing/Sources/URLRouting/Internal/Breakpoint.swift /build/.build/checkouts/swift-url-routing/Sources/URLRouting/Internal/Deprecations.swift /build/.build/checkouts/swift-url-routing/Sources/URLRouting/Method.swift /build/.build/checkouts/swift-url-routing/Sources/URLRouting/Parsing/Parse.swift /build/.build/checkouts/swift-url-routing/Sources/URLRouting/Parsing/ParserPrinter.swift /build/.build/checkouts/swift-url-routing/Sources/URLRouting/Path.swift /build/.build/checkouts/swift-url-routing/Sources/URLRouting/PathBuilder.swift /build/.build/checkouts/swift-url-routing/Sources/URLRouting/Printing.swift /build/.build/checkouts/swift-url-routing/Sources/URLRouting/Query.swift /build/.build/checkouts/swift-url-routing/Sources/URLRouting/Route.swift /build/.build/checkouts/swift-url-routing/Sources/URLRouting/Router.swift /build/.build/checkouts/swift-url-routing/Sources/URLRouting/RoutingError.swift /build/.build/checkouts/swift-url-routing/Sources/URLRouting/Scheme.swift /build/.build/checkouts/swift-url-routing/Sources/URLRouting/URLRequestData+Foundation.swift /build/.build/checkouts/swift-url-routing/Sources/URLRouting/URLRequestData.swift -supplementary-output-file-map /tmp/TemporaryDirectory.ytpEvK/supplementaryOutputs-1 -target x86_64-unknown-linux-gnu -disable-objc-interop -I /build/.build/x86_64-unknown-linux-gnu/release -g -module-cache-path /build/.build/x86_64-unknown-linux-gnu/release/ModuleCache -suppress-warnings -swift-version 5 -O -D SWIFT_PACKAGE -new-driver-path /usr/bin/swift-driver -load-plugin-executable /build/.build/x86_64-unknown-linux-gnu/release/CasePathsMacros#CasePathsMacros -empty-abi-descriptor -resource-dir /usr/lib/swift_static -use-static-resource-dir -Xcc -fmodule-map-file=/build/.build/checkouts/swift-syntax/Sources/_SwiftSyntaxCShims/include/module.modulemap -Xcc -I -Xcc /build/.build/checkouts/swift-syntax/Sources/_SwiftSyntaxCShims/include -Xcc -fPIC -Xcc -g -Xcc -fno-omit-frame-pointer -module-name URLRouting -plugin-path /usr/lib/swift/host/plugins -plugin-path /usr/local/lib/swift/host/plugins -enable-default-cmo -parse-as-library -num-threads 8 -o /build/.build/x86_64-unknown-linux-gnu/release/URLRouting.build/Body.swift.o -o /build/.build/x86_64-unknown-linux-gnu/release/URLRouting.build/Variadics.swift.o -o /build/.build/x86_64-unknown-linux-gnu/release/URLRouting.build/Client.swift.o -o /build/.build/x86_64-unknown-linux-gnu/release/URLRouting.build/Cookies.swift.o -o /build/.build/x86_64-unknown-linux-gnu/release/URLRouting.build/Exports.swift.o -o /build/.build/x86_64-unknown-linux-gnu/release/URLRouting.build/Field.swift.o -o /build/.build/x86_64-unknown-linux-gnu/release/URLRouting.build/FormData.swift.o -o /build/.build/x86_64-unknown-linux-gnu/release/URLRouting.build/Fragment.swift.o -o /build/.build/x86_64-unknown-linux-gnu/release/URLRouting.build/Headers.swift.o -o /build/.build/x86_64-unknown-linux-gnu/release/URLRouting.build/Host.swift.o -o /build/.build/x86_64-unknown-linux-gnu/release/URLRouting.build/AnyEquatable.swift.o -o /build/.build/x86_64-unknown-linux-gnu/release/URLRouting.build/Breakpoint.swift.o -o /build/.build/x86_64-unknown-linux-gnu/release/URLRouting.build/Deprecations.swift.o -o /build/.build/x86_64-unknown-linux-gnu/release/URLRouting.build/Method.swift.o -o /build/.build/x86_64-unknown-linux-gnu/release/URLRouting.build/Parse.swift.o -o /build/.build/x86_64-unknown-linux-gnu/release/URLRouting.build/ParserPrinter.swift.o -o /build/.build/x86_64-unknown-linux-gnu/release/URLRouting.build/Path.swift.o -o /build/.build/x86_64-unknown-linux-gnu/release/URLRouting.build/PathBuilder.swift.o -o /build/.build/x86_64-unknown-linux-gnu/release/URLRouting.build/Printing.swift.o -o /build/.build/x86_64-unknown-linux-gnu/release/URLRouting.build/Query.swift.o -o /build/.build/x86_64-unknown-linux-gnu/release/URLRouting.build/Route.swift.o -o /build/.build/x86_64-unknown-linux-gnu/release/URLRouting.build/Router.swift.o -o /build/.build/x86_64-unknown-linux-gnu/release/URLRouting.build/RoutingError.swift.o -o /build/.build/x86_64-unknown-linux-gnu/release/URLRouting.build/Scheme.swift.o -o /build/.build/x86_64-unknown-linux-gnu/release/URLRouting.build/URLRequestData+Foundation.swift.o -o /build/.build/x86_64-unknown-linux-gnu/release/URLRouting.build/URLRequestData.swift.o
526.2 1.	Swift version 5.10.1 (swift-5.10.1-RELEASE)
526.2 2.	Compiling with the current language version
526.2 3.	While evaluating request ASTLoweringRequest(Lowering AST to SIL for module URLRouting)
526.2 4.	While silgen emitFunction SIL function "@$s10URLRouting5FieldV5parsey6OutputQzAA14URLRequestDataV6FieldsVzKF".
526.2  for 'parse(_:)' (at /build/.build/checkouts/swift-url-routing/Sources/URLRouting/Field.swift:85:10)
526.2 5.	While verifying SIL function "@$s10URLRouting5FieldV5parsey6OutputQzAA14URLRequestDataV6FieldsVzKF".
526.2  for 'parse(_:)' (at /build/.build/checkouts/swift-url-routing/Sources/URLRouting/Field.swift:85:10)
526.2 Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):

...

I don't know if it has something to do with the Docker configuration or what is happening.

Can anybody share some light here?

Thanks!

What machine are you building on? And what command are you using to deploy?

I'm using swift:noble and to deploy Fly's cli command fly deploy which fails while executing:

swift build -c release \
                --static-swift-stdlib \
                -Xlinker -ljemalloc

Ok so I think the issue here is cross-compiling on ARM for x86. You should try either a remote deploy or building on CI with the same architecture