Merge branch 'glibcxx-fix'

This commit is contained in:
Artem Pavlenko 2017-11-13 09:26:15 +01:00
commit 8258c7e621
6 changed files with 46 additions and 10 deletions

View file

@ -33,7 +33,7 @@ matrix:
- os: linux
sudo: false
compiler: ": clang"
env: JOBS=8 CXX="ccache clang++-3.9 -Qunused-arguments" CC="clang-3.9" TRIGGER=true
env: JOBS=8 CXX="ccache clang++-3.9 -Qunused-arguments" CC="clang-3.9" ENABLE_GLIBC_WORKAROUND=True TRIGGER=true
addons:
apt:
sources: [ 'ubuntu-toolchain-r-test']
@ -98,7 +98,7 @@ before_script:
script:
- export SCONSFLAGS='--debug=time'
- configure BENCHMARK=${BENCH}
- configure BENCHMARK=${BENCH} ENABLE_GLIBC_WORKAROUND=${ENABLE_GLIBC_WORKAROUND:-False}
- cat config.log
# we limit the `make` to 40 min
# to ensure that slow builds still upload their
@ -106,6 +106,9 @@ script:
# (and might work) for the next build
- DURATION=2400
- scripts/travis-command-wrapper.py -s "date" -i 120 --deadline=$(( $(date +%s) + ${DURATION} )) make
# dump glibcxx symbols >= 3.4.20 (if this returns output
# then it means the binaries will not run on ubuntu trusty without upgrading libstdc++)
- nm src/libmapnik* | grep "GLIBCXX_3.4.2[0-9]" || true
- RESULT=0
- make test || RESULT=$?
# we allow visual failures with g++ for now: https://github.com/mapnik/mapnik/issues/3567

View file

@ -309,6 +309,7 @@ opts.AddVariables(
BoolVariable('USE_CONFIG', "Use SCons user '%s' file (will also write variables after successful configuration)", 'True'),
BoolVariable('NO_ATEXIT', 'Will prevent Singletons from being deleted atexit of main thread', 'False'),
BoolVariable('NO_DLCLOSE', 'Will prevent plugins from being unloaded', 'False'),
BoolVariable('ENABLE_GLIBC_WORKAROUND', "Workaround known GLIBC symbol exports to allow building against libstdc++-4.8 without binaries needing throw_out_of_range_fmt", 'False'),
# http://www.scons.org/wiki/GoFastButton
# http://stackoverflow.com/questions/1318863/how-to-optimize-an-scons-script
BoolVariable('FAST', "Make SCons faster at the cost of less precise dependency tracking", 'False'),
@ -1879,6 +1880,9 @@ if not preconfigured:
if env['NO_DLCLOSE'] or env['COVERAGE']:
env.Append(CPPDEFINES = '-DMAPNIK_NO_DLCLOSE')
if env['ENABLE_GLIBC_WORKAROUND']:
env.Append(CPPDEFINES = '-DMAPNIK_ENABLE_GLIBC_WORKAROUND')
# Mac OSX (Darwin) special settings
if env['PLATFORM'] == 'Darwin':
pthread = ''

View file

@ -11,7 +11,7 @@ todo
- shrink icu data
'
MASON_VERSION="v0.11.1"
MASON_VERSION="7026e94"
function setup_mason() {
if [[ ! -d ./.mason ]]; then
@ -45,6 +45,7 @@ function install() {
}
ICU_VERSION="57.1"
BOOST_VERSION="1.64.0"
function install_mason_deps() {
install ccache 3.3.1
@ -61,15 +62,15 @@ function install_mason_deps() {
install cairo 1.14.8 libcairo
install webp 0.6.0 libwebp
install libgdal 2.1.3 libgdal
install boost 1.63.0
install boost_libsystem 1.63.0
install boost_libfilesystem 1.63.0
install boost_libprogram_options 1.63.0
install boost_libregex_icu57 1.63.0
install boost ${BOOST_VERSION}
install boost_libsystem ${BOOST_VERSION}
install boost_libfilesystem ${BOOST_VERSION}
install boost_libprogram_options ${BOOST_VERSION}
install boost_libregex_icu57 ${BOOST_VERSION}
# technically boost thread and python are not a core dep, but installing
# here by default helps make python-mapnik builds easier
install boost_libthread 1.63.0
install boost_libpython 1.63.0
install boost_libthread ${BOOST_VERSION}
install boost_libpython ${BOOST_VERSION}
install freetype 2.7.1 libfreetype
install harfbuzz 1.4.4-ft libharfbuzz
}

View file

@ -32,6 +32,7 @@ database:
- ./.mason/mason link clang++ ${LLVM_VERSION}
- ./configure CC="$(pwd)/mason_packages/.link/bin/clang" CXX="$(pwd)/mason_packages/.link/bin/ccache $(pwd)/mason_packages/.link/bin/clang++ -Qunused-arguments"
- make
- nm src/libmapnik* | grep "GLIBCXX_3.4.2[0-9]" || true
override:
- psql -c 'create database template_postgis;'
- psql -c 'create extension postgis;' -d template_postgis

View file

@ -53,6 +53,7 @@ namespace mapnik
{
template class MAPNIK_DECL singleton<freetype_engine, CreateUsingNew>;
bool freetype_engine::is_font_file(std::string const& file_name)
{
// only accept files that will be matched by freetype2's `figurefiletype()`

26
src/glibc_workaround.cpp Normal file
View file

@ -0,0 +1,26 @@
#ifdef __linux__
#ifdef MAPNIK_ENABLE_GLIBC_WORKAROUND
#include <stdexcept>
// 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
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 // MAPNIK_ENABLE_GLIBC_WORKAROUND
#endif // __linux__