Details
-
Type:
Bug
-
Status: Resolved
-
Priority:
Medium
-
Resolution: Done
-
Component/s: Package Manager
-
Labels:None
-
Radar URL:
Description
Here's a one-shot command to use the official ubuntu18.04 docker image, install Swift and try to compile swift-nio-ssl:
docker run -it --rm ubuntu:18.04 bash -c 'apt-get update && apt-get install -y git curl libxml2-dev && curl https://swift.org/builds/swift-5.0.1-release/ubuntu1804/swift-5.0.1-RELEASE/swift-5.0.1-RELEASE-ubuntu18.04.tar.gz | tar xz && git clone https://github.com/apple/swift-nio-ssl && cd swift-nio-ssl/ && /swift-5.0.1-RELEASE-ubuntu18.04/usr/bin/swift build'
Instead of succeeding, the build fails with
Fetching https://github.com/apple/swift-nio.git Completed resolution in 4.08s Cloning https://github.com/apple/swift-nio.git Resolving https://github.com/apple/swift-nio.git at 2.0.2 error: terminated(1): which clang output:
because Swift can't its own clang that it ships. This problem can be easily resolved by doing
export PATH="$PATH:/swift-5.0.1-RELEASE-ubuntu18.04/usr/bin"
That however is bad news because that means Swift prefers the clang that is first on $PATH instead of just using its own clang. So if somebody installs clang using their system package manager, Swift will use the wrong and possibly incompatible clang, probably breaking the sanitizers and god knows what else in the process.