View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0013379CMakeCMakepublic2012-07-06 05:142013-03-04 08:38
ReporterYngve Inntjore Levinsen 
Assigned ToAlex Neundorf 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionfixed 
PlatformLinuxOSGNU/LinuxOS Version3.4.3
Product VersionCMake 2.8.8 
Target VersionCMake 2.8.10Fixed in VersionCMake 2.8.10 
Summary0013379: Toolchain prefix not set correctly for Fortran projects
DescriptionI have a project involving Fortran, C, and C++. I was writing a toolchain file for MinGW so I could compile Windows binaries on my Linux box. I had the following on the top of my CMakeLists.txt:

project(name Fortran C CXX)

In my toolchain file I sat the C, CXX and Fortran compiler, and root path. What I then noticed was that instead of using the AR/RANLIB with the MinGW prefix, it was using the default /usr/bin/[ar/ranlib].

This was solved simply by changing the order in the project line as described above, to instead read:

project(name C CXX Fortran)

(not having Fortran first). See also mail exchange:
http://www.cmake.org/pipermail/cmake/2012-July/051136.html [^]
and attached two toolchain files in:
http://www.cmake.org/pipermail/cmake/2012-July/051152.html [^]

Please ask if something is unclear. I should also add that I do not know the origin of the problem, so for what I know it does not need to be fortran related.
Steps To ReproduceCreate a project with Fortran as the first enabled language
Create a toolchain file which should enable a prefix for additional tools
TagsNo tags attached.
Attached Fileslog file icon CmakeCrossCetup.log [^] (64,283 bytes) 2012-07-20 14:51
? file icon CMakeDetermineFortranCompiler.cmake [^] (9,840 bytes) 2012-08-22 15:46
? file icon CMakeDetermineCompiler.cmake [^] (2,946 bytes) 2012-08-22 16:22

 Relationships
has duplicate 0013475closed Support cross-compiling fortran project in the same way as C and C++ 

  Notes
(0030047)
Eric NOULARD (developer)
2012-07-14 09:05

Alex,

In case you missed it on the ML,
there seems to be a related issue when cross-compiling on Darwin to Windows,
when no language is passed to the project command:
http://www.cmake.org/pipermail/cmake/2012-July/051253.html [^]
(0030096)
ClausKlein (reporter)
2012-07-20 14:16
edited on: 2012-07-20 14:21

At least that would help, if not I have to set the language used for each project I use.


--- Modules/CMakeFindBinUtils.cmake 2012-05-20 19:04:26.000000000 +0200
+++ /usr/local/share/cmake-2.8/Modules/CMakeFindBinUtils.cmake 2012-07-20 20:10:00.000000000 +0200
@@ -64,7 +64,7 @@
 
 
 # on Apple there really should be install_name_tool
