junxiemq / netcdf4-python

Automatically exported from code.google.com/p/netcdf4-python
Other
0 stars 0 forks source link

undefined symbol: jpeg_resync_to_restart #207

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Download python-netcdf 1.0.5 or 1.0.6
2. Compile
3. From python, execute 'from netCDF4 import Dataset'

What is the expected output? What do you see instead?

I expect Dataset to be loaded. Instead, I see the error message

/home/Sourish.Basu/pythonpackages/lib64/python2.6/site-packages/netCDF4.so: 
undefined symbol: jpeg_resync_to_restart

What version of the product are you using? On what operating system?

python-netcdf 1.0.6 (1.0.5 gives the same error). Linux x86_64.

Please provide any additional information below.

Why should netcdf depend on libjpeg?

Original issue reported on code.google.com by sourish....@gmail.com on 7 Nov 2013 at 7:55

GoogleCodeExporter commented 8 years ago
Looks like your netcdf lib was built with hdf4 support (which requires linking 
the jpeg library).  

Try running 

nc-config --libs

and 

nc-config --has-hdf4

If the jpeg libs show up and has-hdf4 is 'yes', then trying setting the env var 
USE_NCCONFIG to 1 before running setup.py build.  This should link the jpeg 
libs when building the extension.

Original comment by whitaker.jeffrey@gmail.com on 7 Nov 2013 at 8:41

GoogleCodeExporter commented 8 years ago
Another possibility is to use the env var SZIP_DIR to point to the location of 
the jpeg installation, and then edit setup.py replacing

libs.append('sz')

with

libs.append('jpeg')

This will force python to link the jpeg lib when building the C extension.  If 
a shared version of the jpeg lib was linked when the netcdf lib was built, this 
should not be necessary.

Original comment by whitaker.jeffrey@gmail.com on 7 Nov 2013 at 9:01

GoogleCodeExporter commented 8 years ago
'nc-config --has-hdf4' returned 'yes', so indeed the netcdf libs were built 
with hdf4 support. However, 'nc-config --libs' returned the following libraries:

-lnetcdf -lm -lz -lmpi -lmfhdf -ldf -lhdf5_hl -lhdf5 -lsz

i.e., no jpeg. Also, I had set 'use_ncconfig=True' and the proper path to 
nc-config in setup.cfg. During build (of python-netcdf), it used that nc-config 
to find netcdf4 and hdf5 libs successfully.

I also tried adding a '-ljpeg' to the final linker line which produces 
netCDF4.so. It did not complain, but did not solve the issue either.

Original comment by sourish....@gmail.com on 7 Nov 2013 at 9:06

GoogleCodeExporter commented 8 years ago
'libs.append('jpeg')' would have the same effect as adding a '-ljpeg' to the 
linker line, no? I already tried that, and that didn't solve the problem (I 
also tried the libs.append('jpeg') in setup.py before that).

I did an nm on the netcdf library

nm /apps/netcdf/4.2-intel-12.0.4.191-mpt-2.05/lib/libnetcdf.a | grep jpeg

There were no *jpeg* symbols.

Original comment by sourish....@gmail.com on 7 Nov 2013 at 9:17

GoogleCodeExporter commented 8 years ago
There are no jpeg symbols defined in netcdf, but netcdf is using hdf4 (mfhdf) 
which is calling the jpeg lib.  Try editing nc-config and adding -ljpeg to 

libs="-lnetcdf -lm -lz -lmpi -lmfhdf -ldf -lhdf5_hl -lhdf5 -lsz"

This is really a bug in nc-config.

Then, rebuild with USE_NCCONFIG=1.

I also think this would not be happening if netcdf (and hdf) were built as a 
shared libs - the linker would then know to pull in the other libs.

Original comment by whitaker.jeffrey@gmail.com on 7 Nov 2013 at 10:14

GoogleCodeExporter commented 8 years ago
This presumes that the jpeg lib that hdf linked lives in the same place as 
mfhdf.  It may not - you may need to locate it, i.e. with

locate libjpeg

Original comment by whitaker.jeffrey@gmail.com on 7 Nov 2013 at 10:17

GoogleCodeExporter commented 8 years ago
I built custom netcdf libraries without HDF4, and that solved the problem.

Original comment by sourish....@gmail.com on 14 Nov 2013 at 5:46

GoogleCodeExporter commented 8 years ago
I've added the ability to specify the locations of the hdf4, jpeg and curl libs 
as env vars, or in setup.cfg in svn. 

Original comment by whitaker.jeffrey@gmail.com on 14 Nov 2013 at 4:33

GoogleCodeExporter commented 8 years ago

Original comment by whitaker.jeffrey@gmail.com on 26 Feb 2014 at 2:04