View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0016002CMakeCMakepublic2016-03-02 09:052016-06-10 14:31
ReporterJordan 
Assigned ToKitware Robot 
PrioritynormalSeverityblockReproducibilityalways
StatusclosedResolutionmoved 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0016002: CMake strips -fPIC from executable compilation which blocks the use of Qt5 and GCC5
DescriptionI understand this case https://cmake.org/Bug/view.php?id=9659. [^]
However, Qt5 and GCC 5 are now forcing fPIC on all compilation.
I have brought this to QT's attention with https://bugreports.qt.io/browse/QTBUG-51593, [^] but they say the policy will not change.
As far as I can tell there is no way to apply fPIC to the executable.
It appears to be stripped from the CMAKE_CXX_FLAGS.
This blocks the use of Qt5 and GCC5.
Steps To ReproduceTake prebuild Qt-5.4.1 or new.
Use GCC-5 or newer.
TagsNo tags attached.
Attached Files

 Relationships

  Notes
(0040588)
Clinton Stimpson (developer)
2016-03-02 09:25

This snippet from Qt5CoreConfigExtras.cmake which is part of a Qt5 installation may be relevant.


# Targets using Qt need to use the POSITION_INDEPENDENT_CODE property. The
# Qt5_POSITION_INDEPENDENT_CODE variable is used in the # qt5_use_module
# macro to add it.
set(Qt5_POSITION_INDEPENDENT_CODE True)
set(Qt5Core_EXECUTABLE_COMPILE_FLAGS "-fPIC")
if (CMAKE_VERSION VERSION_LESS 2.8.12
        AND (NOT CMAKE_CXX_COMPILER_ID STREQUAL "GNU"
        OR CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0))
    set_property(TARGET Qt5::Core APPEND PROPERTY INTERFACE_POSITION_INDEPENDENT_CODE "ON")
else()
    set_property(TARGET Qt5::Core APPEND PROPERTY INTERFACE_COMPILE_OPTIONS -fPIC)
endif()
(0040589)
Jordan (reporter)
2016-03-02 10:16

I use SET(CMAKE_POSITION_INDEPENDENT_CODE ON CACHE BOOL "") and I SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Core_EXECUTABLE_COMPILEFLAGS}" CACHE BOOL "" FORCE)
neither works.
(0042954)
Kitware Robot (administrator)
2016-06-10 14:29

Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.

 Issue History
Date Modified Username Field Change
2016-03-02 09:05 Jordan New Issue
2016-03-02 09:25 Clinton Stimpson Note Added: 0040588
2016-03-02 10:16 Jordan Note Added: 0040589
2016-06-10 14:29 Kitware Robot Note Added: 0042954
2016-06-10 14:29 Kitware Robot Status new => resolved
2016-06-10 14:29 Kitware Robot Resolution open => moved
2016-06-10 14:29 Kitware Robot Assigned To => Kitware Robot
2016-06-10 14:31 Kitware Robot Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team