- changed status to open
ExternalLibraries/HDF5 fails to correctly set up include paths when auto-detecting library
The current HDF5 ExternalLibaries detect.sh script does not correctly set HDF5_INC_PATH
and HDF5_LIB_PATH
on OSX Mojave using Hombrew and gcc-8.
This is the result of multiple issues:
- Homebrew does not provide a pkg-config file for HDF5: https://github.com/Homebrew/homebrew-core/issues/28826
- gcc-8 from Homebrew on Mojave does not by default look in /usr/local/include for include files (see the output of
gcc-8 -xc -E -v /dev/null
), https://github.com/Homebrew/homebrew-core/issues/35181 - we hard-code the list of "system" include paths (and library paths) in
Cactus/lib/sbin/strip-incdirs.sh
This is an issue when using generic.cfg
only, the (hand-crafted) osx-homebrew.cfg
works around this issue like so:
# We need to explicitly set HDF5_INC_DIRS and HDF5_LIB_DIRS explicitly
# to prevent the configure scripts from stripping them. We also then
# need to set HDF5_LIBS manually.
HDF5_DIR = /usr/local
HDF5_INC_DIRS = /usr/local/include
HDF5_LIB_DIRS = /usr/local/lib
HDF5_LIBS = hdf5hl_fortran hdf5_fortran hdf5_hl hdf5
indicating that the issue existed before.
MacPorts is not affected b/c it stores its include files in /opt/local which is not stripped out.
Comments (22)
-
reporter -
reporter Looking at the code and the Homebrew cfg file it seems that the actual work around in the cfg file is:
# the configure scripts strip /usr/local from XXX_DIR to avoid chosing system # libraries, however OSX does not search in /usr/local by default, so # we add it by hand. LIBDIRS = /usr/local/lib SYS_INC_DIRS = /usr/local/include
-
Does homebrew not set up pkg-config? Is pkg-config absent? I found that if a pkg-config command is not in the path, HDF5 counts that as a failure to find something in the pkg-config path.
I'm thinking that it might be useful to have simfactory (or maybe even the Makefile) stop and print out an error message if pkg-config, which, xargs, or hostname are not present, or if USER or HOME are not set. All these sorts of things can cause problems.
-
reporter Homebrew (at least if asked to do so) does install pkg-config, however unfortunately Homebrew does not provide a pkg-confg file for HDF5. pkg-config is in the path, there just is no
hdf5.pc
file.That is what the linked in ticket in my point "1." is about. Homebrew does not provide a pkgconfig file because HDF5 itself does only provide one when compiled using cmake it seem, and it seems homebrew does not use cmake.
Note that this issue is not actually new but already existed in (at least) the previous (two) release(s) since I have fixes for it in the
osx-homebrew.cfg
file. The reason this has come up again is trying to switch OSX and Linux to both use generic.cfg or at least work without having to specify an optionlist or special machine ini file tosetup-silent
.Note further that due to the way we filter out paths we think the compiler looks for even if no
-L
or-I
is given, even having a pkg-config file would not help, since we would still filter out the "-I/usr/local/include" that is required on a Mac b/c gcc (Homebrew or MacPorts, and also the clang-gcc-wrapper) does not look in /usr/local/include (that is what my point 2. is about). -
reporter I am trying to come up with a better way to handle this is in the branch rhaas/strip-dirs of the flesh but the changes are bit too invasive to put them in just before the release and there will be use visible changes, though I believe the changes are towards the "fewer surprises" direction which I would think are acceptable.
-
I'm wondering if we want an option to the build system (maybe some environment variable) to disable the automatic building of packages if something isn't found, i.e. HDF5, lapack, etc. It's really annoying to find the build system compiling HDF5 when I think I've set things up so it won't.
-
reporter There already is such an option: setting HDF5_DIR = NO_BUILD will not let it build HDF5 and will instead fail.
-
No, I mean a global option CCTK_DONT_BUILD_ANYTHING=yes or something. And I wouldn't want to have to put it in a cfg file.
-
-
assigned issue to
-
assigned issue to
-
-
assigned issue to
-
assigned issue to
-
-
assigned issue to
-
assigned issue to
-
-
assigned issue to
-
assigned issue to
-
-
assigned issue to
-
assigned issue to
-
-
assigned issue to
-
assigned issue to
-
-
assigned issue to
-
assigned issue to
-
-
assigned issue to
-
assigned issue to
-
-
assigned issue to
-
assigned issue to
-
-
assigned issue to
-
assigned issue to
-
reporter - edited description
-
reporter Note, in response to https://bitbucket.org/einsteintoolkit/tickets/issues/2235/externallibraries-hdf5-fails-to-correctly#comment-51201211, that the issue does not only occur when one would build HDF5 using ExternalLibraries (in fact if one was to build it within the ExternalLibrary then the issue would not show up, it only shows up when using the HomeBrew provided libhdf5).
-
reporter I would like to add the fragment from osx-homebrew.cfg that actually helped
# some compilers do not search in /usr/local/lib and /usr/local/include # by default, but some package managers install there LIBDIRS = /usr/local/lib SYS_INC_DIRS = /usr/local/include
-
reporter - changed status to resolved
Resolved (at least when using simfactory) as a consquense of git hash f27be14 "generic: force directories we will strip into search paths" of simfactory2.
Will still show up on Homebrew when using a build method independent of simfactory. A more complete fix would have to determine which directories are actually considered "system" directories by the compiler.
- Log in to comment