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

20020911: undef ref to 'nf_... (cont.)



>From: James McCreight <address@hidden>
>Organization: UMT
>Keywords: 200209031656.g83GuXZ04528 netCDF

James,

>That didn't work. Here is the new output, you can see the space.

Again, the '-L/usr/local/lib -lnetcdf' _assumes_ that libnetcdf.a
exists in the /usr/local/lib directory.  (It also assumes that it is
readable by you).  When I look at the contents of 'install.log' that
you included in your previous email, I see that the newly built
libnetcdf.a library is being installed in a directory other than
/usr/local/lib:

- install.log -
 ...
cp libnetcdf.a /home/james/netcdf-3.5.0/lib/libnetcdf.a
 ...

So, it seems to me that your reference to the netCDF library in the
link for the CCSM code should be:

-L/home/james/netcdf-3.5.0/lib -lnetcdf

Given that the newly built netCDF library is in a different location,
the include files will be in a different location also.  This is bourne
out by the install of the include files for v3.5.0:

- install.log -
 ...
cp netcdf.h /home/james/netcdf-3.5.0/include/netcdf.h
 ...

All of this tells me that there may be a libnetcdf.a in /usr/local/lib,
and netcdf.h in /usr/local/include, but these are not the copies of the
library and include file you just built.

We know that the pgf90 compiled code can link against the newly created
libnetcdf.a and the executable will work correctly since the build and
execution of nf_test works:

- test.log -
 ...

/usr/pgi/linux86/bin/pgf90 -o nf_test -O -w  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  -lm 
./nf_test -c
./nf_test
*** Testing nf_strerror ... 
*** Testing nf_open ... 
*** Testing nf_close ... 
 ...

>I cleaned and recompiled and voila, same problem.

Yes, and the same install location.

