Workaround GLIBC 4.9 importing one useless (to us) symbol that causes a version update.

This commit is contained in:
Daniel Patterson 2017-10-02 12:17:34 -07:00
parent eff1d4e622
commit ff7f8557e3
No known key found for this signature in database
GPG Key ID: 19C12BE1725A028B
2 changed files with 35 additions and 4 deletions

View File

@ -187,7 +187,7 @@ matrix:
apt: apt:
sources: ['ubuntu-toolchain-r-test'] sources: ['ubuntu-toolchain-r-test']
packages: ['libstdc++-4.9-dev'] packages: ['libstdc++-4.9-dev']
env: CLANG_VERSION='4.0.0' BUILD_TYPE='Release' ENABLE_MASON=ON ENABLE_LTO=ON JOBS=3 env: CLANG_VERSION='4.0.0' BUILD_TYPE='Release' ENABLE_MASON=ON ENABLE_LTO=ON JOBS=3 CXXFLAGS='-include util/glibc_workaround.hpp'
install: install:
- pushd ${OSRM_BUILD_DIR} - pushd ${OSRM_BUILD_DIR}
- | - |
@ -210,7 +210,7 @@ matrix:
apt: apt:
sources: ['ubuntu-toolchain-r-test'] sources: ['ubuntu-toolchain-r-test']
packages: ['libstdc++-4.9-dev'] packages: ['libstdc++-4.9-dev']
env: CLANG_VERSION='4.0.0' BUILD_TYPE='Debug' ENABLE_MASON=ON ENABLE_LTO=ON JOBS=3 env: CLANG_VERSION='4.0.0' BUILD_TYPE='Debug' ENABLE_MASON=ON ENABLE_LTO=ON JOBS=3 CXXFLAGS='-include util/glibc_workaround.hpp'
install: install:
- pushd ${OSRM_BUILD_DIR} - pushd ${OSRM_BUILD_DIR}
- | - |
@ -233,7 +233,7 @@ matrix:
apt: apt:
sources: ['ubuntu-toolchain-r-test'] sources: ['ubuntu-toolchain-r-test']
packages: ['libstdc++-4.9-dev'] packages: ['libstdc++-4.9-dev']
env: CLANG_VERSION='4.0.0' BUILD_TYPE='Release' ENABLE_MASON=ON ENABLE_LTO=ON JOBS=3 NODE="6" env: CLANG_VERSION='4.0.0' BUILD_TYPE='Release' ENABLE_MASON=ON ENABLE_LTO=ON JOBS=3 NODE="6" CXXFLAGS='-include util/glibc_workaround.hpp'
install: install:
- pushd ${OSRM_BUILD_DIR} - pushd ${OSRM_BUILD_DIR}
- | - |
@ -256,7 +256,7 @@ matrix:
apt: apt:
sources: ['ubuntu-toolchain-r-test'] sources: ['ubuntu-toolchain-r-test']
packages: ['libstdc++-4.9-dev'] packages: ['libstdc++-4.9-dev']
env: CLANG_VERSION='4.0.0' BUILD_TYPE='Debug' ENABLE_MASON=ON ENABLE_LTO=ON JOBS=3 NODE="6" env: CLANG_VERSION='4.0.0' BUILD_TYPE='Debug' ENABLE_MASON=ON ENABLE_LTO=ON JOBS=3 NODE="6" CXXFLAGS='-include util/glibc_workaround.hpp'
install: install:
- pushd ${OSRM_BUILD_DIR} - pushd ${OSRM_BUILD_DIR}
- | - |

View File

@ -0,0 +1,31 @@
#ifndef GLIBC_WORKAROUND_H
#define GLIBC_WORKAROUND_H
// https://github.com/bitcoin/bitcoin/pull/4042
// allows building against libstdc++-dev-4.9 while avoiding
// GLIBCXX_3.4.20 dep
// This is needed because libstdc++ itself uses this API - its not
// just an issue of your code using it, ughhh
// Note: only necessary on Linux
#ifdef __linux__
#define WORKAROUND
#warning building with workaround
#else
#warning not building with workaround
#endif
#ifdef WORKAROUND
namespace std
{
void __throw_out_of_range_fmt(const char *, ...) __attribute__((__noreturn__));
void __throw_out_of_range_fmt(const char *err, ...)
{
// Safe and over-simplified version. Ignore the format and print it as-is.
__throw_out_of_range(err);
}
}
#endif // WORKAROUND
#endif // GLIBC_WORKAROUND_H