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

[netCDF #ORV-791255]: libsz.so.2 linking problem



Matthew,

> Thanks for getting back to me. I get a different error with -lsz. I
> don't know if it is relevant but I am using 64-bit Ubuntu, could it be
> that the libsz.a file is for 32-bit?

Yes, that would explain the symptoms.

You should be able to tell by using the "ar" command to extract 
executables from libsz.a and the "file" command to determine what
kind of objects they are.  For example, here's how I determine that 
on our Linux platform:

  $ cd /tmp
  $ ar xv /local/lib/libsz.a
  x - rice.o
  x - sz_api.o
  x - encoding.o
  $ file sz_api.o
  sz_api.o: ELF 64-bit LSB relocatable, x86-64, version 1 (SYSV), not stripped

If you do this and it says the objects are 32-bit, then that explains why
you can't link with them.

--Russ

> mb@mb-laptop:~/j64-602/bin$ uname --all
> Linux mb-laptop 2.6.28-11-generic #42-Ubuntu SMP Fri Apr 17 01:58:03
> UTC 2009 x86_64 GNU/Linux
> 
> 
> mb@mb-laptop:~/netcdf/mbexample$ cc -o test test.o
> -L/home/mb/netcdf/lib -L/home/mb/hdf/lib -L/home/mb/szip/lib -lnetcdf
> -lhdf5_hl -lhdf5 -lz -lsz
> /usr/bin/ld: skipping incompatible /home/mb/szip/lib/libsz.a when
> searching for -lsz
> /usr/bin/ld: cannot find -lsz
> collect2: ld returned 1 exit status
> 
> 
> On Thu, May 28, 2009 at 3:07 AM, Unidata netCDF Support
> <address@hidden> wrote:
> > Hi Matthew,
> >
> > Does it work if you add "-lsz" to the end of the compile line, as in:
> >
> >  cc -o test test.o -L/home/mb/netcdf/lib -L/home/mb/hdf/lib 
> > -L/home/mb/szip/lib -lnetcdf -lhdf5_hl -lhdf5 -lz -lsz
> >
> > --Russ
> >
> >> Does anybody know how I can get the libsz.so.2 file which is
> >> required by the error below?
> >>
> >> I downloaded the szip stuff from
> >> http://hdf.ncsa.uiuc.edu/release4/obtain.html but it does not contain
> >> a .so.2 file, it only has .a and .la files.
> >>
> >> The test.c program is just:
> >> #include <netcdf.h>
> >> int main ()  {
> >> printf("%s\n", nc_inq_libvers());
> >> }
> >>
> >> root@mb-laptop:/home/mb/netcdf/mbexample# cc -c -I/home/mb/netcdf/include 
> >> test.c
> >> test.c: In function ‘main’:
> >> test.c:3: warning: incompatible implicit declaration of built-in
> >> function ‘printf’
> >>
> >> root@mb-laptop:/home/mb/netcdf/mbexample# cc -o test test.o
> >> -L/home/mb/netcdf/lib -L/home/mb/hdf/lib -L/home/mb/szip/lib  -lnetcdf
> >> -lhdf5_hl -lhdf5 -lz
> >> /usr/bin/ld: warning: libsz.so.2, needed by
> >> /home/mb/hdf/lib/libhdf5_hl.so, not found (try using -rpath or
> >> -rpath-link)
> >> /home/mb/hdf/lib/libhdf5.so: undefined reference to `SZ_encoder_enabled'
> >> /home/mb/hdf/lib/libhdf5.so: undefined reference to `SZ_BufftoBuffCompress'
> >> /home/mb/hdf/lib/libhdf5.so: undefined reference to 
> >> `SZ_BufftoBuffDecompress'
> >> collect2: ld returned 1 exit status
> >>
> >> root@mb-laptop:/home/mb/netcdf/mbexample# ls -lh /home/mb/szip/lib/
> >> total 52K
> >> -rwxr-xr-x 1 mb mb 48K 2007-01-23 02:10 libsz.a
> >> -rwxr-xr-x 1 mb mb 775 2007-01-23 02:10 libsz.la
> >>
> >> Thanks,
> >> Matthew.
> >>
> >>
> >
> > Russ Rew                                         UCAR Unidata Program
> > address@hidden                     http://www.unidata.ucar.edu
> >
> >
> >
> > Ticket Details
> > ===================
> > Ticket ID: ORV-791255
> > Department: Support netCDF
> > Priority: Normal
> > Status: Closed
> >
> >
> 
> 

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



Ticket Details
===================
Ticket ID: ORV-791255
Department: Support netCDF
Priority: Normal
Status: Closed