Control: tag -1 patch

Martin Pitt [2015-08-10 12:57 +0200]:
> | /usr/include/x86_64-linux-gnu/qt5/QtCore/qglobal.h:1052:4: error: #error 
> "You must build your code with position independent code if Qt was built with 
> -reduce-relocations. " "Compile your code with -fPIC (-fPIE is not enough)."
> |  #  error "You must build your code with position independent code if Qt 
> was built with -reduce-relocations. "\
> |     ^

This error message is totally misleading. I tried to set

  export DEB_CXXFLAGS_MAINT_APPEND  = -fPIC

in debian/rules, but this doesn't help. Looking at the actual
implementation of that #error shows

| #if !defined(QT_BOOTSTRAPPED) && defined(QT_REDUCE_RELOCATIONS) && 
defined(__ELF__) && \
|     (!defined(__PIC__) || (defined(__PIE__) && defined(Q_CC_GNU) && Q_CC_GNU 
>= 500))
| #  error "You must build your code with position independent code if Qt was 
built with -reduce-relocations. "\
|          "Compile your code with -fPIC (-fPIE is not enough)."
| #endif

As we now build with gcc 5.2, "Q_CC_GNU >= 500" is true, so it does
insist to be built with -fpic/-fPIC, but it seems it rather
objects to being built with -fPIE.

This seems to coincide with this upstream commit:

 http://code.qt.io/cgit/qt/qtbase.git/commit/?id=3eca75d

(either its description or the code change is wrong).

The attached debdiff massages the packages to build again, but
admittedly this feels like a gross hack in Qt.

Thanks,

Martin

-- 
Martin Pitt                        | http://www.piware.de
Ubuntu Developer (www.ubuntu.com)  | Debian Developer  (www.debian.org)
diff -Nru gnuplot5-5.0.1+dfsg1/debian/changelog 
gnuplot5-5.0.1+dfsg1/debian/changelog
--- gnuplot5-5.0.1+dfsg1/debian/changelog       2015-08-10 12:18:41.000000000 
+0200
+++ gnuplot5-5.0.1+dfsg1/debian/changelog       2015-08-10 16:27:23.000000000 
+0200
@@ -1,3 +1,14 @@
+gnuplot5 (5.0.1+dfsg1-2ubuntu1) wily; urgency=medium
+
+  * Add 13_no_pie.patch: Don't build with -fPIE, Qt barfs on that with
+    gcc >= 5. (http://code.qt.io/cgit/qt/qtbase.git/commit/?id=3eca75d)
+    (Closes: #795076)
+  * debian/rules: Also drop "pie" from hardening flags. Instead, build with
+    -fPIC; it's conceptually wrong, but it's what the above Qt check insists
+    on.
+
+ -- Martin Pitt <martin.p...@ubuntu.com>  Mon, 10 Aug 2015 16:06:00 +0200
+
 gnuplot5 (5.0.1+dfsg1-2build1) wily; urgency=medium
 
   * No-change rebuild against libwx*-0v5
diff -Nru gnuplot5-5.0.1+dfsg1/debian/patches/13_no_pie.patch 
gnuplot5-5.0.1+dfsg1/debian/patches/13_no_pie.patch
--- gnuplot5-5.0.1+dfsg1/debian/patches/13_no_pie.patch 1970-01-01 
01:00:00.000000000 +0100
+++ gnuplot5-5.0.1+dfsg1/debian/patches/13_no_pie.patch 2015-08-10 
16:05:58.000000000 +0200
@@ -0,0 +1,28 @@
+Description: Don't build with -fPIE, Qt barfs on that with gcc >= 5. 
(http://code.qt.io/cgit/qt/qtbase.git/commit/?id=3eca75d)
+Author: Martin Pitt <martin.p...@ubuntu.com>
+Bug-Debian: https://bugs.debian.org/795076
+
+Index: gnuplot5-5.0.1+dfsg1/configure
+===================================================================
+--- gnuplot5-5.0.1+dfsg1.orig/configure
++++ gnuplot5-5.0.1+dfsg1/configure
+@@ -14238,7 +14238,6 @@ fi
+         RCC=${QT5LOC}/rcc
+         LRELEASE=${QT5LOC}/lrelease
+       fi
+-      CXXFLAGS="$CXXFLAGS -fPIE"
+     fi
+   fi
+ 
+Index: gnuplot5-5.0.1+dfsg1/configure.in
+===================================================================
+--- gnuplot5-5.0.1+dfsg1.orig/configure.in
++++ gnuplot5-5.0.1+dfsg1/configure.in
+@@ -1208,7 +1208,6 @@ if test "${enable_qt}" = yes ; then
+         RCC=${QT5LOC}/rcc
+         LRELEASE=${QT5LOC}/lrelease
+       fi
+-      CXXFLAGS="$CXXFLAGS -fPIE"
+     fi 
+   fi
+ 
diff -Nru gnuplot5-5.0.1+dfsg1/debian/patches/series 
gnuplot5-5.0.1+dfsg1/debian/patches/series
--- gnuplot5-5.0.1+dfsg1/debian/patches/series  2015-06-29 09:15:11.000000000 
+0200
+++ gnuplot5-5.0.1+dfsg1/debian/patches/series  2015-08-10 16:04:45.000000000 
+0200
@@ -6,3 +6,4 @@
 10_removepicins.patch
 11_fix_linkage_wx.patch
 12_info.patch
+13_no_pie.patch
diff -Nru gnuplot5-5.0.1+dfsg1/debian/rules gnuplot5-5.0.1+dfsg1/debian/rules
--- gnuplot5-5.0.1+dfsg1/debian/rules   2015-06-29 09:15:11.000000000 +0200
+++ gnuplot5-5.0.1+dfsg1/debian/rules   2015-08-10 16:26:55.000000000 +0200
@@ -3,7 +3,7 @@
 %:
        dh $@ --parallel --with autoreconf
 
-export DEB_BUILD_MAINT_OPTIONS := hardening=+all
+export DEB_BUILD_MAINT_OPTIONS := hardening=+all,-pie
 export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed
 
 # Tell compiler where should find lua headers
@@ -12,6 +12,9 @@
 # Force the use of qt5
 export QT_SELECT=qt5
 
+# Qt insists on using -fPIC
+export DEB_CXXFLAGS_MAINT_APPEND = -fPIC
+
 BUILDDIR_NOX = $(CURDIR)/debian/build-nox
 BUILDDIR_X11 = $(CURDIR)/debian/build-x11
 BUILDDIR_QT = $(CURDIR)/debian/build-qt

Attachment: signature.asc
Description: Digital signature

-- 
debian-science-maintainers mailing list
debian-science-maintainers@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/debian-science-maintainers

Reply via email to