From 3b3bb1868a268e1106d8a522ec634a1a5384bfd6 Mon Sep 17 00:00:00 2001 From: nsubiron Date: Mon, 30 Jul 2018 12:11:31 +0200 Subject: [PATCH] Fix the build --- Docs/how_to_build_on_linux.md | 6 ++-- LibCarla/cmake/client/CMakeLists.txt | 3 +- PythonAPI/setup.py | 32 ++++++++++++------- .../Plugins/Carla/Source/Carla/Carla.Build.cs | 3 ++ 4 files changed, 28 insertions(+), 16 deletions(-) diff --git a/Docs/how_to_build_on_linux.md b/Docs/how_to_build_on_linux.md index 360bbfcd6..5939d8ef0 100644 --- a/Docs/how_to_build_on_linux.md +++ b/Docs/how_to_build_on_linux.md @@ -7,9 +7,9 @@ Install the build tools and dependencies ``` sudo add-apt-repository ppa:ubuntu-toolchain-r/test -sudo apt-get install build-essential clang-5.0 lld-5.0 g++-7 ninja-build python python-pip python3 python3-pip libboost-python-dev python-dev tzdata sed curl wget unzip autoconf libtool -pip2 install --user setuptools nose2 -pip3 install --user setuptools nose2 +sudo apt-get update +sudo apt-get install build-essential clang-5.0 lld-5.0 g++-7 ninja-build python python-pip python-dev tzdata sed curl wget unzip autoconf libtool +pip install --user setuptools nose2 ``` To avoid compatibility issues between Unreal Engine and the CARLA dependencies, diff --git a/LibCarla/cmake/client/CMakeLists.txt b/LibCarla/cmake/client/CMakeLists.txt index a88759ec8..2ce528bb9 100644 --- a/LibCarla/cmake/client/CMakeLists.txt +++ b/LibCarla/cmake/client/CMakeLists.txt @@ -25,7 +25,8 @@ foreach(target carla_client_debug carla_client) "${BOOST_INCLUDE_PATH}" "${RPCLIB_INCLUDE_PATH}") - install(TARGETS ${target} DESTINATION lib) + # @todo This was disabled because now everything is built in the setup.py. + # install(TARGETS ${target} DESTINATION lib) endforeach(target) # Specific options for debug. diff --git a/PythonAPI/setup.py b/PythonAPI/setup.py index e38c4d9de..59c75d16c 100644 --- a/PythonAPI/setup.py +++ b/PythonAPI/setup.py @@ -7,21 +7,31 @@ from setuptools import setup, Extension import fnmatch -import glob import os import platform import sys def get_libcarla_extensions(): - libraries = ['carla_client', 'rpc'] + include_dirs = ['dependencies/include'] + library_dirs = ['dependencies/lib'] + libraries = [] if os.name == "posix": if platform.dist()[0] == "Ubuntu": - libraries += ["boost_python-py%d%d" % (sys.version_info.major, - sys.version_info.minor)] - else: - libraries += ["boost_python"] + pwd = os.path.dirname(os.path.realpath(__file__)) + pylib = "libboost_python%d%d.a" % (sys.version_info.major, + sys.version_info.minor) + extra_link_args = [ + os.path.join(pwd, 'dependencies/lib/librpc.a'), + os.path.join(pwd, 'dependencies/lib', pylib)] + extra_compile_args = [ + '-fPIC', '-std=c++14', '-DBOOST_ERROR_CODE_HEADER_ONLY', '-Wno-missing-braces' + ] + # @todo Why would we need this? + include_dirs += ['/usr/lib/gcc/x86_64-linux-gnu/7/include'] + library_dirs += ['/usr/lib/gcc/x86_64-linux-gnu/7'] + extra_link_args += ['/usr/lib/gcc/x86_64-linux-gnu/7/libstdc++.a'] else: raise NotImplementedError @@ -37,13 +47,11 @@ def get_libcarla_extensions(): return Extension( name, sources=sources, - include_dirs=[ - 'dependencies/include'], - library_dirs=[ - 'dependencies/lib'], - runtime_library_dirs=['dependencies/lib'], + include_dirs=include_dirs, + library_dirs=library_dirs, libraries=libraries, - extra_compile_args=['-fPIC', '-std=c++14', '-DBOOST_ERROR_CODE_HEADER_ONLY', '-Wno-missing-braces'], + extra_compile_args=extra_compile_args, + extra_link_args=extra_link_args, language='c++14', depends=depends) diff --git a/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Carla.Build.cs b/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Carla.Build.cs index acb900025..2b6e84bd3 100644 --- a/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Carla.Build.cs +++ b/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Carla.Build.cs @@ -115,5 +115,8 @@ public class Carla : ModuleRules string LibCarlaIncludePath = Path.Combine(LibCarlaInstallPath, "include"); PublicIncludePaths.Add(LibCarlaIncludePath); PrivateIncludePaths.Add(LibCarlaIncludePath); + + /// @todo This is necessary because rpclib uses exceptions to notify errors. + bEnableExceptions = true; } }