Bug#829329: Error combining hardening flags with Qt5
Package: libqt5core5a
Version: 5.6.1+dfsg-3
Severity: normal
I'm trying to enable Qt5 support for the lyx package I maintain.
I have already enabled hardening flags, and I get the following error when
building the package:
g++ -DHAVE_CONFIG_H -I. -I../../../src/support -I../.. -Wall -Wextra
-I../../../src/support/.. -DQT_NO_STL -DQT_NO_KEYWORDS
-I/usr/include/x86_64 -linux-gnu/qt5/QtConcurrent
-I/usr/include/x86_64-linux-gnu/qt5
-I/usr/include/x86_64-linux-gnu/qt5/QtSvg
-I/usr/include/x86_64-linux-gnu/qt5
-I/usr/include/x86_64-linux-gnu/qt5/QtWidgets
-I/usr/include/x86_64-linux-gnu/qt5
-I/usr/include/x86_64-linux-gnu/qt5/QtGui
-I/usr/include/x86_64-linux-gnu/qt5
-I/usr/include/x86_64-linux-gnu/qt5/QtCore
-I/usr/include/x86_64-linux-gnu/qt5 -Wdate-time -D_FORTIFY_SOURCE=2
-std=c++11 -fPIC -O2 -Wno-deprecated-declarations -g -O2 -fPIE
-fstack-protector-strong -Wformat -Werror=format-security -c -o
ConsoleApplication.o ../../../src/support/ConsoleApplication.cpp
In file included from
/usr/include/x86_64-linux-gnu/qt5/QtCore/qcoreapplication.h:37:0,
from
/usr/include/x86_64-linux-gnu/qt5/QtCore/QCoreApplication:1,
from
../../../src/support/../support/ConsoleApplicationPrivate.h:16,
from ../../../src/support/ConsoleApplication.cpp:15:
/usr/include/x86_64-linux-gnu/qt5/QtCore/qglobal.h:1087: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. "\
^
By default, -fPIC is used for shared libraries and -fPIE for
executables such as lyx. The latter takes precedence as it is later in
the argument list.
I can get away with the problem if I append -fPIC to CXXFLAGS but I
think this is not the proper solution, but a workaround.
A similar issue was reported also on Bug: #828878 and the fix was the
aforementioned workaround.
Kind regards,
Nick
--
=Do-
N.AND
Reply to: