Universal netcdf-fortran

Ryan Schmidt ryandesign at macports.org
Thu May 31 12:50:04 PDT 2012


On May 31, 2012, at 10:13, Julien Salort wrote:

> Le 31 mai 2012 à 17:06, Ryan Schmidt a écrit :
> 
>>>> However, netcdf-fortran +universal fails at configure:
>>>> :info:configure checking for gcc... /opt/local/bin/gcc-mp-4.5
>>>> :info:configure checking whether the C compiler works... no
>>>> :info:configure configure: error: in `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_science_netcdf-fortran/netcdf-fortran/work/netcdf-fortran-4.2':
>>>> :info:configure configure: error: C compiler cannot create executables
>>>> 
>>>> Does MacPorts gcc have the capability to make fat executables ?
>>> 
>>> FSF gcc does not support "-arch" flags,
>> 
>> I should add that MacPorts should know not to supply "-arch" flags to compilers that don't support it, so I don't know why "C compiler cannot create executables" here. The config.log should have more info.
> 
> Attached is the full main.log and the config.log files.
> 
> Apparently, "-arch" flag is passed to gcc-mp-4.5:
> configure:3818: /opt/local/bin/gcc-mp-4.5 -pipe -O2 -fno-common -arch x86_64 -arch i386 -I/opt/local/include -DNDEBUG -DpgiFortran -L/opt/local/lib -arch x86_64 -arch i386 conftest.c  >&5
> cc1: error: unrecognized command line option "-arch"
> cc1: error: unrecognized command line option "-arch"
> cc1: error: unrecognized command line option "-arch"
> cc1: error: unrecognized command line option "-arch"
> configure:3822: $? = 1
> configure:3860: result: no

Well it's definitely using -arch flags, and shouldn't be. Maybe MacPorts base only knows not to add -arch flags when not using the universal variant. I haven't traced through the MacPorts base code closely enough.


> I've been searching the documentation to learn what "muniversal portgroup" was, without much success so far.
> Can you point me to the right place ?
> Does this imply some rewritting of the portfile ?
> Or can it be passed as command-line options ?

The muniversal portgroup replaces the standard universal variant (which builds for all architectures simultaneously by passing multiple -arch flags) with a universal variant that builds for each architecture separately, then uses lipo to combine them. It knows that fortran compilers don't support -arch flags and uses -m32 / -m64 flags for them instead.

Using the muniversal portgroup means editing the portfile to add the line "PortGroup muniversal 1.0" after the line "PortSystem 1.0", and possibly other changes which would be specific to the port.

There is no documentation, other than reading the portgroup file's comments and its code. The request to write documentation for it is here:

https://trac.macports.org/ticket/32428

I've changed the port to use the muniversal portgroup:

https://trac.macports.org/changeset/93813

It builds for me. I don't use this software so I don't know whether it works like this or not, but hopefully it does. Please give it a try. Wait 30 minutes, then "sudo port clean netcdf-fortran", "sudo port selfupdate", "sudo port install netcdf-fortran +universal".







More information about the macports-users mailing list