peterkuma / ccplot

Command-line application for visualizing data from CloudSat and CALIPSO satellites
http://ccplot.org
Other
35 stars 7 forks source link

setup.py does not contain an exhaustive list of hdfeos include directories #1

Closed Syntaf closed 9 years ago

Syntaf commented 9 years ago

A little while back on the mailing list you guys received this question relating to an error where HdfEosDef.h was unable to be found inside the file hdfeos.c. I'm now experiencing the same error as that previous question and found a solution to the problem, but am unsure if this is a cross-kernal solution or specific to 14.04 LTS.

Specifically the error generated is:

running build
running build_py
creating build
creating build/lib.linux-x86_64-2.7
creating build/lib.linux-x86_64-2.7/ccplot
copying ccplot/utils.py -> build/lib.linux-x86_64-2.7/ccplot
copying ccplot/__init__.py -> build/lib.linux-x86_64-2.7/ccplot
copying ccplot/config.py -> build/lib.linux-x86_64-2.7/ccplot
running build_ext
building 'ccplot.cctk' extension
creating build/temp.linux-x86_64-2.7
creating build/temp.linux-x86_64-2.7/ccplot
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv 
-O2 -Wall -Wstrict-prototypes -fPIC 
-I/usr/lib/python2.7/dist-packages/numpy/core/include 
-I/usr/include/python2.7 -c ccplot/cctk.c -o 
build/temp.linux-x86_64-2.7/ccplot/cctk.o
In file included from 
/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/ndarraytypes.h:1761:0,
                  from 
/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/ndarrayobject.h:17,
                  from 
/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/arrayobject.h:4,
                  from ccplot/cctk.c:31:
/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:15:2: 
warning: #warning "Using deprecated NumPy API, disable it by " 
"#defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
  #warning "Using deprecated NumPy API, disable it by " \
   ^
x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions 
-Wl,-Bsymbolic-functions -Wl,-z,relro -fno-strict-aliasing -DNDEBUG -g 
-fwrapv -O2 -Wall -Wstrict-prototypes -D_FORTIFY_SOURCE=2 -g 
-fstack-protector --param=ssp-buffer-size=4 -Wformat 
-Werror=format-security build/temp.linux-x86_64-2.7/ccplot/cctk.o -o 
build/lib.linux-x86_64-2.7/ccplot/cctk.so
cythoning ccplot/hdf.pyx to ccplot/hdf.c
building 'ccplot.hdf' extension
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv 
-O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/hdf 
-I/usr/local/include/hdf -I/opt/local/include 
-I/usr/lib/python2.7/dist-packages/numpy/core/include 
-I/usr/include/python2.7 -c ccplot/hdf.c -o 
build/temp.linux-x86_64-2.7/ccplot/hdf.o
In file included from 
/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/ndarraytypes.h:1761:0,
                  from 
/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/ndarrayobject.h:17,
                  from 
/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/arrayobject.h:4,
                  from ccplot/hdf.c:352:
/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:15:2: 
warning: #warning "Using deprecated NumPy API, disable it by " 
"#defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
  #warning "Using deprecated NumPy API, disable it by " \
   ^
In file included from ccplot/hdf.c:356:0:
/usr/include/hdf/mfhdf.h:237:5: warning: function declaration isn’t a 
prototype [-Wstrict-prototypes]
      ();
      ^
In file included from 
/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/ndarrayobject.h:26:0,
                  from 
/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/arrayobject.h:4,
                  from ccplot/hdf.c:352:
/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/__multiarray_api.h:1629:1: 
warning: ‘_import_array’ defined but not used [-Wunused-function]
  _import_array(void)
  ^
In file included from 
/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/ufuncobject.h:327:0,
                  from ccplot/hdf.c:353:
/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/__ufunc_api.h:241:1: 
warning: ‘_import_umath’ defined but not used [-Wunused-function]
  _import_umath(void)
  ^
