Skip to content

PyHDF Incompatible with libhdf4-dev v4.3.0 #81

@medley56

Description

@medley56

Summary

Debian Trixie just released and includes an updated point release of libhdf4-dev (v4.3.0). PyHDF fails to build from source against these new headers. If I pin my environment to Debian Bookworm, which is limited to libhdf4-dev v4.2.15, the install succeeds.

Even when manually installing the old libhdf4-dev library on Trixie, it doesn't replace the new headers and pyhdf tries to compile against them.

Also, a note that libgdal-dev has dependencies on libhdf4-dev so there is good reason to make sure pyhdf supports all current versions of libhdf4. You don't want to limit users to only specific versions of libgdal by extension.

Suggestion

Ideally, support compilation against libhdf4-dev v4.3.0.

At least there should be a note somewhere that pyhdf requires an older version of the HDF4 C library.

Install Log (pip install pyhdf) Excerpt:

gcc -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O3 -Wall -fPIC -I/tmp/pip-build-env-3ylpa_fp/overlay/lib/python3.12/site-packages/numpy/_core/include -I/usr/include/hdf/ -I/opt/venv/include -I/usr/local/include/python3.12 -c pyhdf/hdfext_wrap.c -o build/temp.linux-aarch64-cpython-312/pyhdf/hdfext_wrap.o -DNOSZIP
      pyhdf/hdfext_wrap.c: In function ‘_SDgetcompress’:
      pyhdf/hdfext_wrap.c:4119:36: error: passing argument 2 of ‘SDgetcompress’ from incompatible pointer type [-Wincompatible-pointer-types]
       4119 |     status = SDgetcompress(sds_id, comp_type, &c_info);
            |                                    ^~~~~~~~~
            |                                    |
            |                                    int32 * {aka int *}
      In file included from pyhdf/hdfext_wrap.c:3678:
      /usr/include/hdf/mfhdf.h:143:54: note: expected ‘comp_coder_t *’ but argument is of type ‘int32 *’ {aka ‘int *’}
        143 | HDFLIBAPI intn SDgetcompress(int32 id, comp_coder_t *type, comp_info *c_info);
            |                                        ~~~~~~~~~~~~~~^~~~
      pyhdf/hdfext_wrap.c: In function ‘_wrap_SDcreate’:
      pyhdf/hdfext_wrap.c:6049:62: warning: passing argument 5 of ‘SDcreate’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
       6049 |   result = (int32)SDcreate(arg1,(char const *)arg2,arg3,arg4,(int const *)arg5);
            |                                                              ^~~~~~~~~~~~~~~~~
      /usr/include/hdf/mfhdf.h:90:84: note: expected ‘int32 *’ {aka ‘int *’} but argument is of type ‘const int *’
         90 | HDFLIBAPI int32 SDcreate(int32 fid, const char *name, int32 nt, int32 rank, int32 *dimsizes);
            |                                                                             ~~~~~~~^~~~~~~~
      pyhdf/hdfext_wrap.c: In function ‘_wrap_SDsetdimscale’:
      pyhdf/hdfext_wrap.c:6591:48: warning: passing argument 4 of ‘SDsetdimscale’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
       6591 |   result = (int32)SDsetdimscale(arg1,arg2,arg3,(void const *)arg4);
            |                                                ^~~~~~~~~~~~~~~~~~
      /usr/include/hdf/mfhdf.h:124:69: note: expected ‘void *’ but argument is of type ‘const void *’
        124 | HDFLIBAPI intn SDsetdimscale(int32 id, int32 count, int32 nt, void *data);
            |                                                               ~~~~~~^~~~
      pyhdf/hdfext_wrap.c: In function ‘_wrap_SDsetfillvalue’:
      pyhdf/hdfext_wrap.c:7241:39: warning: passing argument 2 of ‘SDsetfillvalue’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
       7241 |   result = (int32)SDsetfillvalue(arg1,(void const *)arg2);
            |                                       ^~~~~~~~~~~~~~~~~~
      /usr/include/hdf/mfhdf.h:112:50: note: expected ‘void *’ but argument is of type ‘const void *’
        112 | HDFLIBAPI intn SDsetfillvalue(int32 sdsid, void *val);
            |                                            ~~~~~~^~~
      pyhdf/hdfext_wrap.c: In function ‘_wrap_SDsetrange’:
      pyhdf/hdfext_wrap.c:7275:35: warning: passing argument 2 of ‘SDsetrange’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
       7275 |   result = (int32)SDsetrange(arg1,(void const *)arg2,(void const *)arg3);
            |                                   ^~~~~~~~~~~~~~~~~~
      /usr/include/hdf/mfhdf.h:98:46: note: expected ‘void *’ but argument is of type ‘const void *’
         98 | HDFLIBAPI intn SDsetrange(int32 sdsid, void *pmax, void *pmin);
            |                                        ~~~~~~^~~~
      pyhdf/hdfext_wrap.c:7275:54: warning: passing argument 3 of ‘SDsetrange’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
       7275 |   result = (int32)SDsetrange(arg1,(void const *)arg2,(void const *)arg3);
            |                                                      ^~~~~~~~~~~~~~~~~~
      /usr/include/hdf/mfhdf.h:98:58: note: expected ‘void *’ but argument is of type ‘const void *’
         98 | HDFLIBAPI intn SDsetrange(int32 sdsid, void *pmax, void *pmin);
            |                                                    ~~~~~~^~~~
      pyhdf/hdfext_wrap.c: In function ‘_wrap_VSsizeof’:
      pyhdf/hdfext_wrap.c:8160:32: warning: passing argument 2 of ‘VSsizeof’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
       8160 |   result = (intn)VSsizeof(arg1,(char const *)arg2);
            |                                ^~~~~~~~~~~~~~~~~~
      In file included from /usr/include/hdf/hdf.h:186,
                       from pyhdf/hdfext_wrap.c:3677:
      /usr/include/hdf/hproto.h:1300:44: note: expected ‘char *’ but argument is of type ‘const char *’
       1300 | HDFLIBAPI int32 VSsizeof(int32 vkey, char *fields);
            |                                      ~~~~~~^~~~~~
      pyhdf/hdfext_wrap.c: In function ‘_wrap_VSfexist’:
      pyhdf/hdfext_wrap.c:8604:32: warning: passing argument 2 of ‘VSfexist’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
       8604 |   result = (intn)VSfexist(arg1,(char const *)arg2);
            |                                ^~~~~~~~~~~~~~~~~~
      /usr/include/hdf/hproto.h:1298:43: note: expected ‘char *’ but argument is of type ‘const char *’
       1298 | HDFLIBAPI intn VSfexist(int32 vkey, char *fields);
            |                                     ~~~~~~^~~~~~
      error: command '/usr/bin/gcc' failed with exit code 1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions