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

[netCDF #TEO-316179]: reg Netcdf-linking problem


> I am Subhajit Kar, from India. I installed netcdf-3.6.3 on blue gene which 
> has ibm xl compiler. While compiling my fortran code its giving error-
> ld: skipping incompatible ./libs//libnetcdf.a when searching for -lnetcdf
> ld: cannot find -lnetcdf
> I linked the libnetcdf.a to a directory where my fortran code is installed.
> I attached my config.log file in attachment.
> What would be actual problem..is it becuase of compiler problem or else i 
> have to use different netcdf version.

Your configure script completed successfully.  I assume you ran "make
check" and "make install" to get the libraries installed under the
directory you specified with the --prefix=... option to configure. So
in the lib/ subdirectory of that directory, there should be a

The error message you are seeing often means there is a mismatch
between compiler flags used to build the libraries and compiler flags
used to compile applications.

You can check whether the netCDF library was built for 32-bit or
64-bit architectures.  One way to do this uses the "ar" and "file"
commands to extract one of the archived objects and examine what kind
of file it is.  For example:

  $ DIR=/home/proj/14/esdsubha/bluegene/netcdf/lib
  $ ar p $DIR/libnetcdf.a attr.o > /tmp/attr.o
  $ file /tmp/attr.o
   /tmp/attr.o: ELF 64-bit LSB relocatable, x86-64, version 1 (SYSV), not 

Here the output makes it clear that the binary object attr.o is a
64-bit object, so would not be usable with applications compiled for
32-bit libraries.

Another possible cause for the error is having multiple versions of
netCDF libraries installed and having the compiler linking with one
you did not intend to use.  Specify where you want to compiler to look
for the library using the

  ... -L $DIR/lib -lnetcdf

flags to make sure you aren't linking with a library in /usr/lib/, for


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

Ticket Details
Ticket ID: TEO-316179
Department: Support netCDF
Priority: Normal
Status: Closed

NOTE: All email exchanges with Unidata User Support are recorded in the Unidata inquiry tracking system and then made publicly available through the web. If you do not want to have your interactions made available in this way, you must let us know in each email you send to us.