Fix ABI settings for clang on linux

This commit is contained in:
seelabs
2015-10-29 09:32:10 -04:00
committed by Nik Bougalis
parent a8cc9033b4
commit 41ff751cd2
2 changed files with 20 additions and 9 deletions

View File

@@ -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

View File

@@ -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',