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

960208: netCDF on BSD



Masato,

>Date: Thu, 8 Feb 96 09:55:23 JST 
>From: address@hidden (Masato Shiotani)
>Organization: Div. of Ocean and Atmospheric Sci., Hokkaido Univ.
>Subject: Re: 960207: netCDF on BSD 
>Keywords: 199602010918.AA01928

In the above message you wrote:

> I suppose we are getting close to the goal.

Yes, we are.

> Taking your suggestions, I tried to strat from the beginning as
> follows:
> 
> # zcat netcdf-2.4-beta6.tar.Z | tar xvf -
> # cd netcdf-2.4-beta6/src
> # setenv CC gcc
> # setenv FC f77 (This is a simple script combining f2c + gcc.)
> # ./configure --prefix=/usr/local
> # make
> 
> !!! error in fortran/ directory
> 
> # cd fortran
> # make clean
> 
> ... put bsd_f2c.m4, netcdf.inc, jackets.c in this directory
> ... change OS macro bsd/os to bsd_f2c in Makefile
> 
> # make
> # cd ..
> # make
> 
> !!! still problem in xdr
> 
> # cd xdr
> 
> ... put library name of LIBOBJS macro in Makefile as follows:
> 
>       LIBOBJS     = xdr.o xdrfloat.o xdrstdio.o xdrarray.o
> 
> # make clean
> # make all
> 
> The following is the output.
> 
> gcc -c -O -I/usr/include/rpc xdr.c
> gcc -c -O -I/usr/include/rpc xdrfloat.c
> gcc -c -O -I/usr/include/rpc xdrstdio.c
> gcc -c -O -I/usr/include/rpc xdrarray.c
> ar rcuv ../libsrc/libnetcdf.a xdr.o xdrfloat.o xdrstdio.o xdrarray.o
> r - xdr.o
> r - xdrfloat.o
> r - xdrstdio.o
> r - xdrarray.o
> ranlib ../libsrc/libnetcdf.a
> 
> # make test
> 
> The following is the output.
> 
> gcc -c -O -I/usr/include/rpc xdrtest.c
> gcc -o xdrtest -O xdrtest.o xdr.o xdrfloat.o xdrstdio.o xdrarray.o -lrpc
> ./xdrtest > xdrtest_out.new
> diff xdrtest_out.new testout.sav
> *** XDR passes formatted test ***
> cmp test.xdr test_xdr.sav
> *** XDR passes binary test ***
> 
> # cd ..
> # make test >& make_test.log
> 
> The following the output.
> 
> making `test' in directory /usr/local/src/netcdf-2.4-beta6/src/xdr
> 
> gcc -c -O -I/usr/include/rpc xdrtest.c
> gcc -o xdrtest -O xdrtest.o xdr.o xdrfloat.o xdrstdio.o xdrarray.o -lrpc
> ./xdrtest > xdrtest_out.new
> diff xdrtest_out.new testout.sav
> *** XDR passes formatted test ***
> cmp test.xdr test_xdr.sav
> *** XDR passes binary test ***
> 
> returning to directory /usr/local/src/netcdf-2.4-beta6/src
> 
> 
> making `test' in directory /usr/local/src/netcdf-2.4-beta6/src/libsrc
> 
> gcc -c -O  cdftest.c
> ar rcuv libnetcdf.a array.o attr.o cdf.o dim.o file.o iarray.o error.o  
> globdef.
> o putget.o putgetg.o sharray.o string.o var.o  xdrposix.o
> ranlib libnetcdf.a
> gcc -o cdftest -O cdftest.o libnetcdf.a -lrpc
> ./cdftest > cdftest_out.new
> diff cdftest_out.new testout.sav
> *** netCDF passes formatted test ***
> cmp test.nc test_cdf.sav
> *** netCDF passes binary test ***
> 
> returning to directory /usr/local/src/netcdf-2.4-beta6/src
> 
> 
> making `test' in directory /usr/local/src/netcdf-2.4-beta6/src/nctest
> 
> gcc -o nctest -O varget.o vargetg.o varput.o varputg.o vardef.o vartests.o 
> vputg
> et.o vputgetg.o driver.o cdftests.o dimtests.o rec.o atttests.o misctest.o 
> add.o
>  error.o emalloc.o val.o slabs.o ../libsrc/libnetcdf.a -lrpc
> ./nctest
> *** Testing nccreate ...        ok ***
> *** Testing ncopen ...          ok ***
> *** Testing ncredef ...         ok ***
> *** Testing ncendef ...         ok ***
> *** Testing ncclose ...         ok ***
> *** Testing ncinquire ...       ok ***
> *** Testing ncsync ...          ok ***
> *** Testing ncabort ...         ok ***
> *** Testing ncdimdef ...        ok ***
> *** Testing ncdimid ...         ok ***
> *** Testing ncdiminq ...        ok ***
> *** Testing ncdimrename ...     ok ***
> *** Testing ncvardef ...        ok ***
> *** Testing ncvarid ...         ok ***
> *** Testing ncvarinq ...        ok ***
> *** Testing ncvarput1 ...       ok ***
> *** Testing ncvarget1 ...       ok ***
> *** Testing ncvarput ...        ok ***
> *** Testing ncvarget ...        ok ***
> *** Testing ncvarputg ...       ok ***
> *** Testing ncvargetg ...       ok ***
> *** Testing ncrecinq ...        ok ***
> *** Testing ncrecput ...        ok ***
> *** Testing ncrecget ...        ok ***
> *** Testing ncvarrename ...     ok ***
> *** Testing ncattput ...        ok ***
> *** Testing ncattinq ...        ok ***
> *** Testing ncattget ...        ok ***
> *** Testing ncattcopy ...       ok ***
> *** Testing ncattname ...       ok ***
> *** Testing ncattrename ...     ok ***
> *** Testing ncattdel ...        ok ***
> *** Testing nctypelen ...       ok ***
> 
> returning to directory /usr/local/src/netcdf-2.4-beta6/src
> 
> 
> making `test' in directory /usr/local/src/netcdf-2.4-beta6/src/fortran
> 
> ar rcuv ../libsrc/libnetcdf.a jackets.o
> ranlib ../libsrc/libnetcdf.a
> ./fortc -L . -O bsd_f2c ftest.src > ftest.f
> m4: -: cannot open for input.
> f77 -c  ftest.f
> f2c ftest.f
> ftest.f:
> gcc ftest.c -O3 -m486 -funroll-loops -c
> f77 -o ftest ftest.o -L../libsrc -lnetcdf -lrpc
> no fortran file.
> ./ftest
> ./ftest: not found
> *** Error code 1
> 
> Stop.
> *** Error code 1
> 
> Stop.
> 
> It seems that the operation below looks something strange.
> 
>       f77 -o ftest ftest.o -L../libsrc -lnetcdf -lrpc
> 
> I tried manually:
> 
> # f77 -o ftest ftest.f -L../libsrc -lnetcdf -lrpc
> 
> Then, the output is as follows:
> 
> f2c ftest.f
> ftest.f:
> gcc ftest.c -O3 -m486 -funroll-loops -o ftest -L../libsrc -lnetcdf -lrpc 
> -lF77 -lI77 -lcfpu
> main.o: Undefined symbol _MAIN__ referenced from text segment
> 
> Our 'f2c' works well almost all fortran programs, so it seems a
> problem in the NetCDF jeckets or somewhere else.

