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

Re: 20040910: Mac OS X 10.3.4, NetCDF 3.5.1



>To: Russ Rew <address@hidden>
>From: "Cara-Lyn Lappen" <address@hidden>
>Subject: Re: 20040910: Mac OS X 10.3.4, NetCDF 3.5.1
>Organization: CSU
>Keywords: 200409101811.i8AIBvdL027131

Hi Cara-Lyn,

> > I think the "-IU77" on the above line should instead be "-lU77"
> > (that's an ell, not a one or an uppercase i), so that the linker will
> > look in the Unix/VMS compatibility libraries and find the getarg and
> > iargc routines.
>
> thanks- I actually had figured that out about 15 minutes ago. It was a 
> dumb typo error.
> 
> Im having another problem that I thought you might be able to help with:
> 
> I got netcdf 3.5.1 to  compile on my Mac. I ran make test and make 
> install and it worked fine.
> I am trying to run the NCAR model CAM on my Mac and when I "make" the 
> model, it gives
> me errors that say "undefined symbols" and it lists a bunch of things 
> that look like:
> 
> _NF_CLOSE_
> 
> When I do an "nm" on the netcdf library files, I get that the symbol 
> name should be:
> 
> _nf_close_
> 
> So, I tried to recompile the netcdf 3.5.1 with the following 
> environmental variables set:
> 
> 
> FC=/Applications/Absoft/bin/f90
> FFLAGS=-w -YEXT_SFX=_  -YTEXT_NAMES=UCS  -YCFRL=1
> F90=/Applications/Absoft/bin/f90
> F90FLAGS=-w -YEXT_SFX=_   -YTEXT_NAMES=UCS  -YCFRL=1
> FLIBS=-lU77
> CPPFLAGS=-DAbsoftProFortran
> CFLAGS=
> CC=/usr/bin/cc
> CXX=/usr/bin/c++
> 
> Basically, I tried to set -YTEXT_NAMES=UCS in the F90FLAGS and FFLAGS 
> above so
> that it would make the symbols upper case.
> 
> Now, I get the following errors when I run netcdf's "make test" (see 
> below):
> 
> Unfortunately, these are exactly the symbols that CAM wants netcdf to 
> give it.
> 
> Cara-Lyn
> 
> make[2]: Entering directory `/usr/local/src/nf_test'
> /Applications/Absoft/bin/f90 -o nf_test -w -YEXT_SFX=_ -YCFRL=1  
> test_get.o test_put.o nf_error.o nf_test.o test_read.o test_write.o 
> util.o fortlib.o ../libsrc/libnetcdf.a -lU77
> ld: Undefined symbols:
> _NF_CLOSE_
> _NF_GET_ATT_DOUBLE_
> _NF_GET_ATT_INT1_
> _NF_GET_ATT_INT2_
> _NF_GET_ATT_INT_
  ...
> _NF_SET_FILL_
> _NF_SYNC_
> _MAX_DOUBLE_
> _MAX_FLOAT_
> _MAX_INT_
> _MAX_SCHAR_
> _MAX_SHORT_
> _MIN_INT_
> _MIN_SCHAR_
> _MIN_SHORT_
> _UDABORT_
> _UDRAND_
> test_get.o reference to undefined _NF_CLOSE_
> test_get.o reference to undefined _NF_GET_ATT_DOUBLE_
> test_get.o reference to undefined _NF_GET_ATT_INT1_
> test_get.o reference to undefined _NF_GET_ATT_INT2_
> test_get.o reference to undefined _NF_GET_ATT_INT_
> test_get.o reference to undefined _NF_GET_ATT_REAL_
> test_get.o reference to undefined _NF_GET_ATT_TEXT_
> test_get.o reference to undefined _NF_GET_VAR1_DOUBLE_
> test_get.o reference to undefined _NF_GET_VAR1_INT1_
> test_get.o reference to undefined _NF_GET_VAR1_INT2_
> more references to undefined symbols ...
> link failed.
> make[2]: *** [nf_test] Error 1
> make[2]: Leaving directory `/usr/local/src/nf_test'
> make[1]: *** [subdir_target] Error 1
> make[1]: Leaving directory `/usr/local/src'
> make: *** [nf_test/test] Error 2
> 
> any advice you have would be appreciated.

It's not the Fortran compiler that's providing things like NF_CLOSE,
those are actually provided by the C compiler which creates the
Fortran interface in the nf_test directory.  So all those uppercase
function names are getting defined in the macro calls in the C files
such as 

  /*
   * Close a netCDF dataset.
   */
  FCALLSCFUN1(NF_INT, nc_close, NF_CLOSE, nf_close,
              NCID)

in nf_test/fort-control.c.  

But I thought the macros in cfortran.h such as FCALLSCFUN1 were
supposed to take care of case and underscores for various Fortran
compilers, depending on flags such as CPPFLAGS=-DAbsoftProFortran, so
I'm surprised you have these case problems.

Without that, you would need to edit all the C source files there to
replace upper case strings like "NF_CLOSE" with lower-case equivalents
"nf_close" (fairly impractical).  Or from the other direction, compile
CAM so that it calls the netCDF functions using upper case rather than
lower case names, which might be possible with a Fortran flag that
says treat all external names as upper case, or be case-insensitive.

Finally, there is apparently a package available in the "Fink" package
distributions called "netcdf-absoft" that apparently does what's
needed, but I can't tell you much more about it.

--Russ