>James
>
> Making target 'csim'
>pgf90 -o csim -r8 -byteswapio ./compile/ice_albedo.o ./compile/ice_atmo.o
>./compile/ice_calendar.o ./compile/ice_constants.o ./compile/ice_coupling.o
>./compile/ice_dh.o ./compile/ice_mechred.o ./compile/ice_domain.o
>./compile/ice_dyn_evp.o ./compile/ice_flux.o ./compile/ice_grid.o
>./compile/ice_history.o ./compile/ice_init.o ./compile/ice_itd.o
>./compile/ice_itd_linear.o ./compile/ice_kinds_mod.o ./compile/ice_model_size.
> o
>./compile/ice_mpi_internal.o ./compile/ice_ocean.o ./compile/sys_column.o
>./compile/ice_read_write.o ./compile/ice_scaling.o ./compile/ice_state.o
>./compile/ice_therm_driver.o ./compile/ice_timers.o ./compile/ice_transport.o
>./compile/ice_tstm.o ./compile/ice_vthermo.o ./compile/ice_column.o
>./compile/ice_diagnostics.o -L/usr/local/lib/ -lnetcdf 
>./compile/ice_history.o: In function `ice_history_icecdf_':
>./compile/ice_history.o(.text+0x1daf): undefined reference to `nf_create_'
>./compile/ice_history.o(.text+0x1de2): undefined reference to `nf_def_dim_'
>./compile/ice_history.o(.text+0x1e10): undefined reference to `nf_def_dim_'
>./compile/ice_history.o(.text+0x1e43): undefined reference to `nf_def_dim_'
>./compile/ice_history.o(.text+0x1e9c): undefined reference to `nf_def_var_'
>./compile/ice_history.o(.text+0x1edc): undefined reference to `nf_put_att_text
> _'
>./compile/ice_history.o(.text+0x1f1c): undefined reference to `nf_put_att_text
> _'
>./compile/ice_history.o(.text+0x1f5c): undefined reference to `nf_def_var_'
>./compile/ice_history.o(.text+0x1f9c): undefined reference to `nf_put_att_text
> _'
>./compile/ice_history.o(.text+0x1fdc): undefined reference to `nf_put_att_text
> _'
>./compile/ice_history.o(.text+0x2025): undefined reference to `nf_def_var_'
>./compile/ice_history.o(.text+0x2065): undefined reference to `nf_put_att_text
> _'
>./compile/ice_history.o(.text+0x20a5): undefined reference to `nf_put_att_text
> _'
>./compile/ice_history.o(.text+0x20e5): undefined reference to `nf_put_att_text
> _'
>./compile/ice_history.o(.text+0x2143): undefined reference to `nf_put_att_text
> _'
>./compile/ice_history.o(.text+0x2185): undefined reference to `nf_put_att_text
> _'
>./compile/ice_history.o(.text+0x21ec): undefined reference to `nf_def_var_'
>./compile/ice_history.o(.text+0x222c): undefined reference to `nf_put_att_text
> _'
>./compile/ice_history.o(.text+0x226c): undefined reference to `nf_put_att_text
> _'
>./compile/ice_history.o(.text+0x22ac): undefined reference to `nf_put_att_text
> _'
>./compile/ice_history.o(.text+0x22ec): undefined reference to `nf_def_var_'
>./compile/ice_history.o(.text+0x232c): undefined reference to `nf_put_att_text
> _'
>./compile/ice_history.o(.text+0x236c): undefined reference to `nf_put_att_text
> _'
>./compile/ice_history.o(.text+0x23ac): undefined reference to `nf_put_att_text
> _'
>./compile/ice_history.o(.text+0x23ec): undefined reference to `nf_def_var_'
>./compile/ice_history.o(.text+0x242c): undefined reference to `nf_put_att_text
> _'
>./compile/ice_history.o(.text+0x246c): undefined reference to `nf_put_att_text
> _'
>./compile/ice_history.o(.text+0x24ac): undefined reference to `nf_put_att_text
> _'
>./compile/ice_history.o(.text+0x2516): undefined reference to `nf_def_var_'
>./compile/ice_history.o(.text+0x257c): undefined reference to `nf_put_att_text
> _'
>./compile/ice_history.o(.text+0x25da): undefined reference to `nf_put_att_text
> _'
>./compile/ice_history.o(.text+0x261a): undefined reference to `nf_put_att_text
> _'
>./compile/ice_history.o(.text+0x265a): undefined reference to `nf_put_att_real
> _'
>./compile/ice_history.o(.text+0x269a): undefined reference to `nf_put_att_real
> _'
>./compile/ice_history.o(.text+0x2703): undefined reference to `nf_put_att_text
> _'
>./compile/ice_history.o(.text+0x2745): undefined reference to `nf_put_att_text
> _'
>./compile/ice_history.o(.text+0x27d8): undefined reference to `nf_put_att_text
> _'
>./compile/ice_history.o(.text+0x2857): undefined reference to `nf_put_att_text
> _'
>./compile/ice_history.o(.text+0x28d6): undefined reference to `nf_put_att_text
> _'
>./compile/ice_history.o(.text+0x2955): more undefined references to
>`nf_put_att_text_' follow
>./compile/ice_history.o: In function `ice_history_icecdf_':
>./compile/ice_history.o(.text+0x295f): undefined reference to `nf_enddef_'
>./compile/ice_history.o(.text+0x29b9): undefined reference to `nf_inq_varid_'
>./compile/ice_history.o(.text+0x29da): undefined reference to `nf_put_var_real
> _'
>./compile/ice_history.o(.text+0x2a34): undefined reference to `nf_inq_varid_'
>./compile/ice_history.o(.text+0x2a55): undefined reference to `nf_put_var_real
> _'
>./compile/ice_history.o(.text+0x2a8c): undefined reference to `nf_inq_varid_'
>./compile/ice_history.o(.text+0x2aba): undefined reference to `nf_put_vara_rea
> l_'
>./compile/ice_history.o(.text+0x2b20): undefined reference to `nf_inq_varid_'
>./compile/ice_history.o(.text+0x2b41): undefined reference to `nf_put_var_real
> _'
>./compile/ice_history.o(.text+0x2ba7): undefined reference to `nf_inq_varid_'
>./compile/ice_history.o(.text+0x2bc8): undefined reference to `nf_put_var_real
> _'
>./compile/ice_history.o(.text+0x2c22): undefined reference to `nf_inq_varid_'
>./compile/ice_history.o(.text+0x2c43): undefined reference to `nf_put_var_real
> _'
>./compile/ice_history.o(.text+0x2cf0): undefined reference to `nf_inq_varid_'
>./compile/ice_history.o(.text+0x2d23): undefined reference to `nf_put_vara_rea
> l_'
>./compile/ice_history.o(.text+0x2d4f): undefined reference to `nf_close_'
>/usr/bin/ld: final link failed: Bad value
>make: *** [csim] Error 2
>
>
>
>
>Quoting Unidata Support <address@hidden>:
>
>> >From: James McCreight <address@hidden>
>> >Organization: UMT
>> >Keywords: 200209031656.g83GuXZ04528 netCDF
>> 
>> James,
>> 
>> >In response to the message below (way down at the bottom), I have
>> rebuilt
>> >netcdf and everything looks good to me. Just to make sure, I have
>> included
>> >all the details below as directed in INSTALL.html #1-9.
>> 
>> Good.  This makes troubleshooting possible.
>> 
>> >I entered the env vars as
>> >specified except that I had to change FC according to the correct path
>> for my
>> >pgf90.  Yes, I exported them too. 
>> 
>> Good.
>> 
>> >But, this reinstallation has not fixed my problem.
>> >My code uses libnetcdf.a and netcdf.inc. I think the problem is coming
>> from
>> >the some sort of compiler interaction with netcdf.inc, but really am
>> not be
>> >sure.
>> >The error message i get compiling my ccsm sea ice code follows directly
>> after
>> >this message and the items A-H from INSTALL.html follow that.
>> >Please help!
>> 
>> I don't know if the output from your compile of the CCSM code is exact
>> (i.e., if the output shows spaces where they are and doesn't add
>> spaces
>> where they aren't), but assuming it is, the following looks like an
>> error:
>> 
>> >./compile/ice_diagnostics.o -L/usr/local/lib/-lnetcdf 
>> 
>> What you have tells the linker to search the directory
>> /usr/local/lib/-lnetcdf for libraries.  What you want is to tell the
>> linker to search /usr/local/lib for libraries, including libnetcdf.a.
>> 
>> The way one specifies the search of a library is:
>> 
>> -L/usr/local/lib -lnetcdf
>>         ^       ^    ^____ library to search
>>         |       |_________ this is a space!
>>         |_________________ the directory in which to look for
>> libraries
>> 
>> This specification will assume that libnetcdf.a is located in 
>> /usr/local/lib.
>> 
>> >Thanks again,
>> 
>> Please let me know if this isn't your problem.
>> 
>______________________________________________________________________________
>
>James McCreight                          address@hidden 
>Grad Student                             303 735-2953
>University of Colorado                   Campus Box 311, Boulder, CO, 80302
>PAOS                                     http://paos.colorado.edu/~mccreigh

Tom