Skip to content

Instantly share code, notes, and snippets.

@seabaylea
Created June 11, 2016 16:02
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save seabaylea/cad7808615c52cfd2fc9d1debcad832f to your computer and use it in GitHub Desktop.
Save seabaylea/cad7808615c52cfd2fc9d1debcad832f to your computer and use it in GitHub Desktop.
How to build a Swift toolchain on Linux with full Dispatch and NSURLSession support

Follow the instructions to checkout a full Swift build for Linux:

git clone https://github.com/apple/swift.git
cd swift
./utils/update-checkout --clone

Update the libdispatch component to use the 'experimental/foundation' branch:

cd swift-corelibs-libdispatch
git pull origin experimental/foundation
git submodule init
git submodule update
cd ..

Replace the foundation component with the seabaylea/swift-corelibs-foundation#nsurlsession fork/branch:

rm -rf swift-corelibs-foundation
git clone -b nsurlsession http://github.com/seabaylea/swift-corelibs-foundation

Build a full toolchain, with the addition of the --dispatch and --install-dispatch flags. This can be done by updating the swift/utils/build-presets.ini file to add the flags to the buildbot_linux:

[preset: buildbot_linux]
mixin-preset=mixin_linux_installation
build-subdir=buildbot_linux
lldb
release
test
validation-test
long-test
libdispatch
foundation

dash-dash

install-libdispatch
install-foundation
reconfigure

and then running the buildbot_linux preset:

./swift/utils/build-script --preset=buildbot_linux install_destdir=/tmp/install installable_package=/tmp/swift-with-nsurlsession.tar.gz
@seabaylea
Copy link
Author

Picking up the libdispatch branch could be replaced with:

git clone -b experimental/foundation http://github.com/apple/swift-corelibs-libdispatch
cd swift-corelibs-libdispatch
git submodule init
git submodule update

but you'd most likely have to delete the existing swift-corelibs-libdispatch directory first.

@seabaylea
Copy link
Author

That build failure is unrelated to the Foundation and libdispatch changes - it looks like a failure in the LLVM build. It might be worth updating that component:

cd llvm
git pull origin stable

@romainmenke
Copy link

Updated my scripts with you suggestions, It builds fine, but then the tests fail. I'm just going to wait a couple of days/weeks :) I can't thank you enough for your time and help. I really love what you guys are doing with Swift.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment