From 41ff751cd261f5625e5561e3dab1ad08e1b26477 Mon Sep 17 00:00:00 2001 From: seelabs Date: Thu, 29 Oct 2015 09:32:10 -0400 Subject: [PATCH] Fix ABI settings for clang on linux --- .../Ubuntu/install_rippled_depends_ubuntu.sh | 4 +-- SConstruct | 25 +++++++++++++------ 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/Builds/Ubuntu/install_rippled_depends_ubuntu.sh b/Builds/Ubuntu/install_rippled_depends_ubuntu.sh index b4a04d2ea..9fa040756 100755 --- a/Builds/Ubuntu/install_rippled_depends_ubuntu.sh +++ b/Builds/Ubuntu/install_rippled_depends_ubuntu.sh @@ -33,8 +33,8 @@ fi if [ ${ubuntu_release} == "14.04" ] || [ ${ubuntu_release} == "15.04" ]; then apt-get install python-software-properties - echo "deb [arch=amd64] http://mirrors.ripple.com/ubuntu/ trusty stable contrib" | sudo tee /etc/apt/sources.list.d/ripple.list - wget -O- -q http://mirrors.ripple.com/mirrors.ripple.com.gpg.key | sudo apt-key add - + echo "deb [arch=amd64] https://mirrors.ripple.com/ubuntu/ trusty stable contrib" | sudo tee /etc/apt/sources.list.d/ripple.list + wget -O- -q https://mirrors.ripple.com/mirrors.ripple.com.gpg.key | sudo apt-key add - add-apt-repository ppa:ubuntu-toolchain-r/test apt-get update apt-get -y upgrade diff --git a/SConstruct b/SConstruct index 6ba7c4c38..3cc987eae 100644 --- a/SConstruct +++ b/SConstruct @@ -81,6 +81,14 @@ GCC 5: If the gcc toolchain is used, gcc version 5 or better is required. On either be built with gcc 4 or with the preprocessor flag `_GLIBCXX_USE_CXX11_ABI` set to zero. +Clang on linux: Clang cannot use the new gcc 5 ABI (clang does not know about + the `abi_tag` attribute). On linux distros that ship with the gcc 5 ABI + (ubuntu >= 15.10), building with clang requires building boost and protobuf + with the old ABI (best to build them with clang). It is best to statically + link rippled in this scenario (use the `--static` with scons), as dynamic + linking may use a library with the incorrect ABI. + + ''' # ''' @@ -299,14 +307,17 @@ def is_ubuntu(): return False @memoize -def use_gcc4_abi(gcc_cmd): +def use_gcc4_abi(cc_cmd): if os.getenv('RIPPLED_OLD_GCC_ABI'): return True gcc_ver = '' ubuntu_ver = None try: - gcc_ver = subprocess.check_output([gcc_cmd, '-dumpversion'], - stderr=subprocess.STDOUT).strip() + if 'gcc' in cc_cmd: + gcc_ver = subprocess.check_output([cc_cmd, '-dumpversion'], + stderr=subprocess.STDOUT).strip() + else: + gcc_ver = '5' # assume gcc 5 for ABI purposes for clang if is_ubuntu(): ubuntu_ver = float( @@ -502,11 +513,11 @@ def config_env(toolchain, variant, env): env.Append(LINKFLAGS=[ '-static-libstdc++', ]) + if use_gcc4_abi(env['CC'] if 'CC' in env else 'gcc'): + env.Append(CPPDEFINES={ + '-D_GLIBCXX_USE_CXX11_ABI' : 0 + }) if toolchain == 'gcc': - if use_gcc4_abi(env['CC'] if 'CC' in env else 'gcc'): - env.Append(CPPDEFINES={ - '-D_GLIBCXX_USE_CXX11_ABI' : 0 - }) env.Append(CCFLAGS=[ '-Wno-unused-but-set-variable',