[CMake] Problem building fortran project on Windows using Intel Fortran 10 compiler

Dunlavy, Daniel M dmdunla at sandia.gov
Wed Oct 24 18:18:29 EDT 2007


Here is a copy of the CMakeLists.txt. I do not believe that anything
below ENABLE_LANGUAGE(Fortran) is causing the problem, as CMakeSetup is
choking on the Fortran tests run as a results of that command. I cannot
generate a VS8 solution. Also, when I put the Fortran libraries in the
directory where the TRY_COMPILE command is testing the Fortran source
from CMakeTestFortranCompiler.cmake, I do not get the error.

Thanks,
Danny

------------------------------------------------------------------------
---
ENABLE_LANGUAGE(Fortran)

SET(BUILD_SHARED_LIBS TRUE)

SET(CMAKE_MODULE_PATH "${epetra_SOURCE_DIR}/cmake")
#FIND_PACKAGE(LAPACK REQUIRED)

FIND_LIBRARY(BLAS_LIBRARY blas DOC "Path to the BLAS implementation")
FIND_LIBRARY(LAPACK_LIBRARY lapack DOC "Path to the LAPACK
implementation")

# Setup configuration options
IF(WIN32)
	SET(F77_FUNC "(name,NAME) name ## _")
	SET(F77_FUNC_ "(name,NAME) name ## __")
ELSE(WIN32)
	SET(F77_FUNC "(name,NAME) name ## _")
	SET(F77_FUNC_ "(name,NAME) name ## _")
ENDIF(WIN32)

SET(HAVE_CASSERT TRUE)
SET(HAVE_CMATH TRUE)
SET(HAVE_CSTDIO TRUE)
SET(HAVE_CSTDLIB TRUE)
SET(HAVE_IOMANIP TRUE)
SET(HAVE_IOSTREAM TRUE)
SET(HAVE_STRING TRUE)

CONFIGURE_FILE(${epetra_SOURCE_DIR}/cmake/Epetra_config.h.in
${CMAKE_CURRENT_BINARY_DIR}/Epetra_config.h)

INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})

ADD_DEFINITIONS(-DHAVE_CONFIG_H)

SET(HEADERS
	Epetra_BLAS.h
	Epetra_BLAS_wrappers.h
	Epetra_BasicDirectory.h
	Epetra_BasicRowMatrix.h
	Epetra_BlockMap.h
	Epetra_BlockMapData.h
	Epetra_C_wrappers.h
	Epetra_CombineMode.h
	Epetra_Comm.h
	Epetra_CompObject.h
	Epetra_ConfigDefs.h
	Epetra_CrsGraph.h
	Epetra_CrsGraphData.h
	Epetra_CrsMatrix.h
	Epetra_CrsSingletonFilter.h
	Epetra_Data.h
	Epetra_DataAccess.h
	Epetra_Directory.h
	Epetra_DistObject.h
	Epetra_Distributor.h
	Epetra_Export.h
	Epetra_FECrsGraph.h
	Epetra_FECrsMatrix.h
	Epetra_FEVbrMatrix.h
	Epetra_FEVector.h
	Epetra_Flops.h
	Epetra_Fortran_wrappers.h
	Epetra_HashTable.h
	Epetra_Import.h
	Epetra_IntSerialDenseMatrix.h
	Epetra_IntSerialDenseVector.h
	Epetra_IntVector.h
	Epetra_InvOperator.h
	Epetra_JadMatrix.h
	Epetra_LAPACK.h
	Epetra_LAPACK_wrappers.h
	Epetra_LinearProblem.h
	Epetra_LocalMap.h
	Epetra_Map.h
	Epetra_MapColoring.h
	Epetra_MultiVector.h
	Epetra_Object.h
	Epetra_OffsetIndex.h
	Epetra_Operator.h
	Epetra_RowMatrix.h
	Epetra_RowMatrixTransposer.h
	Epetra_SerialComm.h
	Epetra_SerialCommData.h
	Epetra_SerialDenseMatrix.h
	Epetra_SerialDenseOperator.h
	Epetra_SerialDenseSVD.h
	Epetra_SerialDenseSolver.h
	Epetra_SerialDenseVector.h
	Epetra_SerialDistributor.h
	Epetra_SerialSpdDenseSolver.h
	Epetra_SerialSymDenseMatrix.h
	Epetra_SrcDistObject.h
	Epetra_Time.h
	Epetra_Util.h
	Epetra_VbrMatrix.h
	Epetra_VbrRowMatrix.h
	Epetra_Vector.h
	Epetra_Version.h
	)

