Wireshark-dev: Re: [Wireshark-dev] Build wireshark-qt with Clang : -fPIC or -fPIE
On Thu, Nov 7, 2013 at 8:34 AM, Alexis La Goutte
<alexis.lagoutte@xxxxxxxxx> wrote:
> 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 ?
Not that I know of. Note that $(PIE_CFLAGS) is already included in
AM_CPPFLAGS in ui/qt/Makefile.am because that's what fixed the problem
for me the first time a few months ago. It may have been an
unnecessary and/or incorrect way of fixing the issue though.