From f3ac221ffdaafcf2b545d913026f3dc119a18098 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Sun, 1 Jul 2018 16:06:11 +0200 Subject: [PATCH] Fix deb build failure on Xenial: disable -fPIE Correct 898a8c3c0ce to work when newer debhelper-10.2 is installed from xenial-backports (or jessie-backports). Use gcc version instead of debproxy version, this is likely a gcc issue (as disabling LTO and gcc's linker plugin fixes it). --- debian/autobake-deb.sh | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/debian/autobake-deb.sh b/debian/autobake-deb.sh index 26cb9a926d0..94577c2dded 100755 --- a/debian/autobake-deb.sh +++ b/debian/autobake-deb.sh @@ -29,6 +29,12 @@ then sed 's|-DDEB|-DWITHOUT_TOKUDB_STORAGE_ENGINE=true -DWITHOUT_MROONGA_STORAGE_ENGINE=true -DWITHOUT_ROCKSDB_STORAGE_ENGINE=true -DDEB|' -i debian/rules fi +# Convert gcc version to numberical value. Format is Mmmpp where M is Major +# version, mm is minor version and p is patch. +# -dumpfullversion & -dumpversion to make it uniform across old and new (>=7) +GCCVERSION=$(gcc -dumpfullversion -dumpversion | sed -e 's/\.\([0-9][0-9]\)/\1/g' \ + -e 's/\.\([0-9]\)/0\1/g' \ + -e 's/^[0-9]\{3,4\}$/&00/') # Look up distro-version specific stuff # @@ -78,19 +84,12 @@ fi # Debian Jessie and older and on Ubuntu Xenial and older with the following error message: # /usr/bin/ld.bfd.real: /tmp/ccOIwjFo.ltrans0.ltrans.o: relocation R_X86_64_PC32 against symbol # `toku_product_name_strings' can not be used when making a shared object; recompile with -fPIC -# Therefore we need to disable PIE on those releases using debhelper as proxy for detection. -if ! apt-cache madison debhelper | grep 'debhelper *| *1[0-9]\.' >/dev/null 2>&1 +# Therefore we need to disable PIE on those releases using gcc as proxy for detection. +if [[ $GCCVERSION -lt 60000 ]] then sed 's/hardening=+all$/hardening=+all,-pie/' -i debian/rules fi - -# Convert gcc version to numberical value. Format is Mmmpp where M is Major -# version, mm is minor version and p is patch. -# -dumpfullversion & -dumpversion to make it uniform across old and new (>=7) -GCCVERSION=$(gcc -dumpfullversion -dumpversion | sed -e 's/\.\([0-9][0-9]\)/\1/g' \ - -e 's/\.\([0-9]\)/0\1/g' \ - -e 's/^[0-9]\{3,4\}$/&00/') # Don't build rocksdb package if gcc version is less than 4.8 or we are running on # x86 32 bit. if [[ $GCCVERSION -lt 40800 ]] || [[ $(arch) =~ i[346]86 ]] || [[ $TRAVIS ]]