Description
Environment
$ sw_vers
ProductName: macOS
ProductVersion: 12.3.1
BuildVersion: 21E258
$ xcodebuild -version
Xcode 13.3.1
Build version 13E500a
$ docker --version
Docker version 20.10.14, build a224086
Description
With each subsequent release of Swift, more and more available RAM is required to link Swift executables on Linux. The addition of the recommended --static-swift-stdlib
build flag on Linux (not to mention the accepted evolution proposal to make this the default, SE-0342) exacerbates the issue to the point where 4GB is not enough RAM to successfully link an unmodified Vapor template app (the following snippet assumes the vapor
Homebrew formula is installed):
$ docker system info
<snip>
Kernel Version: 5.10.104-linuxkit
Operating System: Docker Desktop
OSType: linux
Architecture: aarch64
CPUs: 4
Total Memory: 3.826GiB
<snip>
$ vapor new testmem
Cloning template...
name: testmem
Would you like to use Fluent? (--fluent/--no-fluent)
y/n> y
fluent: Yes
db: Postgres (Recommended)
Would you like to use Leaf? (--leaf/--no-leaf)
y/n> n
leaf: No
<snip>
$ cd testmem/
testmem$ docker build .
[+] Building 123.6s (17/23)
<snip>
=> ERROR [build 7/12] RUN swift build -c release --static-swift-stdlib 89.3s
------
> [build 7/12] RUN swift build -c release --static-swift-stdlib:
#17 0.878 Building for production...
#17 0.970 remark: Incremental compilation has been disabled: it is not compatible with whole module optimizationremark: Incremental compilation has been disabled: it is not compatible with whole module optimizationremark: Incremental compilation has been disabled: it is not compatible with whole module optimizationremark: Incremental compilation has been disabled: it is not compatible with whole module optimization[1/867] Compiling _NIODataStructures Heap.swift
#17 1.561 remark: Incremental compilation has been disabled: it is not compatible with whole module optimization[3/869] Compiling COperatingSystem Exports.swift
<snip>
#17 58.78 [931/932] Compiling AsyncHTTPClient HTTPClient+execute.swift
#17 58.80 remark: Incremental compilation has been disabled: it is not compatible with whole module optimization[933/934] Compiling Vapor Application.swift
#17 74.23 remark: Incremental compilation has been disabled: it is not compatible with whole module optimization[935/936] Compiling Fluent FluentProvider+Concurrency.swift
#17 75.22 remark: Incremental compilation has been disabled: it is not compatible with whole module optimization[937/938] Compiling App TodoController.swift
#17 76.49 remark: Incremental compilation has been disabled: it is not compatible with whole module optimization[939/940] Compiling Run main.swift
#17 89.04 error: link command failed with exit code 254 (use -v to see invocation)
#17 89.04 clang-13: error: unable to execute command: Killed
#17 89.04 clang-13: error: linker command failed due to signal (use -v to see invocation)
#17 89.11 [940/941] Linking Run
------
executor failed running [/bin/sh -c swift build -c release --static-swift-stdlib]: exit code: 1
$
Note: Issue content cleaned up from original Jira import.
Detail from JIRA
Data | Value |
---|---|
Previous ID | SR-16121 |
Radar | None |
Original Reporter | @gwynne |
Type | Bug |
Votes | 0 |
Component/s | Compiler, Source Tooling |
Labels | Bug, Linux |
Assignee | None |
Priority | Medium |
md5: 05c2ceaa59cb789e6c5b9eabe39cb06a