View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0011627CMakeCMakepublic2010-12-18 10:572011-01-18 11:39
ReporterChristian Convey 
Assigned ToBrad King 
PriorityhighSeverityblockReproducibilityalways
StatusclosedResolutionno change required 
PlatformApple MacOSOS XOS Version10.5
Product VersionCMake 2.8.3 
Target VersionFixed in Version 
Summary0011627: Wrong target-architecture flags for stock version of gfortran on OS X
DescriptionI set CMAKE_OSX_ARCHITECTURES to "x86_64", because I want to produce a 64-bit executable.

When I do this, gfortran ends up being invoked with "-arch x86_64", which isn't valid for the compiler.

There are some OS X fortran compilers for which "-arch" *is* appropriate. Apparently Apple used to maintain a port of gfortran for which that flag was valid, but they seem to not do that any longer. "-arch" is also valid for the Intel fortran compiler on OS X.

The problem is that the stock GCC fortran compiler does not support "-arch".

Here's what a gfortran developer told me: "The GCC option for specifying an architecture is of the form '-march=XYZ' where you can a complete list of XYZ in the GCC manual. http://gcc.gnu.org/onlinedocs/gcc-4.5.1/gcc/ [^] "
TagsNo tags attached.
Attached Files

 Relationships

  Notes
(0024278)
Brad King (manager)
2010-12-20 08:48
edited on: 2010-12-20 08:49

CMAKE_OSX_ARCHITECTURES is meant for building universal binaries, typically with multiple architectures listed. The "-arch" flag is documented by Apple's port of GCC. Most importantly the "-arch" flag can be repeated multiple times on the same command line and the compiler target all the specified architectures to build a universal binary.

AFAIK Apple has halted work on GCC and ports of it in favor of their new llvm/clang effort. How does the GNU upstream gcc build universal binaries?

The solution to your original problem is to set

  CFLAGS=-m64
  CXXFLAGS=-m64
  FFLAGS=-m64

in your environment before running CMake. Don't use CMAKE_OSX_ARCHITECTURES unless you want universal binaries and have a toolchain capable of building them.

(0024867)
David Cole (manager)
2011-01-18 11:27

So, then... based on the report and the note 0011627:0024278 is this an issue at all? Seems like this one should be resolved as "no change required" because this is the expected behavior here.

Any problems with that resolution?
(0024870)
Brad King (manager)
2011-01-18 11:39

This is not a CMake issue.

Christian, if you have further questions please post to the mailing list for help:

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

Thanks.

 Issue History
Date Modified Username Field Change
2010-12-18 10:57 Christian Convey New Issue
2010-12-20 08:48 Brad King Note Added: 0024278
2010-12-20 08:49 Brad King Note Edited: 0024278
2010-12-20 08:50 Brad King Assigned To => Brad King
2010-12-20 08:50 Brad King Status new => feedback
2011-01-18 11:27 David Cole Note Added: 0024867
2011-01-18 11:39 Brad King Note Added: 0024870
2011-01-18 11:39 Brad King Status feedback => closed
2011-01-18 11:39 Brad King Resolution open => no change required


Copyright © 2000 - 2018 MantisBT Team