NSF Unidata

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[netCDF #FOV-989930]: Fortran compiling error

This archive contains answers to questions sent to Unidata support through mid-2025. Note that the archive is no longer being updated. We provide the archive for reference; many of the answers presented here remain technically correct, even if somewhat outdated. For the most up-to-date information on the use of NSF Unidata software and data services, please consult the Software Documentation first.



Hi John,

Sorry to have taken so long to respond to your question ...
> Package Version: netCDF-4.1.1
> Operating System: Snow Leopard
> Hardware: 2.53 Intel Core 2 Duo
> Description of problem: Here's the build script.
> 
> #!/bin/bash
> export CFLAGS="-m64"
> export CPPFLAGS="-m64 -Df2cFortran"
> #export CPPFLAGS="-Df2cFortran"
> export CXXFLAGS="-m64"
> export FFLAGS="-m64"
> export FC=/usr/local/bin/gfortran
> export F90=/usr/local/bin/gfortran
> ./configure --prefix=/usr/local/netcdf-4.1.1

You shouldn't need most of those settings with netCDF-4.1.1 on Mac OS X.  For 
me, the build
succeeded when I just put /usr/local/bin in the front of my PATH environment 
variable so the
matching gcc and gfortran would be found by the configure script from that 
directory, then I
just invoked 

  ./configure --prefix=<whatever>
  make check
  make install

The configure script figures out what flags are needed for everything and gets 
it right.  In particular,
you don't need -Df2cFortran in CPPFLAGS, and the "-m64" is the default with gcc 
and gfortran if you
have a platform that supports the 64-bit model.  I built with 4.1.1 on MacOS X 
10.6.3 using the gcc and 
gfortran versions 4.4.1 from the gcc-leopard-intel-bin.tar.gz (Intel Mac) link 
on http://hpc.sourceforge.net/,
but you should probably be using the 4.5 versions for your Intel Core 2 Duo, 
from the 
gcc-snwleo-intel-bin.tar.gz (Snow Leopard) link on the same web site.

> Here's the result.
> 
> make
> make  all-recursive
> Making all in f90
> make  all-am
> make[3]: Nothing to be done for `all-am'.
> Making all in fortran
> make  all-am
> /bin/sh ../libtool --tag=FC   --mode=link /usr/local/bin/gfortran  -g -O2   
> -o libnetcdff.la  fort-attio.lo fort-control.lo fort-dim.lo fort-genatt.lo 
> fort-geninq.lo fort-genvar.lo fort-lib.lo fort-misc.lo fort-v2compat.lo 
> fort-vario.lo fort-var1io.lo fort-varaio.lo fort-varmio.lo fort-varsio.lo    
> ../f90/libnetcdff90.la
> libtool: link: rm -fr  .libs/libnetcdff.a .libs/libnetcdff.lax
> libtool: link: (cd .libs/libnetcdff.lax/libnetcdff90.a && ar x 
> "/Users/hellyj/src/netcdf-4.1.1/fortran/../f90/.libs/libnetcdff90.a")
> libtool: link: ar cru .libs/libnetcdff.a  fort-attio.o fort-control.o 
> fort-dim.o fort-genatt.o fort-geninq.o fort-genvar.o fort-lib.o fort-misc.o 
> fort-v2compat.o fort-vario.o fort-var1io.o fort-varaio.o fort-varmio.o 
> fort-varsio.o  .libs/libnetcdff.lax/libnetcdff90.a/netcdf.o 
> .libs/libnetcdff.lax/libnetcdff90.a/typeSizes.o
> /usr/bin/ranlib: archive member: .libs/libnetcdff.a(netcdf.o) cputype (7) 
> does not match previous archive members cputype (16777223) (all members must 
> match)

This looks like you're trying to install 64-bit objects into a library archive 
already containing 32-bit objects, or
vice-versa.  Maybe from trying make multiple times without running "make clean" 
in between invocations.  If
you start from a new 4.1.1 source distribution with the process described 
above, you won't have this problem.

> /usr/bin/ranlib: archive member: .libs/libnetcdff.a(typeSizes.o) cputype (7) 
> does not match previous archive members cputype (16777223) (all members must 
> match)
> libtool: link: ranlib .libs/libnetcdff.a
> ranlib: archive member: .libs/libnetcdff.a(netcdf.o) cputype (7) does not 
> match previous archive members cputype (16777223) (all members must match)
> ranlib: archive member: .libs/libnetcdff.a(typeSizes.o) cputype (7) does not 
> match previous archive members cputype (16777223) (all members must match)
> make[3]: *** [libnetcdff.la] Error 1
> make[2]: *** [all] Error 2
> make[1]: *** [all-recursive] Error 1
> make: *** [all] Error 2
> 
> I can see that there is some kind of library incompatibility but have
> no idea why.
> 
> Any suggestions?

I hope this helps ...

--Russ


Russ Rew                                         UCAR Unidata Program
address@hidden                      http://www.unidata.ucar.edu



Ticket Details
===================
Ticket ID: FOV-989930
Department: Support netCDF
Priority: Normal
Status: Closed