MantisBT - CMake | |||||
View Issue Details | |||||
ID | Project | Category | View Status | Date Submitted | Last Update |
0015607 | CMake | CMake | public | 2015-06-10 06:35 | 2016-06-10 14:31 |
Reporter | Martin Baute | ||||
Assigned To | Kitware Robot | ||||
Priority | normal | Severity | minor | Reproducibility | always |
Status | closed | Resolution | moved | ||
Platform | OS | OS Version | |||
Product Version | CMake 3.2.3 | ||||
Target Version | Fixed in Version | ||||
Summary | 0015607: Lack of 64bit support (AIX / XL compiler) | ||||
Description | On AIX using IBM's XL compiler, the default is for various tools (compiler, linker, ar, ...) to handle and generate 32bit binaries. To get 64bit binaries, explicit flags are necessary: -q64 for the compiler during compilation and linkage, -X64 to 'ar', 'CreateExportList' and probably a couple others I have forgotten. As of now, setting these has to be done by the client (including a couple of tweaks, see "Steps to Reproduce"). This wouldn't be too bad, except for 64bit shared libraries. To export symbols from the lib, the XL-supplied tool CreateExportList needs to be called with -X64 as well. Looking at Modules/Compiler/XL.cmake: set(CMAKE_${lang}_CREATE_SHARED_LIBRARY "${CMAKE_XL_CreateExportList} <OBJECT_DIR>/objects.exp <OBJECTS>" ... There is no flag to be set for CreateExportList (which would require "-X64" in front of "<OBJECT_DIR>/objects.exp"). Manually setting the whole of CMAKE_${lang}_CREATE_SHARED_LIBRARY to something *with* appropriate flags is very heavy-handed, hardcoding the "-X64" into the CMake-owned file even more so. The only solution I could come up with was to hardcode CMAKE_XL_CreateExportList before calling project(), which is not a light touch either. All told, I feel that CMake should provide a mechanics to set 32bit / 64bit / 32/64bit mode on AIX (and other platforms supporting such), which sets the various flags appropriately without further intervention by client CMakeLists.txt. Unfortunately I am not competent enough with CMake's inner workings to provide a patch, or even a suggestion. | ||||
Steps To Reproduce | /* mylib.cpp */ #include <iostream> void mylib( void ) { std::cout << "Hello world!\n"; return; } /* mytest.cpp */ void mylib( void ); int main( void ) { mylib(); return 0; } ## CMakeLists.txt ## cmake_minimum_required( VERSION 3.2.3 FATAL_ERROR ) # This should not be necessary -- CMakeLists.txt is supposed to be # (mostly) toolchain-agnostic! find_program( CMAKE_XL_CreateExportList NAMES CreateExportList DOC "IBM XL CreateExportList tool" ) if ( AIX64 ) set( CMAKE_XL_CreateExportList "/usr/vacpp/bin/CreateExportList -X64" ) endif() # end_rant project( aixproblems ) option( AIX64 "Create 64bit binaries, default: ON." ON ) add_library( mylib mylib.cpp ) add_executable( mytest mytest.cpp ) # This should not be necessary -- CMakeLists.txt is supposed to be # (mostly) toolchain-agnostic! if ( AIX64 ) set_property( TARGET mylib mytest APPEND_STRING PROPERTY COMPILE_FLAGS "-q64 " ) set_property( TARGET mylib mytest APPEND_STRING PROPERTY LINK_FLAGS "-q64 " ) set_property( TARGET mylib mytest APPEND_STRING PROPERTY STATIC_LIBRARY_FLAGS "-X64 " ) # AIX 'ar' requires "-X64" *before* cr / r. set( CMAKE_CXX_ARCHIVE_CREATE "<CMAKE_AR> <LINK_FLAGS> cr <TARGET> <OBJECTS>" ) set( CMAKE_CXX_ARCHIVE_APPEND "<CMAKE_AR> <LINK_FLAGS> r <TARGET> <OBJECTS>" ) # ...and I have probably forgoten half a dozen settings, # and broken a couple of rules as well. endif() # end_rant target_link_libraries( mytest mylib ) | ||||
Additional Information | Mailing list thread of another CMake user with the same problem (which finally made me find a workaround for the CreateExportList issue): https://www.mail-archive.com/cmake%40cmake.org/msg51270.html [^] | ||||
Tags | No tags attached. | ||||
Relationships | |||||
Attached Files | |||||
Issue History | |||||
Date Modified | Username | Field | Change | ||
2015-06-10 06:35 | Martin Baute | New Issue | |||
2015-06-10 07:48 | Martin Baute | Note Added: 0038898 | |||
2015-06-10 08:15 | Martin Baute | Note Edited: 0038898 | bug_revision_view_page.php?bugnote_id=38898#r1804 | ||
2015-06-10 08:35 | Brad King | Note Added: 0038900 | |||
2015-06-10 09:03 | Martin Baute | Note Added: 0038901 | |||
2015-06-10 09:10 | Brad King | Note Added: 0038902 | |||
2015-06-10 09:10 | Brad King | Status | new => backlog | ||
2016-06-10 14:29 | Kitware Robot | Note Added: 0042791 | |||
2016-06-10 14:29 | Kitware Robot | Status | backlog => 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 |
Notes | |||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|