[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[netCDF #BVS-485205]: Ticket ID: GLX-497823
- Subject: [netCDF #BVS-485205]: Ticket ID: GLX-497823
- Date: Wed, 20 Mar 2013 21:19:33 -0600
> Dear Sir,
>
> I asked for support about compiling error with netcdf library on March 13th.
>
> I have still worked with same issues. But I got some different
> results from editing the content of Makefile as follow:
>
> before: LIBNETCDF =
> -L/Users/tsubota/wrf/COMPILER_gfortran/netcdf-install/lib -lnetcdf -lm
> after: LIBNETCDF =
> -L/Users/tsubota/wrf/COMPILER_gfortran/netcdf-install/lib -lnetcdff -lnetcdf
> -lm
Yes, you definitely needed to use -lnetcdff -lnetcdf, because the netCDF
Fortran library is
separate from the netCDF C library and needs to call functions in the C library.
> ...
> wrf_to_gmt: wrf_to_gmt.o module_wrf_to_gmt_netcdf.o module_wrf_to_gmt_util.o \
> module_create_grdfile.o module_GMT35.o calcrh.o ept.o ssi.o ttd.o \
> cloud_amount.o weather.o module_sublib.o
> $(FC) $(FCFLAGS) -o wrf_to_gmt wrf_to_gmt.o \
> module_wrf_to_gmt_netcdf.o \
> module_wrf_to_gmt_util.o \
> module_create_grdfile.o \
> module_GMT35.o \
> module_sublib.o \
> cloud_amount.o \
> weather.o \
> calcrh.o ept.o ssi.o ttd.o \
> $(LIBNETCDF)
> ...
> The following is the results of make:
>
> dyn-160-39-154-104:src tsubota$ make clean
> rm -f *.o *~ *.mod *.f wrf_to_gmt
> dyn-160-39-154-104:src tsubota$ make
> /opt/local/bin/cpp -I. -C -traditional -DRECL1
> module_wrf_to_gmt_netcdf.f90 > module_wrf_to_gmt_netcdf.f
> gfortran -C -ffree-form -O2 -fno-range-check -c
> module_wrf_to_gmt_netcdf.f
> -I/Users/tsubota/wrf/COMPILER_gfortran/netcdf-install/include -I./
> gfortran -C -ffree-form -O2 -fno-range-check -c module_GMT35.f90
> -I/Users/tsubota/wrf/COMPILER_gfortran/netcdf-install/include -I./
> gfortran -C -ffree-form -O2 -fno-range-check -c module_create_grdfile.f90
> gfortran -C -ffree-form -O2 -fno-range-check -c module_sublib.f90
> /opt/local/bin/cpp -I. -C -traditional -DRECL1
> module_wrf_to_gmt_util.f90 > module_wrf_to_gmt_util.f
> gfortran -C -ffree-form -O2 -fno-range-check -c
> module_wrf_to_gmt_util.f
> -I/Users/tsubota/wrf/COMPILER_gfortran/netcdf-install/include -I./
> /opt/local/bin/cpp -I. -C -traditional -DRECL1 wrf_to_gmt.f90 > wrf_to_gmt.f
> gfortran -C -ffree-form -O2 -fno-range-check -c wrf_to_gmt.f
> -I/Users/tsubota/wrf/COMPILER_gfortran/netcdf-install/include -I./
> gfortran -C -ffree-form -O2 -fno-range-check -c calcrh.f90
> gfortran -C -ffree-form -O2 -fno-range-check -c ept.f90
> gfortran -C -ffree-form -O2 -fno-range-check -c ssi.f90
> gfortran -C -ffree-form -O2 -fno-range-check -c ttd.f90
> gfortran -C -ffree-form -O2 -fno-range-check -c cloud_amount.f90
> gfortran -C -ffree-form -O2 -fno-range-check -c weather.f90
> gfortran -C -ffree-form -O2 -fno-range-check -o wrf_to_gmt wrf_to_gmt.o \
> module_wrf_to_gmt_netcdf.o \
> module_wrf_to_gmt_util.o \
> module_create_grdfile.o \
> module_GMT35.o \
> module_sublib.o \
> cloud_amount.o \
> weather.o \
> calcrh.o ept.o ssi.o ttd.o \
>
> -L/Users/tsubota/wrf/COMPILER_gfortran/netcdf-install/lib -lnetcdff
> -lnetcdf -lm
> Undefined symbols for architecture x86_64:
> "_iargc_", referenced from:
> _MAIN__ in wrf_to_gmt.o
> ld: symbol(s) not found for architecture x86_64
> collect2: error: ld returned 1 exit status
> make: *** [wrf_to_gmt] Error 1
> dyn-160-39-154-104:src tsubota$
_iargc_ is not part of the netCDF library and not required by netCDF. I think
it's used by the Fortran main program in wrf_to_gmt. It should have been
provided by the run-time library installed with your compilers.
That looks like a problem that could occur if the gfortran you are using is not
working with the C runtime library that the gcc compiler uses. Since MacOS-X
doesn't come with a gfortran compiler, but does come with a special version of
gcc, you either have to use a gcc compatible with the gfortran you downloaded,
or you have to use a gfortran built specifically for use with the gcc that comes
with the Apple XTools.
You might try downloading or building gfortran from source, as described here:
http://gcc.gnu.org/wiki/GFortranBinaries#MacOS
or here:
http://hpc.sourceforge.net/
--Russ
Russ Rew UCAR Unidata Program
address@hidden http://www.unidata.ucar.edu
Ticket Details
===================
Ticket ID: BVS-485205
Department: Support netCDF
Priority: Normal
Status: Closed