at workaround for throw_out_of_range_fmt

This commit is contained in:
Dane Springmeyer 2017-11-09 10:07:26 -08:00
parent 26a1c79efb
commit 1ad3ae044b
4 changed files with 42 additions and 2 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

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

@ -53,6 +53,16 @@ namespace mapnik
{
template class MAPNIK_DECL singleton<freetype_engine, CreateUsingNew>;
void freetype_engine::clear()
{
#ifdef MAPNIK_THREADSAFE
std::lock_guard<std::mutex> lock(mutex_);
#endif
global_font_file_mapping_.clear();
global_memory_fonts_.clear();
}
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__