bash
, or the project won't compile.Install and run the latest version of Bash on Ubuntu on Windows installed on your PC.
bash
Install the developer dependencies needed to compile the Swift project. These are identical to the Ubuntu dependencies, with the addition of make
.
sudo apt-get install git make 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
clang
Install a version of clang
with C++ 14 support; the default version of clang
on WSL results in linker errors during compilation.
sudo apt-get install clang-3.6 sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-3.6 100 sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-3.6 100
Install the latest version of CMake; Swift uses new CMake features such as IN_LIST
and won't build without these features.
wget http://www.cmake.org/files/v3.6/cmake-3.6.2.tar.gz tar xf cmake-3.6.2.tar.gz cd cmake-3.6.2 ./configure make sudo make install sudo update-alternatives --install /usr/bin/cmake cmake /usr/local/bin/cmake 1 --force cmake --version # This should print 3.6.2
mkdir swift-source cd swift-source git clone https://github.com/apple/swift.git ./swift/utils/update-checkout --clone ./swift/utils/build-script -r
cd ./build/Ninja-RelWithDebInfoAssert/swift-linux-x86_64/bin # This path may depend on your build configuration echo 'print("Hello, Windows")' >> test.swift swiftc test.swift ./test # Hello, Windows