Wireshark-dev: [Wireshark-dev] -fPIC on Ubuntu Wily
From: Evan Huus <eapache@xxxxxxxxx>
Date: Tue, 27 Oct 2015 18:45:29 -0400
After recently upgrading to Ubuntu 15.10, my cmake configure failed with:
-- Performing Test WORKS_WITH_FPIC - Failed
CMake Error at CMakeLists.txt:938 (message):
  Couldn't compile Qt without -fPIC nor with -fPIC

Digging into the logs, the test being run (and its output) is as follows:

/usr/bin/c++    -Wall -W -Wextra -Wendif-labels -Wpointer-arith
-Warray-bounds -Wformat-security -fwrapv -fno-strict-overflow
-fno-delete-null-pointer-checks -Wvla -Waddress -Wattributes
-Wdiv-by-zero -Wignored-qualifiers -Wpragmas -Wno-overlength-strings
-Wwrite-strings -Wno-long-long -fexcess-precision=fast
-DWORKS_WITH_FPIC -fPIC -fPIE -I/usr/include/x86_64-linux-gnu/qt5
-I/usr/include/x86_64-linux-gnu/qt5/QtCore
-I/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++-64    -o
CMakeFiles/cmTryCompileExec1538407922.dir/src.cxx.o -c
/home/eapache/pkg/linux_amd64/wireshark.org/wireshark/CMakeFiles/CMakeTmp/src.cxx
In file included from
/usr/include/x86_64-linux-gnu/qt5/QtCore/qnamespace.h:37:0,
                 from /usr/include/x86_64-linux-gnu/qt5/QtCore/qobjectdefs.h:41,
                 from /usr/include/x86_64-linux-gnu/qt5/QtCore/qobject.h:40,
                 from
/usr/include/x86_64-linux-gnu/qt5/QtCore/qabstractanimation.h:37,
                 from /usr/include/x86_64-linux-gnu/qt5/QtCore/QtCore:4,
                 from
/home/eapache/pkg/linux_amd64/wireshark.org/wireshark/CMakeFiles/CMakeTmp/src.cxx:1:
/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. "\
    ^

I suspect because we are passing both -fPIC *and* -fPIE (and that
-fPIE is being passed second) something is not working correctly? I'm
not familiar with how those flags work together.

Thoughts?
Evan