Upgrade to LLVM 8.0.1

This commit is contained in:
bernat 2020-03-23 15:19:22 +01:00
parent 1402f7748c
commit 457b63b85e
10 changed files with 41 additions and 41 deletions

View File

@ -13,10 +13,10 @@ matrix:
apt:
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-xenial-7
- llvm-toolchain-xenial-8
packages:
- g++-7 # we need this one for the libstdc++.
- clang-7
- clang-8
- ninja-build
- python
- python-pip

View File

@ -40,22 +40,22 @@ sudo apt-get update &&
sudo apt-get install wget software-properties-common &&
sudo add-apt-repository ppa:ubuntu-toolchain-r/test &&
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add - &&
sudo apt-add-repository "deb http://apt.llvm.org/$(lsb_release -c --short)/ llvm-toolchain-$(lsb_release -c --short)-7 main" &&
sudo apt-add-repository "deb http://apt.llvm.org/$(lsb_release -c --short)/ llvm-toolchain-$(lsb_release -c --short)-8 main" &&
sudo apt-get update
# Additional dependencies for Ubuntu 18.04.
sudo apt-get install build-essential clang-7 lld-7 g++-7 cmake ninja-build libvulkan1 python python-pip python-dev python3-dev python3-pip libpng-dev libtiff5-dev libjpeg-dev tzdata sed curl unzip autoconf libtool rsync libxml2-dev &&
sudo apt-get install build-essential clang-8 lld-8 g++-7 cmake ninja-build libvulkan1 python python-pip python-dev python3-dev python3-pip libpng-dev libtiff5-dev libjpeg-dev tzdata sed curl unzip autoconf libtool rsync libxml2-dev &&
pip2 install --user setuptools &&
pip3 install --user setuptools
# Additional dependencies for previous Ubuntu versions.
sudo apt-get install build-essential clang-7 lld-7 g++-7 cmake ninja-build libvulkan1 python python-pip python-dev python3-dev python3-pip libpng16-dev libtiff5-dev libjpeg-dev tzdata sed curl unzip autoconf libtool rsync libxml2-dev &&
sudo apt-get install build-essential clang-8 lld-8 g++-7 cmake ninja-build libvulkan1 python python-pip python-dev python3-dev python3-pip libpng16-dev libtiff5-dev libjpeg-dev tzdata sed curl unzip autoconf libtool rsync libxml2-dev &&
pip2 install --user setuptools &&
pip3 install --user setuptools
# Change default clang version.
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/lib/llvm-7/bin/clang++ 170 &&
sudo update-alternatives --install /usr/bin/clang clang /usr/lib/llvm-7/bin/clang 170
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/lib/llvm-8/bin/clang++ 180 &&
sudo update-alternatives --install /usr/bin/clang clang /usr/lib/llvm-8/bin/clang 180
# Get a GitHub and a UE account, and link both.
# Install git.
@ -108,7 +108,7 @@ sudo apt-get update &&
sudo apt-get install wget software-properties-common &&
sudo add-apt-repository ppa:ubuntu-toolchain-r/test &&
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add - &&
sudo apt-add-repository "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-7 main" &&
sudo apt-add-repository "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-8 main" &&
sudo apt-get update
```
@ -117,22 +117,22 @@ sudo apt-get update
__Ubuntu 18.04__.
```sh
sudo apt-get install build-essential clang-7 lld-7 g++-7 cmake ninja-build libvulkan1 python python-pip python-dev python3-dev python3-pip libpng-dev libtiff5-dev libjpeg-dev tzdata sed curl unzip autoconf libtool rsync libxml2-dev &&
sudo apt-get install build-essential clang-8 lld-8 g++-7 cmake ninja-build libvulkan1 python python-pip python-dev python3-dev python3-pip libpng-dev libtiff5-dev libjpeg-dev tzdata sed curl unzip autoconf libtool rsync libxml2-dev &&
pip2 install --user setuptools &&
pip3 install --user setuptools
```
__Previous Ubuntu__ versions.
```sh
sudo apt-get install build-essential clang-7 lld-7 g++-7 cmake ninja-build libvulkan1 python python-pip python-dev python3-dev python3-pip libpng16-dev libtiff5-dev libjpeg-dev tzdata sed curl unzip autoconf libtool rsync libxml2-dev &&
sudo apt-get install build-essential clang-8 lld-8 g++-7 cmake ninja-build libvulkan1 python python-pip python-dev python3-dev python3-pip libpng16-dev libtiff5-dev libjpeg-dev tzdata sed curl unzip autoconf libtool rsync libxml2-dev &&
pip2 install --user setuptools &&
pip3 install --user setuptools
```
To avoid compatibility issues between Unreal Engine and the CARLA dependencies, it is recommended to use the same compiler version and C++ runtime library to compile everything. The CARLA team uses clang-7 and LLVM's libc++. Change the default clang version to compile Unreal Engine and the CARLA dependencies.
To avoid compatibility issues between Unreal Engine and the CARLA dependencies, it is recommended to use the same compiler version and C++ runtime library to compile everything. The CARLA team uses clang-8 and LLVM's libc++. Change the default clang version to compile Unreal Engine and the CARLA dependencies.
```sh
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/lib/llvm-7/bin/clang++ 170 &&
sudo update-alternatives --install /usr/bin/clang clang /usr/lib/llvm-7/bin/clang 170
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/lib/llvm-8/bin/clang++ 180 &&
sudo update-alternatives --install /usr/bin/clang clang /usr/lib/llvm-8/bin/clang 180
```
---

View File

@ -13,7 +13,7 @@ The goal is to be able to call Unreal Engine's functions from a separate Python
![modules](img/modules.png)
In Linux, we compile CARLA and all the dependencies with clang-7.0 and C++14 standard. We however link against different runtime C++ libraries depending on where the code going to be used, since all the code that is going to be linked with Unreal Engine needs to be compiled using `libc++`.
In Linux, we compile CARLA and all the dependencies with clang-8.0 and C++14 standard. We however link against different runtime C++ libraries depending on where the code going to be used, since all the code that is going to be linked with Unreal Engine needs to be compiled using `libc++`.
---
## Setup
@ -26,7 +26,7 @@ make setup
Get and compile dependencies
* llvm-7.1 (libc++ and libc++abi)
* llvm-8 (libc++ and libc++abi)
* rpclib-2.2.1 (twice, with libstdc++ and libc++)
* boost-1.72.0 (headers and boost_python for libstdc++)
* googletest-1.8.1 (with libc++)
@ -107,7 +107,7 @@ make PythonAPI
It creates two "egg" packages
* `PythonAPI/dist/carla-X.X.X-py2.7-linux-x86_64.egg`
* `PythonAPI/dist/carla-X.X.X-py3.5-linux-x86_64.egg`
* `PythonAPI/dist/carla-X.X.X-py3.7-linux-x86_64.egg`
This package can be directly imported into a Python script by adding it to the system path.
@ -129,5 +129,5 @@ Alternatively, it can be installed with `easy_install`
```sh
easy_install2 --user --no-deps PythonAPI/dist/carla-X.X.X-py2.7-linux-x86_64.egg
easy_install3 --user --no-deps PythonAPI/dist/carla-X.X.X-py3.5-linux-x86_64.egg
easy_install3 --user --no-deps PythonAPI/dist/carla-X.X.X-py3.7-linux-x86_64.egg
```

View File

@ -10,7 +10,7 @@
## Python
* Comments should not exceed 80 columns, code should not exceed 120 columns.
* All code must be compatible with Python 2.7, 3.5, and 3.6.
* All code must be compatible with Python 2.7 and 3.7.
* [Pylint][pylintlink] should not give any error or warning (few exceptions
apply with external classes like `numpy` and `pygame`, see our `.pylintrc`).
* Python code follows [PEP8 style guide][pep8link] (use `autopep8` whenever
@ -25,7 +25,7 @@
* Comments should not exceed 80 columns, code may exceed this limit a bit in
rare occasions if it results in clearer code.
* Compilation should not give any error or warning
(`clang++-7 -Wall -Wextra -std=C++14 -Wno-missing-braces`).
(`clang++-8 -Wall -Wextra -std=C++14 -Wno-missing-braces`).
* The use of `throw` is forbidden, use `carla::throw_exception` instead.
* Unreal C++ code (CarlaUE4 and Carla plugin) follow the
[Unreal Engine's Coding Standard][ue4link] with the exception of using

View File

@ -24,8 +24,8 @@ want
```cmake
# Example ToolChain.cmake
set(CMAKE_C_COMPILER /usr/bin/clang-7)
set(CMAKE_CXX_COMPILER /usr/bin/clang++-7)
set(CMAKE_C_COMPILER /usr/bin/clang-8)
set(CMAKE_CXX_COMPILER /usr/bin/clang++-8)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -O3 -DNDEBUG" CACHE STRING "" FORCE)
```

View File

@ -23,7 +23,7 @@ namespace client {
/// cases and reconsider this implementation.
class BlueprintLibrary
: public EnableSharedFromThis<BlueprintLibrary>,
private NonCopyable {
private MovableNonCopyable {
using map_type = std::unordered_map<std::string, ActorBlueprint>;
public:

View File

@ -4,8 +4,8 @@
# -- Set up environment --------------------------------------------------------
# ==============================================================================
export CC=/usr/bin/clang-7
export CXX=/usr/bin/clang++-7
export CC=/usr/bin/clang-8
export CXX=/usr/bin/clang++-8
source $(dirname "$0")/Environment.sh

View File

@ -2,8 +2,8 @@
source $(dirname "$0")/Environment.sh
export CC=clang-7
export CXX=clang++-7
export CC=clang-8
export CXX=clang++-8
# ==============================================================================
# -- Parse arguments -----------------------------------------------------------

View File

@ -4,14 +4,14 @@
# -- Set up environment --------------------------------------------------------
# ==============================================================================
command -v /usr/bin/clang++-7 >/dev/null 2>&1 || {
echo >&2 "clang 7 is required, but it's not installed.";
command -v /usr/bin/clang++-8 >/dev/null 2>&1 || {
echo >&2 "clang 8 is required, but it's not installed.";
exit 1;
}
CXX_TAG=c7
export CC=/usr/bin/clang-7
export CXX=/usr/bin/clang++-7
CXX_TAG=c8
export CC=/usr/bin/clang-8
export CXX=/usr/bin/clang++-8
source $(dirname "$0")/Environment.sh
@ -22,7 +22,7 @@ pushd ${CARLA_BUILD_FOLDER} >/dev/null
# -- Get and compile libc++ ----------------------------------------------------
# ==============================================================================
LLVM_BASENAME=llvm-7.0
LLVM_BASENAME=llvm-8.0
LLVM_INCLUDE=${PWD}/${LLVM_BASENAME}-install/include/c++/v1
LLVM_LIBPATH=${PWD}/${LLVM_BASENAME}-install/lib
@ -34,9 +34,9 @@ else
log "Retrieving libc++."
git clone --depth=1 -b release_70 https://github.com/llvm-mirror/llvm.git ${LLVM_BASENAME}-source
git clone --depth=1 -b release_70 https://github.com/llvm-mirror/libcxx.git ${LLVM_BASENAME}-source/projects/libcxx
git clone --depth=1 -b release_70 https://github.com/llvm-mirror/libcxxabi.git ${LLVM_BASENAME}-source/projects/libcxxabi
git clone --depth=1 -b release_80 https://github.com/llvm-mirror/llvm.git ${LLVM_BASENAME}-source
git clone --depth=1 -b release_80 https://github.com/llvm-mirror/libcxx.git ${LLVM_BASENAME}-source/projects/libcxx
git clone --depth=1 -b release_80 https://github.com/llvm-mirror/libcxxabi.git ${LLVM_BASENAME}-source/projects/libcxxabi
log "Compiling libc++."
@ -97,7 +97,7 @@ else
pushd ${BOOST_BASENAME}-source >/dev/null
BOOST_TOOLSET="clang-7.1"
BOOST_TOOLSET="clang-8.0"
BOOST_CFLAGS="-fPIC -std=c++14 -DBOOST_ERROR_CODE_HEADER_ONLY"
py2="/usr/bin/env python2"

View File

@ -9,11 +9,11 @@ RUN apt-get update ; \
apt-get install -y wget software-properties-common && \
add-apt-repository ppa:ubuntu-toolchain-r/test && \
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|apt-key add - && \
apt-add-repository "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-7 main" && \
apt-add-repository "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-8 main" && \
apt-get update ; \
apt-get install -y build-essential \
clang-7 \
lld-7 \
clang-8 \
lld-8 \
g++-7 \
cmake \
ninja-build \
@ -37,8 +37,8 @@ RUN apt-get update ; \
aria2 && \
pip2 install setuptools && \
pip3 install setuptools && \
update-alternatives --install /usr/bin/clang++ clang++ /usr/lib/llvm-7/bin/clang++ 170 && \
update-alternatives --install /usr/bin/clang clang /usr/lib/llvm-7/bin/clang 170
update-alternatives --install /usr/bin/clang++ clang++ /usr/lib/llvm-8/bin/clang++ 180 && \
update-alternatives --install /usr/bin/clang clang /usr/lib/llvm-8/bin/clang 180
USER ue4