-IF(APPLE)
+IF(APPLE AND NOT CMAKE_INSTALL_NAME_TOOL)
   FIND_PROGRAM(CMAKE_INSTALL_NAME_TOOL NAMES install_name_tool HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
 
   IF(NOT CMAKE_INSTALL_NAME_TOOL)
@@ -72,4 +72,4 @@
   ENDIF(NOT CMAKE_INSTALL_NAME_TOOL)
 
   MARK_AS_ADVANCED(CMAKE_INSTALL_NAME_TOOL)
-ENDIF(APPLE)
+ENDIF(APPLE AND NOT CMAKE_INSTALL_NAME_TOOL)
claus-kleins-macbook-pro:cmake clausklein$

(0030097)
ClausKlein (reporter)
2012-07-20 14:20
edited on: 2012-07-20 14:22

That is the diff at my project on darwin host to cross compile for windows.
The new one works only with patched version of CMakeFindBinUtils.cmake

claus-kleins-macbook-pro:ninja clausklein$ git diff
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9d7f5e1..3a5f007 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -83,7 +83,7 @@ if(compiler STREQUAL clang)
 endif()
 
 # this triggers the compiler detection
-project(ninja CXX)
+project(ninja)
 
 if(verbose)
     set(CMAKE_VERBOSE_MAKEFILE ON)
claus-kleins-macbook-pro:ninja clausklein$

(0030124)
Alex Neundorf (developer)
2012-07-25 15:30

Since I have never used Fortran and there were not yet any requests for cross compiling support for Fortran, I think I didn't actually add the cross compiling support for Fortran.
I guess I'll have to have a look at it.
(0030707)
Alex Neundorf (developer)
2012-08-19 14:36

What is the exact name of the fortran cross compiler executable ?
(0030708)
Yngve Inntjore Levinsen (reporter)
2012-08-19 15:16

In my case the name is i486-mingw32-gfortran
(0030736)
Alex Neundorf (developer)
2012-08-22 15:47

Can you please check whether it works for you if you use the attached CMakeDetermineFortranCompiler.cmake (i.e. put it in the Modules/ dir of your installed cmake) ?
(0030739)
Yngve Inntjore Levinsen (reporter)
2012-08-22 16:16

Missing file:
CMake Error at /usr/share/cmake-2.8/Modules/CMakeDetermineFortranCompiler.cmake:22 (include):
  include could not find load file:

    /usr/share/cmake-2.8/Modules/CMakeDetermineCompiler.cmake

I don't find this file in git neither..?
(0030740)
Alex Neundorf (developer)
2012-08-22 16:23

Indeed, this file is only three weeks old, I attached it, maybe it works if you simply put it in the Modules/ directory.

Or you can get the whole FortranCrossCompiling2 from cmake stage and build it yourself:
 http://cmake.org/gitweb?p=stage/cmake.git;a=summary [^]
(0030746)
Yngve Inntjore Levinsen (reporter)
2012-08-23 02:53

Yes, these two files works for me, and sets the correct ar/ranlib it seems. Thank you for fixing! :)
(0030992)
Brad King (manager)
2012-09-11 11:50

This commit applies the changes:

 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7924aacb [^]
(0032444)
Robert Maynard (manager)
2013-03-04 08:38

Closing resolved issues that have not been updated in more than 4 months.

 Issue History
Date Modified Username Field Change
2012-07-06 05:14 Yngve Inntjore Levinsen New Issue
2012-07-09 08:39 Brad King Assigned To => Alex Neundorf
2012-07-09 08:39 Brad King Status new => assigned
2012-07-14 09:05 Eric NOULARD Note Added: 0030047
2012-07-20 14:16 ClausKlein Note Added: 0030096
2012-07-20 14:20 ClausKlein Note Added: 0030097
2012-07-20 14:21 ClausKlein Note Edited: 0030096
2012-07-20 14:22 ClausKlein Note Edited: 0030097
2012-07-20 14:51 ClausKlein File Added: CmakeCrossCetup.log
2012-07-25 15:30 Alex Neundorf Note Added: 0030124
2012-07-25 16:33 Alex Neundorf Category CMakeSetup => CMake
2012-08-13 12:42 Alex Neundorf Target Version => CMake 2.8.10
2012-08-15 16:31 Alex Neundorf Relationship added has duplicate 0013475
2012-08-19 14:36 Alex Neundorf Note Added: 0030707
2012-08-19 15:16 Yngve Inntjore Levinsen Note Added: 0030708
2012-08-22 15:46 Alex Neundorf File Added: CMakeDetermineFortranCompiler.cmake
2012-08-22 15:47 Alex Neundorf Note Added: 0030736
2012-08-22 16:16 Yngve Inntjore Levinsen Note Added: 0030739
2012-08-22 16:22 Alex Neundorf File Added: CMakeDetermineCompiler.cmake
2012-08-22 16:23 Alex Neundorf Note Added: 0030740
2012-08-23 02:53 Yngve Inntjore Levinsen Note Added: 0030746
2012-09-11 11:50 Brad King Note Added: 0030992
2012-09-11 11:50 Brad King Status assigned => resolved
2012-09-11 11:50 Brad King Resolution open => fixed
2012-09-11 11:50 Brad King Fixed in Version => CMake 2.8.10
2013-03-04 08:38 Robert Maynard Note Added: 0032444
2013-03-04 08:38 Robert Maynard Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team