Building hdf4 on Archlinux docker container produces a configure error

I tried building HDF 4.2.10, HDF 4.2.12, and HDF 4.2.14 in the latest tagged docker image of Archlinux, but I always get a configure error:

configure: error: --enable-hdf4-xdr is not supported for 64 bit mode.

I installed a couple of things (e.g. gcc & make etc.) before using the recommended configure instructions:

./configure --prefix=$pck_dir --with-szlib=$szip_dir --disable-netcdf

By default the --enable-hdf4-xdr is set to no. However, it seems that in this container (I haven’t tried others) the configure script is buggy in that the variable set by argument (BUILD_XDR) is always set to yes, regardless. There appears to be two sets of logic handling this argument, the first responds to whether the argument is given, and seems to handle it fine, but the second seems to set BUILD_XDR to yes regardless. I’m not too sure what it is checking in order to do this. I got around this problem by patching the script after the second piece of logic to always set BUILD_XDR to no.

This problem does not happen when I build using the same instructions outside the container.

I’ve experienced a similar issue trying to build HDF 4.2.14 on RHEL8, after building with same config options on RHEL7. I was able to track down a bit more on my issue, which I am sharing here in case you are experiencing similar issues.

Apparently, configure script checks for availability of xdr.h, and if it is not found it will force the building of hdf’s XDR library (which fails for 64 bit builds). This does not seem to be a configure bug (although I think thre is a bug in which --enable-hdf4-xdr and --disable-hdf4-xdr are treated identically).

Apparently, RH7’s glibc-headers RPM included /usr/include/rpc/xdr.h, but those are omitted in the RH8 package. Instead, in RH8 this and similar headers are included in libtirpc-devel RP, and installed to /usr/include/tirpc/rpc/xdr.h. This seems to be the way many newer distros are going, and is acknowledged in the configure script (see comment
The SunRPC of the glibc has been replaced by a TI-RPC (Transport Independent RPC) library for IPv6 support) and even has a case to handle it for buidls on cygwin.

Anyway, in a similar fashion to the cygwin case, it should be sufficent to add
LIBS=-ltirpc CPPFLAGS=-I/usr/include/tirpc
to the configure command

Hi Payerle,

Please try HDF 4.2.15, which resolved xdr issues.

Thank you!