Compilation fails on Ubuntu 22.04
nashysolutions opened this issue · 11 comments
Describe the bug
The build hangs.
swift build -c release --disable-sandbox
Building for production...
[28/31] Compiling NIOConcurrencyHelpers NIOAtomic.swift // hangs here
To Reproduce
Follow the steps here, I checked out Vapor 18.7.4
Expected behavior
The build is successful.
That looks like a transient issue at the SwiftPM level; a build hang like that isn't something the toolbox's own code can cause, especially not while it's still compiling NIO. Does this reproduce reliably?
That looks like a transient issue at the SwiftPM level; a build hang like that isn't something the toolbox's own code can cause, especially not while it's still compiling NIO. Does this reproduce reliably?
Yes. Falling back to 18.7.2 produces a similar result
swift build -c release --disable-sandbox
Updating https://github.com/apple/swift-nio.git
Updated https://github.com/apple/swift-nio.git (0.88s)
Updating https://github.com/apple/swift-atomics.git
Updated https://github.com/apple/swift-atomics.git (0.44s)
Updating https://github.com/apple/swift-collections.git
Updated https://github.com/apple/swift-collections.git (0.49s)
Updating https://github.com/apple/swift-log.git
Updated https://github.com/apple/swift-log.git (0.50s)
Updating https://github.com/tanner0101/mustache.git
Updated https://github.com/tanner0101/mustache.git (0.41s)
Updating https://github.com/jpsim/Yams.git
Updated https://github.com/jpsim/Yams.git (0.47s)
Updating https://github.com/vapor/console-kit.git
Computing version for https://github.com/vapor/console-kit.git
Updated https://github.com/vapor/console-kit.git (0.42s)
Computed https://github.com/vapor/console-kit.git at 4.8.1 (0.50s)
Computing version for https://github.com/tanner0101/mustache.git
Computed https://github.com/tanner0101/mustache.git at 0.1.1 (0.63s)
Computing version for https://github.com/jpsim/Yams.git
Computed https://github.com/jpsim/Yams.git at 5.0.6 (0.45s)
Computing version for https://github.com/apple/swift-nio.git
Computed https://github.com/apple/swift-nio.git at 2.59.0 (0.51s)
Computing version for https://github.com/apple/swift-log.git
Computed https://github.com/apple/swift-log.git at 1.5.3 (0.38s)
Computing version for https://github.com/apple/swift-collections.git
Computed https://github.com/apple/swift-collections.git at 1.0.5 (0.41s)
Computing version for https://github.com/apple/swift-atomics.git
Computed https://github.com/apple/swift-atomics.git at 1.2.0 (0.36s)
Working copy of https://github.com/vapor/console-kit.git resolved at 4.8.1
Building for production...
[1/3] Compiling CMustache mustach.c //hangs here
Can you try running swift package update
before swift build
?
Can you try running
swift package update
beforeswift build
?
Tried this and now it reproducibly hangs here instead.
Building for production...
[17/19] Compiling NIOConcurrencyHelpers NIOAtomic.swift // hangs here
I can't reproduce this hang in Docker, though the build does take a noticeable amount of time. Most likely this is the same old memory issue in the linker; how much RAM is allocated to your droplet?
Falling back to 18.6.0 produces same result.
Swift version 5.9.2 (swift-5.9.2-RELEASE)
Target: x86_64-unknown-linux-gnu
Will fall back to swift version 5.9.1 which is what you guys use in your DigitalOcean walkthrough docs.
I can't reproduce this hang in Docker, though the build does take a noticeable amount of time. Most likely this is the same old memory issue in the linker; how much RAM is allocated to your droplet?
512MB
Still same issue with Swift 5.9.1.
[29/31] Compiling CMustache mustach.c // hangs here
or
[17/19] Compiling NIOConcurrencyHelpers NIOAtomic.swift // hangs here
How much RAM do you recommend?
Ah yeah, that's known to not be enough even with the linker improvements in 5.9, unfortunately 😕. If you bump to 1GB, that should resolve your issue.
Resolved. Thank you @gwynne
I probably should have mentioned more details about the stack. Apologies for that.