Swift for Ubuntu 18.04

I see there are no builds available for Ubuntu 18.04 (bionic), the new LTS release. I know it’s brand new, but I’ve upgraded my system to it, and I’d like to give Swift a try. Any word on when Swift builds for 18.04 can be expected?


We’re actively looking to support it in the CI soon (hopefully order of weeks). The plan is to have Ubuntu 18.04 images for Swift 4.2, but I don’t have a precise date yet.


I’m having difficulty figuring out how to build in such way to match the release structure of the precompiled tar distribution. Additionally (on 18.04), I have some test failures.

All this is to say, if 18.04 releases make it into a dev CI output somewhere, I’d love to test them ASAP.

Is there an issue tracking this, or something listing what needs to be done to build a full toolchain locally on 18.04 in the interim?

I seem to be able to build swift itself ok, but am hitting problems when I attempt to build spm.

1 Like

Which tag or branch are you building? This is the first error I hit on swift-4.1.1-RELEASE, but I kind of don’t know what I’m doing:

[2499/2692] Linking CXX executable bin/clang-check
FAILED: bin/clang-check 
: && /usr/bin/clang++  -Wno-unknown-warning-option -Werror=unguarded-availability-new -fno-stack-protector -g -fPIC -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -std=c++11 -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wcovered-switch-default -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wstring-conversion -fcolor-diagnostics -ffunction-sections -fdata-sections -fno-common -Woverloaded-virtual -Wno-nested-anon-types -O2  -fuse-ld=gold -Wl,-allow-shlib-undefined    -Wl,-rpath-link,/work/swift-source/build/Ninja-RelWithDebInfoAssert/llvm-linux-x86_64/./lib  -Wl,-O3 -Wl,--gc-sections tools/clang/tools/clang-check/CMakeFiles/clang-check.dir/ClangCheck.cpp.o  -o bin/clang-check  -Wl,-rpath,"\$ORIGIN/../lib" lib/libLLVMX86CodeGen.a lib/libLLVMX86AsmPrinter.a lib/libLLVMX86AsmParser.a lib/libLLVMX86Desc.a lib/libLLVMX86Info.a lib/libLLVMX86Disassembler.a lib/libLLVMX86Info.a lib/libLLVMX86Utils.a lib/libLLVMARMCodeGen.a lib/libLLVMARMAsmPrinter.a lib/libLLVMARMAsmParser.a lib/libLLVMARMDesc.a lib/libLLVMARMInfo.a lib/libLLVMARMDisassembler.a lib/libLLVMARMInfo.a lib/libLLVMAArch64CodeGen.a lib/libLLVMAArch64AsmPrinter.a lib/libLLVMAArch64AsmParser.a lib/libLLVMAArch64Desc.a lib/libLLVMAArch64Info.a lib/libLLVMAArch64Disassembler.a lib/libLLVMAArch64Info.a lib/libLLVMAArch64Utils.a lib/libLLVMPowerPCCodeGen.a lib/libLLVMPowerPCAsmPrinter.a lib/libLLVMPowerPCAsmParser.a lib/libLLVMPowerPCDesc.a lib/libLLVMPowerPCInfo.a lib/libLLVMPowerPCDisassembler.a lib/libLLVMPowerPCInfo.a lib/libLLVMSystemZCodeGen.a lib/libLLVMSystemZAsmPrinter.a lib/libLLVMSystemZAsmParser.a lib/libLLVMSystemZDesc.a lib/libLLVMSystemZInfo.a lib/libLLVMSystemZDisassembler.a lib/libLLVMSystemZInfo.a lib/libLLVMMipsCodeGen.a lib/libLLVMMipsAsmPrinter.a lib/libLLVMMipsAsmParser.a lib/libLLVMMipsDesc.a lib/libLLVMMipsInfo.a lib/libLLVMMipsDisassembler.a lib/libLLVMMipsInfo.a lib/libLLVMOption.a lib/libLLVMSupport.a -lpthread lib/libclangAPINotes.a lib/libclangAST.a lib/libclangBasic.a lib/libclangDriver.a lib/libclangFrontend.a lib/libclangRewriteFrontend.a lib/libclangStaticAnalyzerFrontend.a lib/libclangTooling.a lib/libLLVMX86AsmPrinter.a lib/libLLVMX86Utils.a lib/libLLVMARMDesc.a lib/libLLVMARMAsmPrinter.a lib/libLLVMARMInfo.a lib/libLLVMGlobalISel.a lib/libLLVMAArch64Desc.a lib/libLLVMAArch64AsmPrinter.a lib/libLLVMAArch64Info.a lib/libLLVMAArch64Utils.a lib/libLLVMPowerPCAsmPrinter.a lib/libLLVMSystemZDesc.a lib/libLLVMSystemZAsmPrinter.a lib/libLLVMSystemZInfo.a lib/libLLVMAsmPrinter.a lib/libLLVMDebugInfoCodeView.a lib/libLLVMDebugInfoMSF.a lib/libLLVMSelectionDAG.a lib/libLLVMCodeGen.a lib/libLLVMScalarOpts.a lib/libLLVMInstCombine.a lib/libLLVMBitWriter.a lib/libLLVMTransformUtils.a lib/libLLVMTarget.a lib/libLLVMAnalysis.a lib/libLLVMObject.a lib/libLLVMMipsAsmPrinter.a lib/libLLVMMCDisassembler.a lib/libclangStaticAnalyzerCheckers.a lib/libclangStaticAnalyzerCore.a lib/libclangToolingRefactor.a lib/libclangToolingRefactoring.a lib/libclangASTMatchers.a lib/libclangIndex.a lib/libclangFrontend.a lib/libclangDriver.a lib/libLLVMOption.a lib/libclangParse.a lib/libLLVMMCParser.a lib/libLLVMProfileData.a lib/libclangSerialization.a lib/libclangSema.a lib/libclangAPINotes.a lib/libLLVMBitReader.a lib/libclangEdit.a lib/libclangAnalysis.a lib/libclangFormat.a lib/libclangToolingCore.a lib/libclangAST.a lib/libclangRewrite.a lib/libclangLex.a lib/libclangBasic.a lib/libLLVMCore.a lib/libLLVMBinaryFormat.a lib/libLLVMMC.a lib/libLLVMSupport.a -lrt -ldl -ltinfo -lpthread -lz -lm lib/libLLVMDemangle.a && :
clang: error: unable to execute command: Killed
clang: error: linker command failed due to signal (use -v to see invocation)
[2506/2692] Linking CXX executable bin/clang-5.0
ninja: build stopped: subcommand failed.
utils/build-script: fatal error: command terminated with a non-zero exit status 1, aborting

