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

Re: 20050105:installing NetCDF for Absoft ProFortran 9.0 on Mac OS X



>To: address@hidden
>From: Guy Williams <address@hidden>
>Subject: installing NetCDF for Absoft ProFortran 9.0 on Mac OS X
>Organization: UCAR/Unidata
>Keywords: 200501050128.j051SJv2004103

Hi Guy,

> i have been trying to build my programs with NetCDF for Absoft  
> ProFortran 9.0 on Mac OS X
> 
> as per instructions found on this site, i have
> 
> 1) loaded netcdf 3.6
> 2) run the patch for cfortran.h
> 3) set the environment variables
> 
> it will compile, but when i build the program, i get the following
> 
> -------------------------
> 
> Scan completed
> mkdir -p "./ozpom.app/Contents/MacOS"
> /Developer/Tools/SetFile -a B "./ozpom".app
> c++   "./build/ozpom_withnetcdf.o" -framework Carbon  
> -Wl,-multiply_defined,suppress -Xlinker -w -Xlinker -Y -Xlinker 10   
> -L"/Applications/Absoft/lib" -lmrwe -lf90math -lfio_carbon -lac          
>       -lf77math -lm           -o "./ozpom.app/Contents/MacOS/ozpom"
> ld: Undefined symbols:
> _nf_close
> _nf_create
> _nf_def_dim
> _nf_def_var
> _nf_enddef
> _nf_put_att_text
> _nf_put_var_real
> _nf_put_vara_real
> _nf_strerror
> ./build/ozpom_withnetcdf.o reference to undefined _nf_close
> ./build/ozpom_withnetcdf.o reference to undefined _nf_create
> ./build/ozpom_withnetcdf.o reference to undefined _nf_def_dim
> ./build/ozpom_withnetcdf.o reference to undefined _nf_def_var
> ./build/ozpom_withnetcdf.o reference to undefined _nf_enddef
> ./build/ozpom_withnetcdf.o reference to undefined _nf_put_att_text
> ./build/ozpom_withnetcdf.o reference to undefined _nf_put_var_real
> ./build/ozpom_withnetcdf.o reference to undefined _nf_put_vara_real
> ./build/ozpom_withnetcdf.o reference to undefined _nf_strerror
> Make:
>   *** Ignoring Error code 256 from c++
> 
> -------------------------
> 
> can you shed some light on this for me?

I got a similar though not identical problem and couldn't come up with
a fix, so I'm CC:ing Steve Emmerson, our Fortran interface expert, to
see if he can figure this out.  (When I mention host names and file
names in this reply, it's for Steve's benefit.)

On mort, our Mac OS X 10.3.7 platform, I installed a demo version of
Absoft Pro Fortran 9.0 and prefixed my PATH with
/Applications/Absoft/bin so it is now:

  $ echo $PATH
  /Applications/Absoft/bin:/bin:/sbin:/usr/bin:/usr/sbin:/Developer/Tools

Then I applied to a new copy of our netCDF 3.6.0 distribution the
patch to src/fortran/cfortran.h from

  http://www.unidata.ucar.edu/packages/netcdf/other-builds.html#absoft-macosx

This patch didn't quite work because it's meant for the 4.1 version of
cfortran.h and we have the 4.3 version of cfortran.h in our 3.6.0
distribution, but I managed to manually apply the one hunk of the
patch that was rejected, resulting in the following file:

  http://my.unidata.ucar.edu/content/staff/russ/public/cfortran.h

Then I set the following environment variables:

  export CPPFLAGS=-DAbsoftProFortran \
         CFLAGS=''                   \
         FC=/Applications/absoft/bin/f90 \
         FFLAGS='-w -YEXT_NAMES=LCS -YEXT_SFX=_ -YCFRL=1' \
         F90=/Applications/absoft/bin/f90 \
         F90FLAGS='-w -YEXT_NAMES=LCS -YEXT_SFX=_ -YCFRL=1'

and invoked the configure script, which seemed to work fine with
Fortran-related output:

  checking if Fortran-related pre-processor flag needed... -DAbsoftProFortran 
-Df2cFortran
  checking user-defined Fortran-90 compiler "/Applications/absoft/bin/f90"... 
works
    ...
  checking for C-equivalent to Fortran routine "SUB"... sub_
  checking for Fortran "byte"... yes
  checking for Fortran "integer*2"... yes
  checking if Fortran "byte" is C "signed char"... yes
  checking if Fortran "byte" is C "short"... no
  checking if Fortran "byte" is C "int"... no
  checking if Fortran "byte" is C "long"... no
  checking if Fortran "integer*2" is C "short"... yes
  checking if Fortran "integer*2" is C "int"... no
  checking if Fortran "integer*2" is C "long"... no
  checking if Fortran "integer" is C "int"... yes
  checking if Fortran "real" is C "float"... yes
  checking if Fortran "doubleprecision" is C "double"... yes
  checking for Fortran-equivalent to netCDF "byte"... byte
  checking for Fortran-equivalent to netCDF "short"... integer*2

In particular, note that the configure script has decided that
-Df2cFortran is needed as part of the CPPFLAGS, although this was not
specified in the environment variable.

Invoking "make all" works fine, with no warnings and apparent success
compiling the f90 interface.

Invoking "make test" works fine until

  Making `test' in directory /home/russ/netcdf/build/mort-36-polzin/src/nf_test

  + /Applications/absoft/bin/f90 -c -w -YEXT_NAMES=LCS -YEXT_SFX=_ -YCFRL=1 
test_get.F
  + /Applications/absoft/bin/f90 -c -w -YEXT_NAMES=LCS -YEXT_SFX=_ -YCFRL=1 
test_put.F
  + /Applications/absoft/bin/f90 -c -w -YEXT_NAMES=LCS -YEXT_SFX=_ -YCFRL=1 
nf_error.F
  + /Applications/absoft/bin/f90 -c -w -YEXT_NAMES=LCS -YEXT_SFX=_ -YCFRL=1 
nf_test.F
  + /Applications/absoft/bin/f90 -c -w -YEXT_NAMES=LCS -YEXT_SFX=_ -YCFRL=1 
test_read.F
  + /Applications/absoft/bin/f90 -c -w -YEXT_NAMES=LCS -YEXT_SFX=_ -YCFRL=1 
test_write.F
  + /Applications/absoft/bin/f90 -c -w -YEXT_NAMES=LCS -YEXT_SFX=_ -YCFRL=1 
util.F
  cc -c    -DAbsoftProFortran -Df2cFortran fortlib.c
  /Applications/absoft/bin/f90 -o nf_test -w -YEXT_NAMES=LCS -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   
  ld: Undefined symbols:
  _nf_close_
  _nf_get_att_double_
  _nf_get_att_int1_
    ...

Looking for "_nf_close_" in the libnetcdf.a library that has just been
built, we find:

  src$ nm -g libsrc/libnetcdf.a | grep -i nf_close
  00000e18 T _nf_close__

and similarly for other missing externals, so the library has an extra
"_" after the netCDF C functions and hence they aren't found.

I hope Steve can figure out what the problem is here, but I'm guessing it
might be the extra -Df2cFortran flag on all the C compiles.

--Russ

_____________________________________________________________________

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