From f32f3b34aeb9954b0e4af1bcbf464b0a057587bf Mon Sep 17 00:00:00 2001 From: Dane Springmeyer Date: Wed, 15 Nov 2017 09:53:56 -0800 Subject: [PATCH 1/3] add glibc_workaround.cpp if option is chosen This reverts commit 751d9bff1672f6b8cbd2b5ebe2eb460223746806. --- src/build.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/build.py b/src/build.py index 5a8fb227e..66b52aed2 100644 --- a/src/build.py +++ b/src/build.py @@ -313,6 +313,13 @@ cairo/process_markers_symbolizer.cpp cairo/process_group_symbolizer.cpp """) +if env['ENABLE_GLIBC_WORKAROUND']: + source += Split( + """ + glibc_workaround.cpp + """ + ) + if env['HAS_CAIRO']: lib_env.AppendUnique(LIBPATH=env['CAIRO_LIBPATHS']) lib_env.Append(CPPDEFINES = '-DHAVE_CAIRO') From 5e06dfb50b7879f0fde4ecdca9d20cedd2652c46 Mon Sep 17 00:00:00 2001 From: Dane Springmeyer Date: Wed, 15 Nov 2017 20:32:23 -0800 Subject: [PATCH 2/3] add script that asserts on expected symbols --- .travis.yml | 4 +--- scripts/check_glibcxx.sh | 31 +++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 3 deletions(-) create mode 100755 scripts/check_glibcxx.sh diff --git a/.travis.yml b/.travis.yml index dd89b3aec..949920138 100644 --- a/.travis.yml +++ b/.travis.yml @@ -106,15 +106,13 @@ 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 - if [[ ${RESULT} != 0 ]] && [[ ${CXX} =~ 'clang++' ]]; then false; fi; - enabled ${COVERAGE} coverage - enabled ${BENCH} make bench + - ./scripts/check_glibcxx.sh after_success: - enabled ${TRIGGER} trigger_downstream diff --git a/scripts/check_glibcxx.sh b/scripts/check_glibcxx.sh new file mode 100755 index 000000000..d8d40924e --- /dev/null +++ b/scripts/check_glibcxx.sh @@ -0,0 +1,31 @@ +#!/bin/bash + +set -eu +set -o pipefail +shopt -s nullglob + +: ' + +Ensure no GLIBCXX_3.4.2x symbols are present in the binary +if ENABLE_GLIBC_WORKAROUND is set. + +If symbols >= 3.4.20 then it means the binaries would not run on ubuntu trusty without upgrading libstdc++ + +' +function check() { + local RESULT=0 + nm ${1} | grep "GLIBCXX_3.4.2[0-9]" > /tmp/out.txt || RESULT=$? + if [[ ${RESULT} != 0 ]]; then + echo "Success: GLIBCXX_3.4.2[0-9] symbols not present in binary (as expected)" + else + echo "$(cat /tmp/out.txt | c++filt)" + exit 1 + fi +} + +if [[ ${ENABLE_GLIBC_WORKAROUND:-false} == true ]]; then + for i in src/libmapnik*; do + echo "checking $i" + check $i + done +fi \ No newline at end of file From a2b7f642e0f6b158b9be1bea3a6c71e52be9ae06 Mon Sep 17 00:00:00 2001 From: Dane Springmeyer Date: Wed, 15 Nov 2017 21:48:20 -0800 Subject: [PATCH 3/3] check symbols for all modes, only error if symbols exist + ENABLE_GLIBC_WORKAROUND --- scripts/check_glibcxx.sh | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/scripts/check_glibcxx.sh b/scripts/check_glibcxx.sh index d8d40924e..9e4cbc54f 100755 --- a/scripts/check_glibcxx.sh +++ b/scripts/check_glibcxx.sh @@ -12,6 +12,9 @@ if ENABLE_GLIBC_WORKAROUND is set. If symbols >= 3.4.20 then it means the binaries would not run on ubuntu trusty without upgrading libstdc++ ' + +FINAL_RETURN_CODE=0 + function check() { local RESULT=0 nm ${1} | grep "GLIBCXX_3.4.2[0-9]" > /tmp/out.txt || RESULT=$? @@ -19,13 +22,15 @@ function check() { echo "Success: GLIBCXX_3.4.2[0-9] symbols not present in binary (as expected)" else echo "$(cat /tmp/out.txt | c++filt)" - exit 1 + if [[ ${ENABLE_GLIBC_WORKAROUND:-false} == true ]]; then + FINAL_RETURN_CODE=1 + fi fi } -if [[ ${ENABLE_GLIBC_WORKAROUND:-false} == true ]]; then - for i in src/libmapnik*; do - echo "checking $i" - check $i - done -fi \ No newline at end of file +for i in src/libmapnik*; do + echo "checking $i" + check $i +done + +return ${FINAL_RETURN_CODE} \ No newline at end of file