Skip to content

Commit

Permalink
another attemp to fix #835
Browse files Browse the repository at this point in the history
  • Loading branch information
Dane Springmeyer committed Jan 24, 2018
1 parent ea7c32f commit 176a87d
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ pre_build_check:
mapnik-config -v

release_base: pre_build_check deps/geometry/include/mapbox/geometry.hpp node_modules
V=1 CXXFLAGS="-fno-omit-frame-pointer $(PROFILING_FLAG)" ./node_modules/.bin/node-pre-gyp configure build --loglevel=error --clang
V=1 CXXFLAGS="-fno-omit-frame-pointer $(PROFILING_FLAG)" ./node_modules/.bin/node-pre-gyp configure build --ENABLE_GLIBC_WORKAROUND=true --loglevel=error --clang
@echo "run 'make clean' for full rebuild"

debug_base: pre_build_check deps/geometry/include/mapbox/geometry.hpp node_modules
V=1 ./node_modules/.bin/node-pre-gyp configure build --loglevel=error --debug --clang
V=1 ./node_modules/.bin/node-pre-gyp configure build --ENABLE_GLIBC_WORKAROUND=true --loglevel=error --debug --clang
@echo "run 'make clean' for full rebuild"

release: mason_packages/.link/bin/mapnik-config
Expand Down
8 changes: 8 additions & 0 deletions binding.gyp
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
'includes': [ 'common.gypi' ],
'variables': {
'ENABLE_GLIBC_WORKAROUND%':'false', # can be overriden by a command line variable because of the % sign
},
'targets': [
{
'target_name': '<(module_name)',
Expand Down Expand Up @@ -46,6 +49,11 @@
'MAPNIK_GIT_REVISION="<!@(mapnik-config --git-describe)"',
],
'conditions': [
['ENABLE_GLIBC_WORKAROUND != "false"', {
'sources': [
"src/glibc_workaround.cpp"
]
}],
['OS=="win"',
{
'include_dirs':[
Expand Down
26 changes: 26 additions & 0 deletions src/glibc_workaround.cpp
Original file line number Diff line number Diff line change
@@ -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__

0 comments on commit 176a87d

Please sign in to comment.