netcdf 4.0 lib not linking

Yolande Serra serra at atmo.arizona.edu
Mon Mar 16 12:15:06 PDT 2009


I've written previously about this issue and got no reply.  I'm trying  
again after trying everything I could think of to get my netcdf 4.0  
library installed with macport to work with the gcc43 also installed  
with macport.  I made a local port for netcdf in which I compiled it  
with gcc43 after having installed gcc43 from macport.  The build  
worked and I configured it with gfortran so that the fortran libs were  
also installed with my netcdf libs.  I selected to not have separate  
fortran libraries and did not configure with shared libraries so  
everything is in libnetcdf.a.  I checked using otool and all the right  
references are in libnetcdf.a, at least if I compare it to a working  
version of netcdf 4.0 on my old powerpc mac.  No netcdf 4.0 options  
were turned on so I did not have to install netcdf with hdf5, zlib or  
szlib (as this is what I tried at first and did not get it to work).

So, the question is why do I get linking errors when I try to compile  
fortran code that calls the netcdf libs?  I compile the code with  
gfortran-mp-4.3 and use the same options as when I built netcdf 4.0 (- 
fno-second-underscore -O2 -g).  I also have provided the location of  
the include file and library explicitly in the compile command line (- 
I/opt/local/include and -L/opt/local/lib -lnetcdf).  I also call some  
udunits functions which do not give any errors and udunits was also  
installed using macports and is in /opt/local.

Do I need to recompile the gcc43 using the same options (-fno-second- 
underscore)??  I tried compiling netcdf libs without this option, but  
this also did not work.  I tried compiling my code without that option  
as well and it did not work.  I also tried -fno-underscoring - no  
luck. I have a netcdf 4.0 library installed on my powerpc mac and can  
use gcc4.3 with that library with no problem but neither of these  
packages were installed with macports.  I'd like to use macports for  
the new mac (intel), as it seems more convenient than building source  
code myself all the time.  However, I desperately need a working  
netcdf library as all my data is stored this way.

Thanks for any help, Yolande




More information about the macports-users mailing list