MantisBT - CMake | |||||
View Issue Details | |||||
ID | Project | Category | View Status | Date Submitted | Last Update |
0013249 | CMake | CMakeSetup | public | 2012-05-25 14:07 | 2016-06-10 14:31 |
Reporter | Travis Horine | ||||
Assigned To | Kitware Robot | ||||
Priority | normal | Severity | minor | Reproducibility | always |
Status | closed | Resolution | moved | ||
Platform | Linux | OS | RedHat Enterprise | OS Version | 5 |
Product Version | CMake 2.8.4 | ||||
Target Version | Fixed in Version | ||||
Summary | 0013249: Static fortran executables fail to build due to a missing libintlc reference. | ||||
Description | Not 100% sure if this is a bug but thought I should submit it just in case. As I understand it, the first time cmake runs it tries to figure out some basic things like which compiler to use and what the compiler needs by way of basic flags,etc... I'm not sure why but according to the CMakeOutput.log generated during this compiler detection phase, cmake is trying to collect an explicit list of the implicit libraries used by the compiler. It then apparently applies these implicit libraries explicitly to each target link when the target was built with the associated compiler. Assuming that is what is happening then there may be a problem with that approach using the Intel 12.0.2 fortran compiler. That compiler reports the implicit use of a so called 'intlc' library which appears to only exist in shared object form on my machine. I think the compiler reports this as an implicit library because CMake is invoking it with the '-i_dynamic' flag (see cmake-2.8.4/share/cmake-2.8/Modules/Platform/Linux-Intel-Fortran.cmake). '-i_dynamic' is ostensibly slang for the 'shared-intel' flag. Since this -i_dynamic flag causes the intel compiler to report 'intlc' as an implicit library the -lintlc flag is therefore being explicitly appended to any link commands even when the '-static' flag is also present. Although my executable does not actually need this intlc library (ie...I can remove it manually from the link line and get a functional static build) the compiler fails to compile when the '-static' flag is present simply because it cannot find a static version of the intlc library ie.. 'libintlc.a' Assuming it is important for CMake to continue to explicitly list the normally 'implicit' libraries on the link lines then there may be a need to weed out those libraries which do not have static counter parts for a given compiler. At least, my workaround for this has been to use LIST(REMOVE_ITEM CMAKE_Fortran_IMPLICIT_LINK_LIBRARIES intlc) in my CMakeLists.txt file before trying to build the static executable. | ||||
Steps To Reproduce | basically: Use add_executable to build a fortran executable with CMAKE_EXE_LINKER_FLAGS set to "-static". In my case, (maybe this is important) I am building a mixed language executable where the C++ compiler (icpc) builds an object, the Fortran compiler (ifort) builds an object and then the C++ compiler (icpc) is invoked for linking the two objects into a static executable. | ||||
Additional Information | My CMakeList file is something like this: SET(CMAKE_EXE_LINKER_FLAGS "-static") ADD_EXECUTABLE(file file.cpp) TARGET_LINK_LIBRARIES(file alib blib) Where alib is a library built in the parent directory and blib is a library built in a subdirectory of the file.cpp source. | ||||
Tags | fortran, intel, linker | ||||
Relationships | |||||
Attached Files | |||||
Issue History | |||||
Date Modified | Username | Field | Change | ||
2012-05-25 14:07 | Travis Horine | New Issue | |||
2012-05-25 14:15 | Travis Horine | Note Added: 0029567 | |||
2012-05-25 14:24 | Travis Horine | Tag Attached: compiler | |||
2012-05-25 14:24 | Travis Horine | Tag Attached: fortran | |||
2012-05-25 14:24 | Travis Horine | Tag Attached: intel | |||
2012-05-25 14:24 | Travis Horine | Tag Detached: compiler | |||
2012-05-25 14:24 | Travis Horine | Tag Attached: linker | |||
2012-05-25 14:47 | Brad King | Note Added: 0029568 | |||
2012-05-25 14:47 | Brad King | Status | new => backlog | ||
2012-05-25 15:25 | Travis Horine | Note Added: 0029569 | |||
2016-06-10 14:28 | Kitware Robot | Note Added: 0042054 | |||
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 | |||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|