Project

General

Profile

Bug #1401

CMake HAVE_SSL test failing due to missing -fPIC

Added by Fylwind over 8 years ago. Updated about 2 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
Build System
Target version:
-
Start date:
03/29/2016
Due date:
% Done:

0%

Estimated time:
Version:
0.10.0
OS:
Linux

Description

HAVE_SSL test seems to be failing on my system when -DUSE_QT5=ON is set (Arch Linux 4.4.5-1). CMake is trying to compile the test without -fPIC but the library was built with -reduce-relocations.

The rest of the software builds just fine, but this particular test fails so it causes SSL to be disabled by default, unless forced on by HAVE_SSL.

Quassel version is 0.12.3, but the dropdown menu of the bugtracker doesn't have that.

Error log:

Performing C++ SOURCE FILE Test HAVE_SSL failed with the following output:
Change Dir: /tmp/foo/CMakeFiles/CMakeTmp

Run Build Command:"/usr/bin/make" "cmTC_ae013/fast" 
/usr/bin/make -f CMakeFiles/cmTC_ae013.dir/build.make CMakeFiles/cmTC_ae013.dir/build
make[1]: Entering directory '/tmp/foo/CMakeFiles/CMakeTmp'
Building CXX object CMakeFiles/cmTC_ae013.dir/src.cxx.o
/usr/bin/c++    -I/usr/include/qt -I/usr/include/qt/QtCore -I/usr/lib/qt/mkspecs/linux-g++  -std=c++11 -Wall -Wextra -Wnon-virtual-dtor -fno-strict-aliasing -Wundef -Wcast-align -Wpointer-arith -Wformat-security -fno-check-new -fno-common -Woverloaded-virtual  -DHAVE_SSL   -o CMakeFiles/cmTC_ae013.dir/src.cxx.o -c /tmp/foo/CMakeFiles/CMakeTmp/src.cxx
In file included from /tmp/foo/CMakeFiles/CMakeTmp/src.cxx:2:0:
/usr/include/qt/QtCore/qglobal.h:1090: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. "\
    ^
CMakeFiles/cmTC_ae013.dir/build.make:65: recipe for target 'CMakeFiles/cmTC_ae013.dir/src.cxx.o' failed
make[1]: *** [CMakeFiles/cmTC_ae013.dir/src.cxx.o] Error 1
make[1]: Leaving directory '/tmp/foo/CMakeFiles/CMakeTmp'
Makefile:126: recipe for target 'cmTC_ae013/fast' failed
make: *** [cmTC_ae013/fast] Error 2

Source file was:

    #include "qglobal.h" 
    #if defined QT_NO_SSL
    #  error "No SSL support" 
    #endif
    int main() {}

History

#1 Updated by oxc over 8 years ago

I tried moving the code block which sets CMAKE_POSITION_INDEPENDENT_CODE above the check, which indeed causes -fPIE to be added, but according to Qt that is not sufficient:

"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)."

I could not figure out how to cause -fPIC to get added instead.

Also available in: Atom PDF