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

[netCDF #RQJ-625597]: cannot read or write netcdf files (Linux)



Cameron,

It's possible that the netCDF libray could have been built with some
special compile flag such as "-r64" that said Fortran REAL was 64-bits
but your program was compiled without that flag, so it thinks REAL is
32-bits.  So make sure you used the same compiler flags to compile
your program as were used to build the netCDF library.

Another possibility is that you are compiling in a 64-bit development
environment but your netCDF libraries were compiled for 32-bit, or
vice versa.  The operating system is supposed to tell you if you are
trying to link with the wrong kind of object file or library, but I
have seen cases where it didn't, and the result is quite mysterious,
with programs linking OK, but not working right.  Check with the
"file" command that your program and library are built for the same
development environment.  If your library is just something like
libnetcdf.a, "file" may just say it is an ar archive, in which case
you may have to extract something out of it and run "file" on that,
like

  $ file myprogram
  myprogram: ELF 32-bit LSB executable 80386 Version 1 [FPU], dynamically
  linked, not stripped
  $ file /usr/local/lib/libnetcdf.a
  /usr/local/lib/libnetcdf.a: current ar archive, not a dynamic executable or
  shared object
  $ ar -xv /usr/local/lib/libnetcdf.a /tmp/attr.o
  x - attr.o
  $ file /tmp/attr.o
  /tmp/attr.o: ELF 32-bit LSB relocatable 80386 Version 1

The output above shows both myprogram and an object in libnetcdf.a are
both 32-bit objects, so they are compatible.

--Russ

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



Ticket Details
===================
Ticket ID: RQJ-625597
Department: Support netCDF
Priority: Normal
Status: Closed