Discussion:
[CMake] cmake + OSX + gfortran + 64bit problem
Convey, Christian J CIV NUWC NWPT, B-171
2010-12-15 22:08:10 UTC
Permalink
Here's what I've got:
Cmake: 2.8.3
OS X: 10.5.x
gfortran: 4.5.1

I'm trying to build a Fortran program on OS X using CMake. I'm trying to write CMakeLists.txt files that can handle either the GNU fortran compiler or the Intel fortran compiler.

When set CMAKE_OSX_ARCHITECTURES to x86_64, the resulting makefiles end up supplying "-arch x86_64" to the gfortran command line. That flag is appropriate for the Intel fortran compiler but it isn't valid for gfortran, even on a Mac. It should be "-m64".

Does anyone know of a good way around this?


Christian Convey
Scientist, NUWC Division Newport
1176 Howell St., Newport, RI 02842
email: ***@navy.mil
phone: (401) 832-6824
fax: (401) 832-4749
Clinton Stimpson
2010-12-15 22:48:24 UTC
Permalink
On Wednesday, December 15, 2010 03:08:10 pm Convey, Christian J CIV NUWC NWPT,
Post by Convey, Christian J CIV NUWC NWPT, B-171
Cmake: 2.8.3
OS X: 10.5.x
gfortran: 4.5.1
I'm trying to build a Fortran program on OS X using CMake. I'm trying to
write CMakeLists.txt files that can handle either the GNU fortran compiler
or the Intel fortran compiler.
When set CMAKE_OSX_ARCHITECTURES to x86_64, the resulting makefiles end up
supplying "-arch x86_64" to the gfortran command line. That flag is
appropriate for the Intel fortran compiler but it isn't valid for
gfortran, even on a Mac. It should be "-m64".
Does anyone know of a good way around this?
That probably depends which gfortran you are using on the Mac.
I've used the -arch flag with gfortran before, and at the time, I thought the
only multi-arch gfortran available to download/install took the -arch flag.
--
Clinton Stimpson
Elemental Technologies, Inc
Computational Simulation Software, LLC
www.csimsoft.com
Convey, Christian J CIV NUWC NWPT, B-171
2010-12-15 22:56:09 UTC
Permalink
Thanks, but a guy on the gfortran mailing list makes it sound like they have no intention to support "-arch x86_64" on the Mac.

I need to find a solution that will work on stock versions of gfortran, unfortunately.
Post by Clinton Stimpson
That probably depends which gfortran you are using on the Mac.
I've used the -arch flag with gfortran before, and at the time, I thought the
only multi-arch gfortran available to download/install took the -arch flag.
Michael Jackson
2010-12-15 23:58:06 UTC
Permalink
http://r.research.att.com/tools/

Has a great distribution of gfortran based on each Xcode distribution. It seems to work well with CMake. Not sure about the -arch flag though.

___________________________________________________________
Mike Jackson www.bluequartz.net
Principal Software Engineer ***@bluequartz.net
BlueQuartz Software Dayton, Ohio
Post by Convey, Christian J CIV NUWC NWPT, B-171
Thanks, but a guy on the gfortran mailing list makes it sound like they have no intention to support "-arch x86_64" on the Mac.
I need to find a solution that will work on stock versions of gfortran, unfortunately.
Post by Clinton Stimpson
That probably depends which gfortran you are using on the Mac.
I've used the -arch flag with gfortran before, and at the time, I thought the
only multi-arch gfortran available to download/install took the -arch flag.
_______________________________________________
Powered by www.kitware.com
Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
http://www.cmake.org/mailman/listinfo/cmake
j s
2010-12-16 04:59:50 UTC
Permalink
I use the compiler from the att site. It does support the arch flags, as
they have applied the patches. They also explicitly state why you should
not use the gfortran from the HPC site. I avoid all MacPorts compilers, as
they make some bad packaging mistakes, such as linking against their own
version of the c runtimes.

Juan

On Wed, Dec 15, 2010 at 5:58 PM, Michael Jackson <
Post by Michael Jackson
http://r.research.att.com/tools/
Has a great distribution of gfortran based on each Xcode distribution. It
seems to work well with CMake. Not sure about the -arch flag though.
___________________________________________________________
Mike Jackson www.bluequartz.net
BlueQuartz Software Dayton, Ohio
Post by Convey, Christian J CIV NUWC NWPT, B-171
Thanks, but a guy on the gfortran mailing list makes it sound like they
have no intention to support "-arch x86_64" on the Mac.
Post by Convey, Christian J CIV NUWC NWPT, B-171
I need to find a solution that will work on stock versions of gfortran,
unfortunately.
Post by Convey, Christian J CIV NUWC NWPT, B-171
Post by Clinton Stimpson
That probably depends which gfortran you are using on the Mac.
I've used the -arch flag with gfortran before, and at the time, I thought the
only multi-arch gfortran available to download/install took the -arch flag.
_______________________________________________
Powered by www.kitware.com
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
http://www.cmake.org/Wiki/CMake_FAQ
Post by Convey, Christian J CIV NUWC NWPT, B-171
http://www.cmake.org/mailman/listinfo/cmake
_______________________________________________
Powered by www.kitware.com
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
http://www.cmake.org/Wiki/CMake_FAQ
http://www.cmake.org/mailman/listinfo/cmake
Convey, Christian J CIV NUWC NWPT, B-171
2010-12-16 13:15:45 UTC
Permalink
Okay, thanks, I'll have a look.

But isn't this also CMake bug? In most other cases it seems to do a good job of knowing which flags to use for different compilers.
-----Original Message-----
Behalf Of j s
Sent: Thursday, December 16, 2010 0:00
To: Michael Jackson
Cc: cmake Mailing List
Subject: Re: [CMake] cmake + OSX + gfortran + 64bit problem
I use the compiler from the att site. It does support the arch flags,
as they have applied the patches. They also explicitly state why you
should not use the gfortran from the HPC site. I avoid all MacPorts
compilers, as they make some bad packaging mistakes, such as linking
against their own version of the c runtimes.
Juan
Loading...