These are the instructions to build AirSim on a Linux machine.
Note: you can also do this from BashOnWindows
but make sure you are not
using a Visual Studio Command Prompt
because we don't want cmake to accidentally find VC++ and try and use that.
We need to use clang compiler
because Unreal engine requires that.
First you will need the usual build essentials, this will get you 'make' amongst other things:
sudo apt-get install build-essential
First you will need at least cmake version 3.5. If you don't have cmake version 3.5 (for example, 3.2.2 is the default on Ubuntu 14) you can run the following:
mkdir ~/cmake-3.5.1
cd ~/cmake-3.5.1
wget https://cmake.org/files/v3.5/cmake-3.5.1-Linux-x86_64.sh
Now you have to run this command by itself (it is interactive)
sh cmake-3.5.1-Linux-x86_64.sh --prefix ~/cmake-3.5.1
Answer 'n' to the question about creating another cmake-3.5.1-Linux-x86_64 folder. Then
sudo update-alternatives --install /usr/bin/cmake cmake ~/cmake-3.5.1/bin/cmake 60
Now type cmake --version
to make sure your cmake version is 3.5.1.
Next you need a version of CLang compiler that supports -std=c++14
. Version 3.9 or newer should work. To install it you first need the archive signature:
wget -O - http://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add -
If you are using Ubuntu 16.04 (Xenial) then you can simply do this:
sudo apt-add-repository "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-3.9 main"
sudo apt-get update
For other flavors of Linux, you can get more instructions from http://apt.llvm.org/.
Then run the following:
sudo apt-get update
sudo apt-get install clang-3.9 clang++-3.9
Note: On Ubuntu 16.04 you may be missing libjsoncpp0 which is no longer available in the package manager, you can download the relevant dpkg here and install with sudo dpkg -i libjsoncpp0_0.6.0~*.deb
.
More detailed instructions are available here: http://apt.llvm.org/. Now make clang-3.9 your default version of clang with this command:
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-3.9 60 --slave /usr/bin/clang++ clang++ /usr/bin/clang++-3.9
Next you will need the latest version of libc++ library from llvm. You can get that by running the following script which
you will find in the cmake
folder that is included in your AirSim repo:
getlibcxx.sh
This will clone the llvm-source and build it in an llvm-build folder, then it will install the built libraries. This ensures you have the right version of llvm for your platform.
Now you can run the build.sh at the root level of the AirSim repo:
./build.sh
This will create a build_debug
folder containing the build output and the cmake generated make files.
If for any reason you need to re-run cmake to regenerate new make files just deete the build_debug
folder.
Now you are ready to follow these instructions to get Unreal working on Linux but note that everywhere you see Clang3.5 in the Unreal documentation replace that with clang3.9.