Wireshark-dev: [Wireshark-dev] Build wireshark-qt with Clang : -fPIC or -fPIE
From: Alexis La Goutte <alexis.lagoutte@xxxxxxxxx>
Date: Thu, 7 Nov 2013 14:34:32 +0100
Hi,

When i try to build wireshark-qt with clang (and autotools) i have the following error message :


dev:~/wireshark-clang/ui/qt$ make
  CXX      accordion_frame.o
In file included from /usr/include/qt5/QtGui/qwindowdefs.h:45:0,
                 from /usr/include/qt5/QtWidgets/qwidget.h:45,
                 from /usr/include/qt5/QtWidgets/qframe.h:45,
                 from /usr/include/qt5/QtWidgets/QFrame:1,
                 from accordion_frame.h:27,
                 from accordion_frame.cpp:28:
/usr/include/qt5/QtCore/qglobal.h:1079:4: error: #error "You must build your code with position independent code if Qt was built with -reduce-relocations. " "Compile your code with -fPIC or -fPIE."
 #  error "You must build your code with position independent code if Qt was built with -reduce-relocations. "\
    ^

I fixed the issue with :
--- a/configure.ac
+++ b/configure.ac
@@ -927,7 +927,7 @@ AC_WIRESHARK_LDFLAGS_CHECK([-Wl,--as-needed])
 # in the address space to make attacks more difficult.
 #
 CFLAGS_before_pie=$CFLAGS
-AC_WIRESHARK_COMPILER_FLAGS_CHECK(-fPIE, C)
+AC_WIRESHARK_COMPILER_FLAGS_CHECK(-fPIE)
 if test "x$CLFAGS" != "x$CFLAGS_before_pie"
 then
        # Restore CFLAGS

There is any reason to limit -fPIE to only C ?

Regards,