Compiling Swift from Scratch on Ubuntu 18.04.1

Hello,

When trying to compile the 4.2-RELEASE tag on Ubuntu 18.04.1, with preset buildbot_linux, the compilation fails because one test fails unexpectedly.

FAIL: Swift(linux-x86_64) :: Index/Store/output-failure.swift (10471 of 11161)
******************** TEST 'Swift(linux-x86_64) :: Index/Store/output-failure.swift' FAILED ********************
Script:
--
rm -rf "/root/swift-source/build/buildbot_linux/swift-linux-x86_64/test-linux-x86_64/Index/Store/Output/output-failure.swift.tmp" && mkdir -p "/root/swift-source/build/buildbot_linux/swift-linux-x86_64/test-linux-x86_64/Index/Store/Output/output-failure.swift.tmp"
mkdir /root/swift-source/build/buildbot_linux/swift-linux-x86_64/test-linux-x86_64/Index/Store/Output/output-failure.swift.tmp/idx
/root/swift-source/build/buildbot_linux/swift-linux-x86_64/bin/swift -frontend -target x86_64-unknown-linux-gnu  -module-cache-path '/root/swift-source/build/buildbot_linux/swift-linux-x86_64/./swift-test-results/x86_64-unknown-linux-gnu/clang-module-cache' -swift-version 3  /root/swift-source/swift/test/Index/Store/output-failure.swift -typecheck
chmod -w /root/swift-source/build/buildbot_linux/swift-linux-x86_64/test-linux-x86_64/Index/Store/Output/output-failure.swift.tmp/idx
not /root/swift-source/build/buildbot_linux/swift-linux-x86_64/bin/swift -frontend -target x86_64-unknown-linux-gnu  -module-cache-path '/root/swift-source/build/buildbot_linux/swift-linux-x86_64/./swift-test-results/x86_64-unknown-linux-gnu/clang-module-cache' -swift-version 3  -index-store-path /root/swift-source/build/buildbot_linux/swift-linux-x86_64/test-linux-x86_64/Index/Store/Output/output-failure.swift.tmp/idx /root/swift-source/swift/test/Index/Store/output-failure.swift -typecheck -o /root/swift-source/build/buildbot_linux/swift-linux-x86_64/test-linux-x86_64/Index/Store/Output/output-failure.swift.tmp/oof.o 2> /root/swift-source/build/buildbot_linux/swift-linux-x86_64/test-linux-x86_64/Index/Store/Output/output-failure.swift.tmp/dir.txt || chmod +w /root/swift-source/build/buildbot_linux/swift-linux-x86_64/test-linux-x86_64/Index/Store/Output/output-failure.swift.tmp/idx
chmod +w /root/swift-source/build/buildbot_linux/swift-linux-x86_64/test-linux-x86_64/Index/Store/Output/output-failure.swift.tmp/idx
/root/swift-source/swift/utils/PathSanitizingFileCheck --sanitize 'BUILD_DIR=/root/swift-source/build/buildbot_linux/swift-linux-x86_64' --sanitize 'SOURCE_DIR=/root/swift-source/swift' --use-filecheck '/root/swift-source/build/buildbot_linux/llvm-linux-x86_64/bin/FileCheck' /root/swift-source/swift/test/Index/Store/output-failure.swift -check-prefix=DIR_ERR < /root/swift-source/build/buildbot_linux/swift-linux-x86_64/test-linux-x86_64/Index/Store/Output/output-failure.swift.tmp/dir.txt
/root/swift-source/build/buildbot_linux/swift-linux-x86_64/bin/swift -frontend -target x86_64-unknown-linux-gnu  -module-cache-path '/root/swift-source/build/buildbot_linux/swift-linux-x86_64/./swift-test-results/x86_64-unknown-linux-gnu/clang-module-cache' -swift-version 3  -index-store-path /root/swift-source/build/buildbot_linux/swift-linux-x86_64/test-linux-x86_64/Index/Store/Output/output-failure.swift.tmp/idx /root/swift-source/swift/test/Index/Store/output-failure.swift -typecheck -o /root/swift-source/build/buildbot_linux/swift-linux-x86_64/test-linux-x86_64/Index/Store/Output/output-failure.swift.tmp/oof.o
chmod -w /root/swift-source/build/buildbot_linux/swift-linux-x86_64/test-linux-x86_64/Index/Store/Output/output-failure.swift.tmp/idx/*/units
not /root/swift-source/build/buildbot_linux/swift-linux-x86_64/bin/swift -frontend -target x86_64-unknown-linux-gnu  -module-cache-path '/root/swift-source/build/buildbot_linux/swift-linux-x86_64/./swift-test-results/x86_64-unknown-linux-gnu/clang-module-cache' -swift-version 3  -index-store-path /root/swift-source/build/buildbot_linux/swift-linux-x86_64/test-linux-x86_64/Index/Store/Output/output-failure.swift.tmp/idx /root/swift-source/swift/test/Index/Store/output-failure.swift -typecheck -o /root/swift-source/build/buildbot_linux/swift-linux-x86_64/test-linux-x86_64/Index/Store/Output/output-failure.swift.tmp/oof.o 2> /root/swift-source/build/buildbot_linux/swift-linux-x86_64/test-linux-x86_64/Index/Store/Output/output-failure.swift.tmp/file.txt || chmod +w /root/swift-source/build/buildbot_linux/swift-linux-x86_64/test-linux-x86_64/Index/Store/Output/output-failure.swift.tmp/idx/*/units
chmod +w /root/swift-source/build/buildbot_linux/swift-linux-x86_64/test-linux-x86_64/Index/Store/Output/output-failure.swift.tmp/idx/*/units
/root/swift-source/swift/utils/PathSanitizingFileCheck --sanitize 'BUILD_DIR=/root/swift-source/build/buildbot_linux/swift-linux-x86_64' --sanitize 'SOURCE_DIR=/root/swift-source/swift' --use-filecheck '/root/swift-source/build/buildbot_linux/llvm-linux-x86_64/bin/FileCheck' /root/swift-source/swift/test/Index/Store/output-failure.swift -check-prefix=FILE_ERR < /root/swift-source/build/buildbot_linux/swift-linux-x86_64/test-linux-x86_64/Index/Store/Output/output-failure.swift.tmp/file.txt
rm -rf /root/swift-source/build/buildbot_linux/swift-linux-x86_64/test-linux-x86_64/Index/Store/Output/output-failure.swift.tmp/idx/*/records/*
chmod -x /root/swift-source/build/buildbot_linux/swift-linux-x86_64/test-linux-x86_64/Index/Store/Output/output-failure.swift.tmp/idx/*/records
not /root/swift-source/build/buildbot_linux/swift-linux-x86_64/bin/swift -frontend -target x86_64-unknown-linux-gnu  -module-cache-path '/root/swift-source/build/buildbot_linux/swift-linux-x86_64/./swift-test-results/x86_64-unknown-linux-gnu/clang-module-cache' -swift-version 3  -index-store-path /root/swift-source/build/buildbot_linux/swift-linux-x86_64/test-linux-x86_64/Index/Store/Output/output-failure.swift.tmp/idx /root/swift-source/swift/test/Index/Store/output-failure.swift -typecheck -o /root/swift-source/build/buildbot_linux/swift-linux-x86_64/test-linux-x86_64/Index/Store/Output/output-failure.swift.tmp/oof.o 2> /root/swift-source/build/buildbot_linux/swift-linux-x86_64/test-linux-x86_64/Index/Store/Output/output-failure.swift.tmp/record.txt || chmod +x /root/swift-source/build/buildbot_linux/swift-linux-x86_64/test-linux-x86_64/Index/Store/Output/output-failure.swift.tmp/idx/*/records
chmod +x /root/swift-source/build/buildbot_linux/swift-linux-x86_64/test-linux-x86_64/Index/Store/Output/output-failure.swift.tmp/idx/*/records
/root/swift-source/swift/utils/PathSanitizingFileCheck --sanitize 'BUILD_DIR=/root/swift-source/build/buildbot_linux/swift-linux-x86_64' --sanitize 'SOURCE_DIR=/root/swift-source/swift' --use-filecheck '/root/swift-source/build/buildbot_linux/llvm-linux-x86_64/bin/FileCheck' /root/swift-source/swift/test/Index/Store/output-failure.swift -check-prefix=RECORD_ERR < /root/swift-source/build/buildbot_linux/swift-linux-x86_64/test-linux-x86_64/Index/Store/Output/output-failure.swift.tmp/record.txt
rm -rf /root/swift-source/build/buildbot_linux/swift-linux-x86_64/test-linux-x86_64/Index/Store/Output/output-failure.swift.tmp/idx/*/records/*
chmod -w /root/swift-source/build/buildbot_linux/swift-linux-x86_64/test-linux-x86_64/Index/Store/Output/output-failure.swift.tmp/idx/*/records
not /root/swift-source/build/buildbot_linux/swift-linux-x86_64/bin/swift -frontend -target x86_64-unknown-linux-gnu  -module-cache-path '/root/swift-source/build/buildbot_linux/swift-linux-x86_64/./swift-test-results/x86_64-unknown-linux-gnu/clang-module-cache' -swift-version 3  -index-store-path /root/swift-source/build/buildbot_linux/swift-linux-x86_64/test-linux-x86_64/Index/Store/Output/output-failure.swift.tmp/idx /root/swift-source/swift/test/Index/Store/output-failure.swift -typecheck -o /root/swift-source/build/buildbot_linux/swift-linux-x86_64/test-linux-x86_64/Index/Store/Output/output-failure.swift.tmp/oof.o 2> /root/swift-source/build/buildbot_linux/swift-linux-x86_64/test-linux-x86_64/Index/Store/Output/output-failure.swift.tmp/record2.txt || chmod +w /root/swift-source/build/buildbot_linux/swift-linux-x86_64/test-linux-x86_64/Index/Store/Output/output-failure.swift.tmp/idx/*/records
chmod +w /root/swift-source/build/buildbot_linux/swift-linux-x86_64/test-linux-x86_64/Index/Store/Output/output-failure.swift.tmp/idx/*/records
/root/swift-source/swift/utils/PathSanitizingFileCheck --sanitize 'BUILD_DIR=/root/swift-source/build/buildbot_linux/swift-linux-x86_64' --sanitize 'SOURCE_DIR=/root/swift-source/swift' --use-filecheck '/root/swift-source/build/buildbot_linux/llvm-linux-x86_64/bin/FileCheck' /root/swift-source/swift/test/Index/Store/output-failure.swift -check-prefix=RECORD_ERR < /root/swift-source/build/buildbot_linux/swift-linux-x86_64/test-linux-x86_64/Index/Store/Output/output-failure.swift.tmp/record2.txt
--
Exit Code: 2

Command Output (stderr):
--
FileCheck error: '-' is empty.
FileCheck command line:  /root/swift-source/build/buildbot_linux/llvm-linux-x86_64/bin/FileCheck /root/swift-source/swift/test/Index/Store/output-failure.swift -check-prefix=DIR_ERR

--

********************

Is this a known issue? Is there something that can be done?

My goal is to be able to provide debs to install Swift on Linux (Ubuntu and Debian). For Ubuntu I can use the tarball provided by Apple, but for Debian I have to re-compile the compiler from scratch. So I’m first trying to compile on Ubuntu… I’d feel more safe if all the tests passed when compiling the project (currently I’m compiling with the tests disabled, but it’s not ideal…).

Thank you!

1 Like

Are you running the test as root? That's not going to work since this test is trying to trigger a permissions failure. I recommend building and running swift's tests as a normal user.

1 Like

Ha yes, that’s exactly what I was doing… thank you very much! Will try ASAP.

Hi! I’ve (finally) succeeded in creating a Dockerfile for Debian to build Swift with tests enabled. It needs SWIG from testing (3.0.12) and clang 6.0 (from backports) though.
Will try and open source it if I can :slight_smile:

Thanks again!

1 Like

A Dockerfile for Debian (a deb soon?!?!)? Really nice!!! :+1: :slightly_smiling_face:
I also dream of a Dockerfile for Alpine Linux or better a package :grin:

The Dockerfile I created does generate two debs: one for the libs (necessary to run compiled Swift projects), one for the compiler (that has a dependency on the libs one).

I just have to go through the legal team in my company before I can open source. I will keep you posted!

1 Like

I have had the authorisation from my company. Here’s the URL to my Docker: https://hub.docker.com/r/happn/swift-builder/

3 Likes
Terms of Service

Privacy Policy

Cookie Policy