hdf5r icon indicating copy to clipboard operation
hdf5r copied to clipboard

hdf5.h present but cannot be compiled

Open jonathangriffiths opened this issue 6 years ago • 7 comments

Hi there,

I've been trying to install hdf5r into a singularity image, but I am getting some unexpected error messages:

checking for h5cc... /miniconda/bin/h5cc
checking for HDF5 libraries... yes (version 1.10.4)
checking hdf5.h usability... no
checking hdf5.h presence... yes
configure: WARNING: hdf5.h: present but cannot be compiled
configure: WARNING: hdf5.h:     check for missing prerequisite headers?
configure: WARNING: hdf5.h: see the Autoconf documentation
configure: WARNING: hdf5.h:     section "Present But Cannot Be Compiled"
configure: WARNING: hdf5.h: proceeding with the compiler's result
configure: WARNING:     ## -------------------------------- ##
configure: WARNING:     ## Report this to [email protected] ##
configure: WARNING:     ## -------------------------------- ##
checking for hdf5.h... no
checking for H5Fcreate in -lhdf5... no
configure: WARNING: Unable to compile HDF5 test program
checking for hdf5_hl.h... no
checking for H5LTpath_valid in -lhdf5_hl... no
configure: WARNING: Unable to compile HDF5_HL test program
checking for main in -lhdf5_hl... no
checking for matching HDF5 Fortran wrapper... /miniconda/bin/h5fc
Found hdf5 with version: 1.10.4

This follows from other parts of the singularity recipe like apt-get -y install libhdf5-dev libhdf5-cpp-100 libhdf5-100, and I seem to have narrowed this error down to an interaction with something else I have installed into the image, probably the python package h5py (as hdf5r installs happily in another otherwise identical image where no python was installed).

Would you like me to send you the singularity image (which is unfortunately quite large at 12GB, as I have made it with the --writable flag), or is this an already known issue?

Cheers, Jonny

jonathangriffiths avatar Jan 04 '19 15:01 jonathangriffiths

According to your first line, the problem seems to be the miniconda hdf5 version:

checking for h5cc... /miniconda/bin/h5cc

Try to link to libhdf5-dev directly.

mannau avatar Jan 14 '19 16:01 mannau

Indeed, I have resolved this by installing hdf5r before the miniconda HDF5 package.

I've left the issue open as it seems to me that a general incompatibility between the presence of the miniconda one and the installation of hdf5r seems like something that could crop up again. Do close the issue if you're happy, though!

jonathangriffiths avatar Jan 14 '19 16:01 jonathangriffiths

Well, we should maybe state it in the readme since the issue seems to be quite common.

mannau avatar Jan 14 '19 16:01 mannau

The only fix I got was to remove the conda path in total. Honestly anaconda might be great for Python people, but it breaks almost every other language I have coded with. I really dislike Python more and more.

Seams to be a good reason why Ubuntu has no Anacoda package available ;-)

stela2502 avatar Mar 26 '19 16:03 stela2502

The only fix I got was to remove the conda path in total.

Good call here, I just had the same problem on my Mac and this was the fix: the anaconda h5cc seems to be a bit messed up.

jonathangriffiths avatar Apr 15 '19 11:04 jonathangriffiths

Indeed, I have resolved this by installing hdf5r before the miniconda HDF5 package.

I've left the issue open as it seems to me that a general incompatibility between the presence of the miniconda one and the installation of hdf5r seems like something that could crop up again. Do close the issue if you're happy, though!

Hi! It seems I have the same problem, though I don't really understand. Could someone help me, please? What do I need to do first? Remove the version in my Conda environment and then try to install it again?

I would pretty much appreciate any help. Thanks!

VicenteFR avatar Oct 04 '19 22:10 VicenteFR

@jonathangriffiths @VicenteFR The problem here is that attempting to build R packages from source doesn't play well in general with having a conda environment active. In this case it's the h5cc settings, but in other cases it can be issues related to gcc, etc.

What I do on my machines to avoid this is to restrict the PATH specifically in R by setting this value in ~/.Renviron or R_HOME /etc/Renviron.site (if you have admin access for a shared install):

PATH="/usr/local/bin:/usr/bin:/bin"

Give that a shot and see if it helps resolve your compilation issues.

Note that if you're on macOS, you need to compile using the recommended versions of Clang and GNU Fortran available from the CRAN macOS tools page. Many people using Macs skip this step and it leads to issues down the road.

Best, Mike

mjsteinbaugh avatar Oct 05 '19 12:10 mjsteinbaugh