MantisBT - CMake | |||||
View Issue Details | |||||
ID | Project | Category | View Status | Date Submitted | Last Update |
0013282 | CMake | CMake | public | 2012-06-08 10:41 | 2016-06-10 14:31 |
Reporter | brett.dellegrazie | ||||
Assigned To | Kitware Robot | ||||
Priority | normal | Severity | minor | Reproducibility | always |
Status | closed | Resolution | moved | ||
Platform | AIX 6.1 with XLC | OS | AIX | OS Version | 6.1 |
Product Version | CMake 2.8.8 | ||||
Target Version | Fixed in Version | ||||
Summary | 0013282: No way to explicitly specify shared library exported symbols with xlc on AIX | ||||
Description | Hi, The definition for the XLC compiler (modules/Compiler/XL.cmake) on AIX includes the explicit call to the CMAKE_XL_CreateExportList (IBM's CreateExportList tool) as follows: set(CMAKE_${lang}_CREATE_SHARED_LIBRARY "${CMAKE_XL_CreateExportList} <OBJECT_DIR>/objects.exp <OBJECTS>" "<CMAKE_${lang}_COMPILER> <CMAKE_SHARED_LIBRARY_${lang}_FLAGS> <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS> -Wl,-bE:<OBJECT_DIR>/objects.exp <CMAKE_SHARED_LIBRARY_SONAME_${lang}_FLAG><TARGET_SONAME> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>" ) Note the first line of the script: ${CMAKE_XL_CreateExportList} <OBJECT_DIR>/objects.exp <OBJECTS> This generates an export file in the objects dir which: (a) Fails to build if there are no objects, because the file will not exist if there are no objects. Linking several static libraries together to make a shared library will cause this. In our case the static libraries are externally supplied and no source code is available (just headers). There's no way of creating a shared library version without manually generating an empty objects.exp file in the OBJECTS_DIR directory. (b) Prevents the use of any explicit exports file in the general case Is there any possibility of making this an optional per-target task (such as a PRE_LINK step) that can be disabled? Its certainly easy enough to add an explicit exports file to the LINK_FLAGS on a per-target basis but there's no way of disabling the default export creation without resorting to replicating the XL.cmake file and modifying the CMake policy 0017 so cmake picks up the modified version (not maintainable long-term) | ||||
Steps To Reproduce | 1. requires IBM xlc compiler on AIX. case A: Fails due to missing objects.exp: PROJECT(test_case_a) cmake_minimum_required(VERSION 2.8) # Libraries myA and myB are static, externally supplied with header files # Doesn't matter if these are C or C++, the same problem occurs with both # In this case though, assume C libraries for linking purposes set( myA_SRCS myA.h ) set( myB_SRCS myB.h ) # Static libraries add_library( myA STATIC IMPORTED ) set_target_properties( myA PROPERTIES IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/myA.a ) add_library( myB STATIC IMPORTED ) set_target_properties( myB PROPERTIES IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/myB.a ) # Create shared library variant of both add_library( myC SHARED ${A_SRCS} ${B_SRCS} ) set_target_properties( myC PROPERTIES LINKER_LANGUAGE C PUBLIC_HEADER "${A_SRCS}" "${B_SRCS}" ) target_link_libraries( myC myA myB ) | ||||
Additional Information | A workaround would be to: 1) disable policy CMP0017 2) Supply our own copy of modules/Compiler/XL.cmake Removing the entire "if (CMAKE_XL_CreateExportList)" section This leaves the CMAKE_${lang}_SHARED_LIBRARY_CREATE rule at the default. 3) Supply the explicit export list as a compile / link flag per-target as appropriate | ||||
Tags | No tags attached. | ||||
Relationships | |||||
Attached Files | |||||
Issue History | |||||
Date Modified | Username | Field | Change | ||
2012-06-08 10:41 | brett.dellegrazie | New Issue | |||
2012-06-08 12:55 | Brad King | Note Added: 0029649 | |||
2012-06-08 13:02 | Brad King | Note Added: 0029651 | |||
2012-06-08 13:07 | Brad King | Note Added: 0029652 | |||
2012-06-08 13:07 | Brad King | Status | new => backlog | ||
2012-06-08 13:26 | brett.dellegrazie | Note Added: 0029654 | |||
2012-06-20 13:27 | brett.dellegrazie | Note Added: 0029775 | |||
2012-06-20 14:19 | Brad King | Note Added: 0029779 | |||
2016-06-10 14:28 | Kitware Robot | Note Added: 0042061 | |||
2016-06-10 14:28 | Kitware Robot | Status | backlog => resolved | ||
2016-06-10 14:28 | Kitware Robot | Resolution | open => moved | ||
2016-06-10 14:28 | Kitware Robot | Assigned To | => Kitware Robot | ||
2016-06-10 14:31 | Kitware Robot | Status | resolved => closed |
Notes | |||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|