0

I have a swift app with the following dependencies:

    .package(url: "https://github.com/apple/swift-nio.git", .upToNextMajor(from: "2.41.1")),
    .package(url: "https://github.com/apple/swift-crypto.git", .upToNextMajor(from: "2.1.0"))

Building it locally to run in a docker container works. This is the command I use for that:

docker build -t <image-name>:v1 .

Given I am building on an M1 macbook, deploying the above to azure does not work, since it is built for arm64 arch. However, when I attempt to build for linux/amd64, the code fails. This is the docker command I am using:

docker build --platform=linux/amd64 -t <image-name>:v1 .

I have tried with buildx, but the failure is similar:

docker buildx build --platform=linux/amd64 -t <image-name>:v1 .

The command I use to build the app for production is this:

RUN swift build -c release --static-swift-stdlib

Here is a snippet of the error message I am getting:

#0 35.45 warning: 'build': 'Build' was identified as an executable target given the presence of a 'main.swift' file. Starting with tools version 5.4.0 executable targets should be declared as 'executableTarget()'
#0 35.67 Building for production...
#0 36.08 [0/422] Compiling _AtomicsShims.c
#0 36.28 [1/422] Compiling CNIOWindows shim.c
#0 36.48 [2/422] Compiling CNIOWindows WSAStartup.c
#0 36.51 error: command Compiling CNIOLinux shim.c failed: failed to poll (Interrupted system call)
...
#0 44.33 remark: Incremental compilation has been disabled: it is not compatible with 
whole module optimization
#0 44.34 error: command Compiling Swift Module 'NIOConcurrencyHelpers' (5 sources) failed: failed to poll (Interrupted system call)
#0 47.29 error: command Compiling CCryptoBoringSSL crypto/x509v3/v3_skey.c failed: failed to poll (Interrupted system call)
#0 47.64 error: command Compiling CCryptoBoringSSL crypto/x509v3/v3_purp.c failed: failed to poll (Interrupted system call)
tweeterist
  • 25
  • 6
  • This is a problem with the compiler or build system or the file system in your container: `error: command Compiling CNIOLinux shim.c failed: failed to poll (Interrupted system call)` – Johannes Weiss Dec 20 '22 at 07:09
  • If this is reproducible, please report a bug on https://github.com/apple/swift/issues – Johannes Weiss Dec 20 '22 at 07:10
  • Thanks @JohannesWeiss - What does `failed to poll (Interrupted system call)` mean? – tweeterist Dec 20 '22 at 07:15
  • 1
    @tweeterist `poll` is a system call which is designed to block until it gets data on one or more file descriptors. If a signal occurs while blocked in `poll` the sys call will exit setting `errno` to `EINTR`. My guess is that the build is waiting for a child compile to finish, and the child has exited in some way to cause a signal to the parent. – JeremyP Dec 20 '22 at 08:52

0 Answers0