ccplot/hdf.c: In function ‘__pyx_pf_6ccplot_3hdf_3HDF_22_getinfo.isra.31’:
ccplot/hdf.c:7453:6: warning: ‘__pyx_v_res’ may be used uninitialized in 
this function [-Wmaybe-uninitialized]
    if (__pyx_t_15) {
       ^
x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions 
-Wl,-Bsymbolic-functions -Wl,-z,relro -fno-strict-aliasing -DNDEBUG -g 
-fwrapv -O2 -Wall -Wstrict-prototypes -D_FORTIFY_SOURCE=2 -g 
-fstack-protector --param=ssp-buffer-size=4 -Wformat 
-Werror=format-security build/temp.linux-x86_64-2.7/ccplot/hdf.o 
-L/opt/local/lib -lmfhdf -ldf -ljpeg -lz -o 
build/lib.linux-x86_64-2.7/ccplot/hdf.so
cythoning ccplot/hdfeos.pyx to ccplot/hdfeos.c
building 'ccplot.hdfeos' extension
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv 
-O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/hdf 
-I/usr/local/include/hdf -I/opt/local/include 
-I/usr/lib/python2.7/dist-packages/numpy/core/include 
-I/usr/include/python2.7 -c ccplot/hdfeos.c -o 
build/temp.linux-x86_64-2.7/ccplot/hdfeos.o
In file included from 
/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/ndarraytypes.h:1761:0,
                  from 
/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/ndarrayobject.h:17,
                  from 
/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/arrayobject.h:4,
                  from ccplot/hdfeos.c:352:
/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:15:2: 
warning: #warning "Using deprecated NumPy API, disable it by " 
"#defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
  #warning "Using deprecated NumPy API, disable it by " \
   ^
ccplot/hdfeos.c:357:23: fatal error: HdfEosDef.h: No such file or directory
  #include "HdfEosDef.h"
                        ^
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

Now If you peek inside hdfeos.c you see starting on line 349:

#define __PYX_HAVE__ccplot__hdfeos
#define __PYX_HAVE_API__ccplot__hdfeos
#include "string.h"
#include "stdio.h"
#include "stdlib.h"
#include "numpy/arrayobject.h"
#include "numpy/ufuncobject.h"
#include "errno.h"
#include "hntdefs.h"
#include "hdf.h"
#include "HdfEosDef.h"

which means HdfEosDef.h is properly included, so the issue lies in the include directories located in setup.py , which on line 24 reads

 hdf_include_dirs = ['/usr/include/hdf', '/usr/local/include/hdf' , '/opt/local/include']

but this line is a problem because it's not exhaustive . When I installed hdfeos with sudo apt-get install libhdf4-dev libhdfeos-dev and checked where they were installed with dpkg -L libhdfeos-dev I saw

/.
/usr
/usr/include
/usr/include/x86_64-linux-gnu
/usr/include/x86_64-linux-gnu/hdf
/usr/include/x86_64-linux-gnu/hdf/HDFEOSVersion.h
/usr/include/x86_64-linux-gnu/hdf/HdfEosDef.h
/usr/include/x86_64-linux-gnu/hdf/ease.h
/usr/include/x86_64-linux-gnu/hdf/cfortHdf.h
/usr/include/x86_64-linux-gnu/hdf/HE2_config.h
/usr/lib
/usr/lib/x86_64-linux-gnu
/usr/lib/x86_64-linux-gnu/pkgconfig
/usr/lib/x86_64-linux-gnu/pkgconfig/hdf-eos4.pc
/usr/lib/x86_64-linux-gnu/libhdfeos.a
/usr/share
/usr/share/doc

changing line 24 in setup.py to

hdf_include_dirs = ['/usr/include/x86_64-linux-gnu/hdf', '/usr/include/hdf', '/usr/local/include/hdf',
                               '/opt/local/include']

fixed my error and ccplot built correctly!

The reason I made this an issue and not a pull request is because I'm not sure if this is only a specific problem with 14.04, where hdfeos is installed under a different path than what setup.py currently contains. Can anyone on a system < 14.04 install the hdfeos libraries and check their install directory to ensure this is either a problem dependent to 14.04 or if this is a new issue that encompasses all of linux?

peterkuma commented 9 years ago

Hi Grant, sorry for the huge delay in my answer. The path where hdf header files are installed has changed with the new release of Ubuntu/Debian, and /usr/include/x86_64-linux-gnu/hdf is now the correct path. Thank you for the detailed description of the problem. The issue is fixed in ccplot 1.5.1 (by adding the new path to the list as you suggested).