Thursday, September 8, 2016

Installing swift on ubuntu 16.04 LTS from source

Swift is new shiny programming language from apple and it's going to replace objective-C gradually. Swift has been open sourced last year and beside macOS you can install it on ubuntu desktop's.

I am going to show how to install swift from development branch source code on ubuntu 16.04 LTS.

For doing so open your terminal and install the following dependencies running the following command:

sudo apt-get install git cmake ninja-build clang python uuid-dev libicu-dev icu-devtools libbsd-dev libedit-dev libxml2-dev libsqlite3-dev swig libpython-dev libncurses5-dev pkg-config libblocksruntime-dev libcurl4-openssl-dev
After installing the dependencies successfully installing the dependencies
we need to clone the source code inside a specific directory for locating other 
swift sub-module directories.
So lets create a directory name swift-build. Run the commands on
mkdir swift-build
cd swift-build
now clone the git repository inside this repo
git clone
wait few minutes for the cloning and after cloning is complete run the
following command to install sub-modules
./swift/utils/update-checkout --clone
this will take long as it will install/clone a lot of things.
After cloning all the sub modules we need to clone and bootstrap ninja
build system as its the new build tool for swift.
git clone
cd ninja
git checkout release
./ --bootstrap
This won't take much to bootstrap. And after bootstrapping move to
swift directory
cd ..
cd swift/ 
./utils/build-script -r -t
The last command will start building all swift related tools.