Hi, Here is a bug report for a problem I encountered when trying to build PLPlot.
Problem Summary --------------- When building PLPlot using a CMake 2.6 generator which specifies a default fortran compiler eg Visual Studio 9 2008 (and probably earlier versions) but with no Fortran compiler actually installed, CMake fails and cannot generate project. A number of solutions which require further work, are proposed at the end of this report. Some could be implemented in the PLPlot CMake configuration, others in CMake itself. Impact - Minor, probably limited to Microsoft Visual Studio users who do not have a Fortran compiler installed. A workaround to the problem is for the user to disable f77 and f95. eg cmake -G "Visual Studio 9 2008" -DENABLE_f77=OFF -DENABLE_f95=OFF .... Details ------- System configuration: Windows XP with Microsoft Visual Studio 9 2008 Express Edition PLPLot - svn head (ie 5.9.0+ revision 8718) CMake 2.6.1 The specific problem: -------------------- When cmake v2.6.1 is run from the subdirectory plplot/builds/vc9_FortranError > cmake -G "Visual Studio 9 2008" ../.. CMake fails. The full output is attached but the relevent messages are --------------------------------------------- < ... preceding checks snipped ... > -- Check for working Fortran compiler: ifort -- Check for working Fortran compiler: ifort -- broken CMake Error at C:/Program Files/CMake 2.6/share/cmake-2.6/Modules/CMakeTestFortranCompiler.cmake:25 (MESSAGE): The Fortran compiler "ifort" is not able to compile a simple test program. It fails with the following output: Change Dir: C:/home/kz/plplot/builds/vc9_NoFortran/CMakeFiles/CMakeTmp Run Build Command:C:\PROGRA~1\MICROS~1.0\Common7\IDE\VCExpress.exe CMAKE_TRY_COMPILE.sln /build Debug /project cmTryCompileExec Microsoft (R) Visual C++ Express Edition Version 9.0.21022.8. Copyright (C) Microsoft Corp 2007. All rights reserved. 'C:\home\kz\plplot\builds\vc9_NoFortran\CMakeFiles\CMakeTmp\cmTryCompileExec.vfproj' cannot be opened because its project type (.vfproj) is not supported by this version of Visual Studio. < ... Visual Studio Usage information snipped ... > CMake will not be able to correctly generate this project. Call Stack (most recent call first): cmake/modules/fortran.cmake:47 (enable_language) cmake/modules/plplot.cmake:305 (include) CMakeLists.txt:55 (include) --------------------------------------------- My understanding of what is happening is : ---------------------------------------- (Note this is my first use of cmake) 1. the CMake "Visual studio 9 2008" generator has a default fortran compiler defined - CMAKE_GENERATOR_FC ="ifort" 2. PLPlot's fortran.cmake calls CMake Module CMakeDetermineFortranCompiler 3. Tracing CMakeDetermineFortranCompiler.cmake 3a. As CMAKE_GENERATOR_FC is set (to ifort) CMAKE_Fortran_COMPILER_INIT is set to CMAKE_GENERATOR_FC ie ifort 3b. As CMAKE_Fortran_COMPILER_INIT is set CMAKE_Fortran_COMPILER_LIST is set to CMAKE_Fortran_COMPILER_INIT ie ifort 3c. FIND_PROGRAM returns CMAKE_Fortran_COMPILER not set ie ifort not found 3d. the following test IF(CMAKE_Fortran_COMPILER_INIT AND NOT CMAKE_Fortran_COMPILER) is true so CMAKE_Fortran_COMPILER is set to CMAKE_Fortran_COMPILER_INIT ie ifort (even though it hasn't been found!). 4. On return to fortran.cmake CMAKE_Fortran_COMPILER is set so ENABLE_f77 and ENABLE_f95 are left ON 5. fortran.cmake calls (cmake's) enable_language(Fortran) command 6. enable_language(Fortran) 6a. (also)calls CMakeDetermineFortranCompiler (but this time is able to the use cached value of CMAKE_Fortran_COMPILER) 6b. Then calls CMakeTestFortranCompiler.cmake 7. CMakeTestFortranCompiler.cmake tries to compile a simple case using CMAKE_Fortran_COMPILER. As the compiler can't be found this fails for which CMakeTestFortranCompiler issues a FATAL_ERROR message. Impact on Other Platforms and toolsets: ---------------------------------- Unfortunately I only have Visual Studio 2008 Express and cygwin. Looking at the CMake 2.6 code it looks as if the problem applies to earlier versions of Visual Studio generators as well. I don't know if the problem applies to "nmake makefile" generator. The Visual Studio 9 version failed for another reason which I have yet to investigate. For cygwin without a fortran compiler, CMake correctly disables f77 and f95. On linux systems I presume g77 will probably be always installed. Grepping the CMake 2.6.1 code suggests the problem is currently limited to Visual Studio 7,7.1,8 and 9 generators The problem doesn't occur with CMake 2.4.(8?), Visual Studio 9 2008 and no Fortran compiler because the C code sets the variable CMAKE_GENERATOR_Fortran whereas the CMakeDetermineFortranCompiler.cmake refers to CMAKE_GENERATOR_FC. The C code is changed in version 2.8. I suspect the combination CMake 2.4.8, Visual studio 6 and No fortran will also fail. Solutions I have considered: ------------------------- 1. According to the cmake documentation (v2.6.1), enable_language(Fortran) supports a second parameter "OPTIONAL". When called it should set the variable CMAKE_Fortran_COMPILER_WORKS appropriately. PLPlot cmake scripts could then test the variable Unfortunately this does not work and requires fixing CMake. 2. Use a modified version of cmake's CMakeTestFortranCompiler which does not issue the FATAL_ERROR and modify PLPlot fortran.cmake to test CMAKE_Fortran_COMPILER_WORKS. I haven't tested this idea. 3. Revise the code in steps 3c and 3d above. This would need to be done by someone with ifort and better cmake knowledge. 4. Add an explicit test for the fortran compiler. TRY_COMPILE cannot be used as it requires a prior call to enable_language(Fortran) 5. Remove ifort as the default fortran compiler in CMake. May requires rebuilding CMake. 6. As a workround for users without a fortran compiler, have the user explicitly disable f77 and f95 when building PLPlot. Kind regards Terrence Send instant messages to your online friends http://uk.messenger.yahoo.com
cmake.out
Description: Binary data
------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________ Plplot-devel mailing list Plplot-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/plplot-devel