I’m building from the master branch, from a couple of days ago (867ffdd16c46c7bc82f2e7d490c4fd162696036a).

I’ve actually just realised that I didn’t have all the dependencies installed for swiftpm (described here).

I swear I’d installed them all, but during subsequent tinkering whilst trying to get the 16.10 pre-built stuff to work, I must have removed one of them.

So I now have swiftpm building I think. The challenge now is to work out where the build scripts put the executable :P.

I think you can do this by building with: swift/utils/build-toolchain -R.

For me that seems to have built something that looks to have the right layout into build/buildbot_linux/none-swift_package_sandbox_linux-x86_64.

I’ve also realised that I have something approximating the correct layout has appeared in the swift directory:


I’m not actually sure if this was in response to the build-toolchain command, or earlier experiments. Will experiment and let you know.

I have no idea how Linux ABI/API stability works so I am curious about why each Ubuntu release must compiled separately. Why Swift for Ubuntu 14.04 is not compatible with newer releases?

1 Like

It was in response to the build toolchain command. Additionally, you may want to run the tests after you build the toolchain. It is an extra option that you pass to build-toolchain (I forgot what it is, but the help message will show you).

1 Like

Yes, indeed - I guess the .tar.gz should probably be regarded as the definitive output of build-toolchain, and the rest just incidental build products.

Unsurprisingly, the extra option to run the tests is --test!

For others wondering, ./swift-source/swift/utils/build-script --preset=buildbot_linux,no_test install_destdir=/home/xxx/swift-install installable_package=/home/xxx/swift.tar.gz appears to work correctly - there appear to be a test or two that fails.


Thanks, vincentwoo. I built one myself today using your instructions.

@tkremenek Hi Ted, I noticed that 18.04 support didn't make Swift 4.1.2. With its release and the conclusion of WWDC, is there any chance you can speak to a very rough timeline of when we might expect first-party Swift on 18.04? I understand if you can't.


My understanding is we are waiting to get a sufficient number of VMs setup for 18.04, which is awaiting the resolution of some infrastructure issues. The intent is to support 18.04 for Swift 4.2.


I've just tried building again on 18.04, using the latest 4.2 branch, and am hitting an error in SwiftExpressionParser.cpp:

/SwiftExpressionParser.cpp:1146:53: error: incomplete type 'swift::IRGenDebugInfoLevel' named in nested name specifier
                                           ? swift::IRGenDebugInfoLevel::Normal

Has anyone else encountered this? I think I've done the right magic incantations after pulling from git, but perhaps not.

There was a Swift change that had a corresponding LLDB change; it's possible your repos are just out of sync. Or it's possible we're missing an include somewhere (or similar).

Terms of Service

Privacy Policy

Cookie Policy