[cmake-developers] [CMake 0014870]: FindMPI.cmake returns 32-bit libraries on 64-bit systems for Fortran-only projects

Mantis Bug Tracker mantis at public.kitware.com
Wed Apr 9 16:22:10 EDT 2014


The following issue has been SUBMITTED. 
====================================================================== 
http://www.cmake.org/Bug/view.php?id=14870 
====================================================================== 
Reported By:                Melven Roehrig-Zoellner
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   14870
Category:                   CMake
Reproducibility:            always
Severity:                   major
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2014-04-09 16:22 EDT
Last Modified:              2014-04-09 16:22 EDT
====================================================================== 
Summary:                    FindMPI.cmake returns 32-bit libraries on 64-bit
systems for Fortran-only projects
Description: 
Linker errors for pure Fortran projects using MPI because find_package(MPI)
adds a 32-bit library to MPI_Fortran_LIBRARIES.
This occurs with the PGI-Compilers, but could also affect other
compilers/MPI-versions.

This affects at least CMake 2.8.11 and 2.8.12

Steps to Reproduce: 
Minimal CMakeLists-example:

project(test Fortran)
find_package(MPI REQUIRED)
message(STATUS ${MPI_Fortran_LIBRARIES})

For PGI-Fortran-Compilers:
This shows: [...]/usr/lib/librt.so
But must be: [...]/usr/lib64/librt.so
So Linking with MPI_Fortran_LIBRARIES produces linker errors.

In FindMPI.cmake system libraries are searched in /usr/lib and not in
/usr/lib64. One can circumvent this bug through enabling C/C++, but this is not
always an option (I only have a PGI Fortran License)

Additional Information: 
Possible bugfix:
In FindMPI.cmake replace:
        # add the compiler implicit directories because some compilers
        # such as the intel compiler have libraries that show up
        # in the showme list that can only be found in the implicit
        # link directories of the compiler. Do this for C++ and C
        # compilers if the implicit link directories are defined.
        if (DEFINED CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES)
          set(MPI_LINK_PATH
            "${MPI_LINK_PATH};${CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES}")
        endif ()

        if (DEFINED CMAKE_C_IMPLICIT_LINK_DIRECTORIES)
          set(MPI_LINK_PATH
            "${MPI_LINK_PATH};${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}")
        endif ()
by the respective language-specific variant:
        # add the compiler implicit directories because some compilers
        # such as the intel compiler have libraries that show up
        # in the showme list that can only be found in the implicit
        # link directories of the compiler.
        if (DEFINED CMAKE_${lang}_IMPLICIT_LINK_DIRECTORIES)
          set(MPI_LINK_PATH
            "${MPI_LINK_PATH};${CMAKE_${lang}_IMPLICIT_LINK_DIRECTORIES}")
        endif ()

====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2014-04-09 16:22 Melven Roehrig-ZoellnerNew Issue                               
    
2014-04-09 16:22 Melven Roehrig-ZoellnerFile Added: FindMPI.cmake               
    
======================================================================



More information about the cmake-developers mailing list