View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0010119CMakeCMakepublic2010-01-11 16:012016-06-10 14:31
ReporterKen Moreland 
Assigned ToBrad King 
PrioritynormalSeverityminorReproducibilityhave not tried
StatusclosedResolutionmoved 
PlatformOSOS Version
Product VersionCMake-2-8 
Target VersionFixed in Version 
Summary0010119: 64-bit libraries not found with Fortran project
DescriptionI have a 64-bit Linux machine which means that programs (C, C++, and Fortran) are by default compiled with 64-bit memory access and therefore must be linked against 64-bit libraries. This all works fine for C and C++, but I have found that if the language is Fortran, then FIND_LIBRARY find the 32-bit library instead of the 64-bit version. For example, when I run CMake with the CMakeLists.txt file

PROJECT(findlib Fortran)
FIND_LIBRARY(MATH_LIB m)

on my system I get the following entry in my CMakeCache.txt file.

MATH_LIB:FILEPATH=/usr/lib/libm.so

If I attempt to link with this library, I get an error. However, if I add C to the list of languages like this

PROJECT(findlib Fortran C)
FIND_LIBRARY(MATH_LIB m)

CMake now finds the correct math library.

MATH_LIB:FILEPATH=/usr/lib64/libm.so
TagsNo tags attached.
Attached Files

 Relationships
related to 0014870closedBrad King FindMPI.cmake returns 32-bit libraries on 64-bit systems for Fortran-only projects 

  Notes
(0019096)
Brad King (manager)
2010-01-12 08:28

CMake is able to detect that the C compiler produces 64-bit binaries because it can do a try-compile with sizeof(void*) and encode the result in the binary using a combination of preprocessor and C initializer syntax. We'll need a totally different way to detect the Fortran binary type.

It looks like at least some Fortran compilers preprocess with _LP64 defined for 64-bit architectures.
(0019098)
Brad King (manager)
2010-01-12 09:38

I've committed a fix that will work on at least some platforms, including Linux.

Detect Fortran ABI Information
/cvsroot/CMake/CMake/Modules/CMakeFortranCompiler.cmake.in,v <-- Modules/CMakeFortranCompiler.cmake.in
new revision: 1.15; previous revision: 1.14
/cvsroot/CMake/CMake/Modules/CMakeFortranCompilerABI.F,v <-- Modules/CMakeFortranCompilerABI.F
new revision: 1.2; previous revision: 1.1
(0020977)
Brad King (manager)
2010-06-10 14:59

Commits of interest:

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6c1e2427 [^]
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0457d531 [^]
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a443308c [^]
(0020978)
Brad King (manager)
2010-06-10 15:03

Note for future investigation:

Fortran does not expose pointers in the language so we cannot detect their size with code. Preprocessor-based detection works only in some cases. We need a different approach. Perhaps we should try inspecting the binary produced by the compiler ("file a.out"). For ELF-based systems we can detect the binary type using cmELF.
(0030529)
Brad King (manager)
2012-08-13 10:37

Sending issues I'm not actively working on to the backlog to await someone with time for them.

If an issue you care about is sent to the backlog when you feel it should have been addressed in a different manner, please bring it up on the CMake mailing list for discussion. Sign up for the mailing list here, if you're not already on it:

 http://www.cmake.org/mailman/listinfo/cmake [^]

It's easy to re-activate a bug here if you can find a CMake developer or contributor who has the bandwidth to take it on.
(0041639)
Kitware Robot (administrator)
2016-06-10 14:27

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
2010-01-11 16:01 Ken Moreland New Issue
2010-01-12 08:23 Brad King Status new => assigned
2010-01-12 08:23 Brad King Assigned To => Brad King
2010-01-12 08:28 Brad King Note Added: 0019096
2010-01-12 09:38 Brad King Note Added: 0019098
2010-06-10 14:59 Brad King Note Added: 0020977
2010-06-10 15:03 Brad King Note Added: 0020978
2012-08-13 10:37 Brad King Status assigned => backlog
2012-08-13 10:37 Brad King Note Added: 0030529
2014-04-10 10:26 Brad King Relationship added related to 0014870
2016-06-10 14:27 Kitware Robot Note Added: 0041639
2016-06-10 14:27 Kitware Robot Status backlog => resolved
2016-06-10 14:27 Kitware Robot Resolution open => moved
2016-06-10 14:31 Kitware Robot Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team