SET(SOURCES
	Epetra_BLAS.cpp
	Epetra_BasicDirectory.cpp
	Epetra_BasicRowMatrix.cpp
	Epetra_BlockMap.cpp
	Epetra_BlockMapData.cpp
	Epetra_C_wrappers.cpp
	Epetra_CompObject.cpp
	Epetra_CrsGraph.cpp
	Epetra_CrsGraphData.cpp
	Epetra_CrsMatrix.cpp
	Epetra_CrsSingletonFilter.cpp
	Epetra_Data.cpp
	Epetra_DistObject.cpp
	Epetra_Export.cpp
	Epetra_FECrsGraph.cpp
	Epetra_FECrsMatrix.cpp
	Epetra_FEVbrMatrix.cpp
	Epetra_FEVector.cpp
	Epetra_Flops.cpp
	Epetra_Fortran_wrappers.cpp
	Epetra_Import.cpp
	Epetra_IntSerialDenseMatrix.cpp
	Epetra_IntSerialDenseVector.cpp
	Epetra_IntVector.cpp
	Epetra_JadMatrix.cpp
	Epetra_LAPACK.cpp
	Epetra_LinearProblem.cpp
	Epetra_LocalMap.cpp
	Epetra_Map.cpp
	Epetra_MapColoring.cpp
	Epetra_MultiVector.cpp
	Epetra_Object.cpp
	Epetra_OffsetIndex.cpp
	Epetra_RowMatrixTransposer.cpp
	Epetra_SerialComm.cpp
	Epetra_SerialCommData.cpp
	Epetra_SerialDenseMatrix.cpp
	Epetra_SerialDenseSVD.cpp
	Epetra_SerialDenseSolver.cpp
	Epetra_SerialDenseVector.cpp
	Epetra_SerialDistributor.cpp
	Epetra_SerialSpdDenseSolver.cpp
	Epetra_SerialSymDenseMatrix.cpp
	Epetra_Time.cpp
	Epetra_Util.cpp
	Epetra_VbrMatrix.cpp
	Epetra_Vector.cpp
	)

SET(FORTRAN_SOURCES
    Epetra_dcrsmm.f
    Epetra_dcrsmv.f
    Epetra_dcrssm.f
    Epetra_dcrssv.f
)

SET(MPI_HEADERS
	Epetra_MpiComm.h
	Epetra_MpiCommData.h
	Epetra_MpiDistributor.h

)

SET(MPI_SOURCES
	Epetra_MpiComm.cpp
	Epetra_MpiCommData.cpp
	Epetra_MpiDistributor.cpp
)

ADD_LIBRARY(epetra_fortran ${FORTRAN_SOURCES})

ADD_LIBRARY(epetra ${HEADERS} ${SOURCES})

IF(ENABLE_MPI)
  INCLUDE_DIRECTORIES(${MPI_INCLUDE_PATH})
  ADD_LIBRARY(epetra_mpi ${MPI_HEADERS} ${MPI_SOURCES})
  TARGET_LINK_LIBRARIES(epetra epetra_fortran epetra_mpi ${MPI_LIBRARY}
${LAPACK_LIBRARY} ${BLAS_LIBRARY})
ELSE(ENABLE_MPI)
  TARGET_LINK_LIBRARIES(epetra epetra_fortran ${LAPACK_LIBRARY}
${BLAS_LIBRARY})
ENDIF(ENABLE_MPI)
 

> -----Original Message-----
> From: cmake-bounces+dmdunla=sandia.gov at cmake.org 
> [mailto:cmake-bounces+dmdunla=sandia.gov at cmake.org] On Behalf 
> Of Marie-Christine Vallet
> Sent: Wednesday, October 24, 2007 3:44 PM
> To: cmake at cmake.org
> Subject: Re: [CMake] Problem building fortran project on 
> Windows using Intel Fortran 10 compiler
> 
> Dunlavy, Daniel M wrote:
> > I am trying to build a mixed fortran/C++ project and am 
> having trouble 
> > using the Intel Fortran 10 compiler. I have checked the 
> mailing list 
> > archives and tried to piece together a solution to no avail.
> >  
> > I am using CMake 2.4.6 and today tried to use CMake 2.5 - 20071024, 
> > and both have the same problem in finding the fortran 
> libraries. I am 
> > generating files for MS Visual Studio 8.
> >  
> > I have tried the following:
> >  
> > 1) I have added ENABLE_LANGUAGE(Fortran) to my project.
> > 2) I have verified that CMake is running 
> > <CMAKE>/Modules/Platform/Windows-ifort.cmake by adding a MESSAGE 
> > command there.
> > 3) I have checked the
> > 
> <CMAKE_BINARY_DIR>/CMakeFiles/CMakeTmp/cmTryCompileExec.dir/Debug/Buil
> > dLog.htm and successfully run the commands manually from a 
> Fortran cmd 
> > shell provided by the Intel Fortran 10.0 compiler.
> > 4) I have verified that if I move the missing library into the 
> > <CMAKE_BINARY_DIR>/CMakeFiles/CMakeTmp directory that the 
> linking is 
> > successful.
> > 5) I have tried to build the Fortran tests with the current CVS 
> > checkout of CMake and have the same problem.
> >  
> > I now think that this must simply be a problem with the 
> path. However, 
> > setting the environment variables LIB, INCLUDE, and PATH to all 
> > include the fortran library directories does not help.
> >  
> > Below is the output from running CMake from the command line (the 
> > output of CMakeSetup is the same, but I was unable to cut and paste 
> > the text from there).
> >  
> > Thanks for any help or advice on what to check next.
> >  
> > Danny Dunlavy
> >  
> > 
> ----------------------------------------------------------------------
> > -------------------------------------------
> >  
> > %>cmake --debug-trycompile --debug-out put 
> > ..\..\..\Trilinos\packages\epetra debug trycompile on Running with 
> > debug output on.
> > -- Check for working Fortran compiler: C:/Program 
> > Files/Intel/Compiler/Fortran/10.0.025/IA32/Bin/ifort.exe
> > -- Check for working Fortran compiler: C:/Program 
> > Files/Intel/Compiler/Fortran/10.0.025/IA32/Bin/ifort.exe -- broken 
> > CMake Error: Error in cmake code at C:/Program Files/CMake
> > 2.4/share/cmake-2.4/Modules/CMakeTestFortranCompiler.cmake:25:
> > MESSAGE The Fortran compiler "C:/Program 
> > Files/Intel/Compiler/Fortran/10.0.025/IA32/Bin/ifort.exe" 
> is not able 
> > to compile a simple test program.
> > It fails with the following output:
> >  
> > Microsoft (R) Visual Studio Version 8.0.50727.762.
> > Copyright (C) Microsoft Corp 1984-2005. All rights reserved.
> > ------ Build started: Project: cmTryCompileExec, 
> Configuration: Debug
> > Win32 ------
> > Building Fortran object testFortranCompiler.obj Linking 
> Fortran target 
> > cmTryCompileExec.exe LINK : fatal error LNK1104: cannot open file 
> > 'ifconsol.lib'
> > Project : error PRJ0019: A tool returned an error code from 
> "Linking 
> > Fortran target cmTryCompileExec.exe"
> > Build log was saved at "file://c:\Documents <file://c:%5CDocuments> 
> > and Settings\dmdunla\My 
> > Documents\work\dev\build\trilinos\epetra-win32\CMake
> > Files\CMakeTmp\cmTryCompileExec.dir\Debug\BuildLog.htm"
> > cmTryCompileExec - 2 error(s), 0 warning(s) ========== Build: 0 
> > succeeded, 1 failed, 1 up-to-date, 0 skipped ==========
> >  
> >
> > CMake will not be able to correctly generate this project.
> > Current CMake stack: C:/Documents and Settings/dmdunla/My 
> > 
> Documents/work/dev/Trilinos/packages/epetra/src/CMakeLists.txt;C:/Prog
> > ram Files/CMake 
> > 2.4/share/cmake-2.4/Modules/CMakeTestFortranCompiler.cmake
> > -- Configuring done
> >  
> > 
> ----------------------------------------------------------------------
> > --
> >
> > _______________________________________________
> > CMake mailing list
> > CMake at cmake.org
> > http://www.cmake.org/mailman/listinfo/cmake
> What does your cmake file look like?
> 
> --
> Marie-Christine Vallet
> Genome Center, GBSF
> University of California
> 451 East Health Sciences Drive
> Davis, CA 95616, USA
> 
> Phone: (530) 754 9738
> Email: mmvallet at ucdavis.edu
> http://koehllab.genomecenter.ucdavis.edu/
> 
> 
> 
> Strength is the capacity to break a chocolate bar into four 
> pieces with your bare hands - and then eat just one of the pieces  
> 
> _______________________________________________
> CMake mailing list
> CMake at cmake.org
> http://www.cmake.org/mailman/listinfo/cmake
> 
> 



More information about the CMake mailing list