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

Re: 20030307: netCDF library



>To: address@hidden
>From: Jiping Lu <address@hidden>
>Subject: Re: 20030307: netCDF library
>Organization: UCAR/Unidata
>Keywords: 200303052120.h25LKu328115

Hi Jiping Lu,

> I did some thing like this:
> 
> Edited  ~/wrf/WRFV1/main/Makefile, where error occurred when compile wrf.
> 
> at line  LIBPATHS =
> 
> Added this: LIBPATHS = -L$/lib -lnetcdf

Sorry, that won't work.  The "$" won't be expanded to a directory
name, and will just disappear, since it is not followed by a single
letter or a macro name enclosed in () or {}.  The macros in Makefiles
are not the same as environment variables like $HOME, even though the
syntax looks similar.  I recommend that you just put the absolute path
of your home directory there, something like:

  LIBPATHS = -L/home/jiping/lib -lnetcdf

if your home directory happens to be "/home/jiping" and you have
installed the netCDF libraries in "/home/jiping/lib".  If you have the
library installed in "/home/jiping/netcdf/netcdf-3.5.0/lib", then use
that after "-L" instead.

> ( if I do   LIBPATHS = -L$(Home)/netcdf/netcdf-3.5.0/lib -lnetcdf, I'll get
> same error like last time "   f90 -o wrf.exe  wrf.o libwrflib.a
> ../frame/internal_header_util.o
> ../frame/pack_utils.o         ld32: ERROR   33 : Unresolved text symbol
> "ext_ncd_get_dom_ti_real_" -- 1st referenced by
> ibwrflib.a(module_io.o)."  )

Also not that $(HOME) is not the same as $(Home) in a Makefile.  Upper
and lower case define different macro names.


> then at line:
> 
>       $(FC) -o wrf.exe $(LDFLAGS) wrf.o libwrflib.a $(LIB)
> added LIBPATHS  at the end :
>       $(FC) -o wrf.exe $(LDFLAGS) wrf.o libwrflib.a $(LIB) $(LIBPATHS)
> 
> I also setenv LD_LIBRARY_PATH $(NETCDFPATH)/lib, but I still got error at
> same place:
> 
>       f90 -o wrf.exe  wrf.o libwrflib.a ../frame/internal_header_util.o
> ../frame/pack_utils.o -L/lib -lnetcdf
> ld32: FATAL   9  : I/O error (-lnetcdf): No such file or directory
> *** Error code 2 (bu21) (ignored)
>       ( cd run ; /bin/rm -f wrf.exe ; ln -sf ../main/wrf.exe . )

You can see from the above that "-L$/lib" just became "-L/lib" when
the empty macro "$" was expanded, so the compiler couldn't find the
library in "/lib".  You should not need to set LD_LIBRARY_PATH if you
link statically to the netcdf library.

> Do I need to do "include $(NETCDFPATH) " in that Makefile?
> My administrator doesn't allow me to install NetCDF in root directory,
> unless there is no other way around. Thanks a million!

No, just get the LIBPATHS macro defined correctly and things should
work.  If you have other problems with the WRF Makefiles, you'll need
to consult with the WRF support staff.

--Russ

_____________________________________________________________________

Russ Rew                                         UCAR Unidata Program
address@hidden                      http://my.unidata.ucar.edu