The FORTRAN API is tested in the fortran/ subdirectory by the FORTRAN
test program `ftest.f'.  This program is created from the file
`ftest.src' by the same process that creates the files `netcdf.inc' and
`jackets.c'.  The process didn't work for those files because of the
broken m4(1) utility, so it doesn't work for `ftest.f' either.

I'm sending you an appropriate `ftest.f' file in another message.  If
you put it in the fortran/ subdirectory, then the `make test' should
work.

Be very careful about executing the command `make clean'.  It will
remove all the files that I sent you.

> By the way, I tried to test the rest of directories such as ncdump,
> ncgen and c++.  The outputs from these are:
> 
> < ncdump >
> 
> gcc -o ncdump -O ncdump.o vardata.o dumplib.o ../libsrc/libnetcdf.a -lrpc
> ../ncgen/ncgen -o test0.nc -n test0.cdl
> ./ncdump test0.nc > test1.cdl
> ../ncgen/ncgen -o test1.nc -n test1.cdl
> ./ncdump -n test0 test1.nc > test2.cdl
> *** ncdump test successful ***

This is good.

> < ncgen >
> 
> gcc -o ncgen -O main.o load.o ncgentab.o escapes.o getfill.o init.o close.o 
> genlib.o ../libsrc/libnetcdf.a -lrpc
> ./ncgen -b -o test0.nc test0.cdl
> ../ncdump/ncdump -n test1 test0.nc > test1.cdl
> ./ncgen -b test1.cdl
> ../ncdump/ncdump test1.nc > test2.cdl
> *** ncgen -b test successful ***
> ./ncgen -c -o ctest0.nc test0.cdl > test0.c
> gcc -I../libsrc -O -o ctest0 test0.c ../libsrc/libnetcdf.a -lrpc
> ./ctest0                # tests `-c' option, creates ctest0.nc
> ../ncdump/ncdump -n test1 ctest0.nc > ctest1.cdl
> *** ncgen -c test successful ***
> `netcdf.inc' is up to date.
> f2c test0.f
> test0.f:
>    MAIN fgennc:
> Warning on line 64 of test0.f: inconsistent calling sequences for ncapt,
>         arg 6: here integer variable, previously integer*2 variable.
> Warning on line 100 of test0.f: inconsistent calling sequences for ncvpt,
>         arg 5: here integer variable, previously integer*2 variable.
> Warning on line 131 of test0.f: ncdid declared EXTERNAL but never used.
> Warning on line 131 of test0.f: ncvid declared EXTERNAL but never used.
> Warning on line 131 of test0.f: ncopn declared EXTERNAL but never used.
> Warning on line 131 of test0.f: ncsfil declared EXTERNAL but never used.
> Warning on line 131 of test0.f: nctlen declared EXTERNAL but never used.

The above messages may be safely ignored.

> gcc test0.c -O3 -m486 -funroll-loops -o ftest0 ../libsrc/libnetcdf.a -lrpc 
> -lF77 -lI77 -lcfpu
> *** ncgen -f test successful ***

This is also good.

> In this test, a fortran program test0.f works well.  I wonder why
> ftest.f in fortran/ directory failed.
> 
> < c++ >
> 
> ar rcuv libnetcdf_c++.a netcdf.o ncvalues.o
> ranlib libnetcdf_c++.a
> g++  nctst.o -L. -lnetcdf_c++ -L../libsrc -lnetcdf -lrpc -o nctst
> ./nctst > test.out
> *** C++ test successful ***

It looks like you're almost done.  The remaining steps are

    1.  Testing the FORTRAN API using the file `ftest.f' that will come
        in another message.

    2.  Installing the netCDF package by executing the command `make
        install' from the top-level source directory.

    3.  Cleaning up by executing the command `make clean' from the
        top-level source directory.  NOTE: This command will remove
        the fortran/ subdirectory files that I sent you: `netcdf.inc',
        `jackets.c', and `ftest.f'.  You should probably save these
        files before executing the command.

> >> Are you in Oceanographic or Atmospheric Science?  We have several
> >> meteorologists here; I'm the only oceanographer.
> 
> I am a meteorologist having an interest in the middle atmosphere.
> During the last 10 years, I had two chances to stay at NCAR for about
> one year each, so I have many friends there.  I don't know exactly the
> relation between NCAR and UNIDATA sponsored by UCAR, but I imagine you
> are enjoying Boulder life.

Yes, I am.  Thanks.

--------
Steve Emmerson   <address@hidden>