Huge thanks to our Platinum Members Endace and LiveAction,
and our Silver Member Veeam, for supporting the Wireshark Foundation and project.

Wireshark-dev: Re: [Wireshark-dev] -fPIC on Ubuntu Wily

From: Bálint Réczey <balint@xxxxxxxxxxxxxxx>
Date: Thu, 17 Dec 2015 11:51:31 +0100
Hi All,

I sadly became more and more convinced that starting the adoption of
compiling with -fPIE was an overly optimistic move on my side. :-(
It seems that there are too many integration corner cases to handle
where -fPIE breaks and it may be a better idea to let the
distribution-specific scripts like debian/rules set it on systems
where it is known to work out of the box.

What do you think about that approach?

Cheers,
Balint

2015-10-31 0:11 GMT+04:00 Hauke Mehrtens <hauke@xxxxxxxxxx>:
> On 10/27/2015 11:45 PM, Evan Huus wrote:
>> 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
>
> Hi,
>
> I have the same problem in debian testing with QT 5.4 and also with the
> new qt5.5.1 which I got as a normal update today.
>
> Here is the issue:
> https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=11643
>
> Here someone else reported the same problem some time ago:
> https://www.wireshark.org/lists/wireshark-bugs/201505/msg00563.html
>
> Hauke