set up CPATH and LIBRARY_PATH in generic.ini

Create issue
Issue #2306 resolved
Roland Haas created an issue

The Cactus tools for ExternalLibraries strip (what is assumed to be) system directories from the search path for includes and linker libraries so that is a eg HDF5 is found in /usr no -L/usr is added which might eg conflict if one needs to use a FFTW other than the system one installed in /usr.

This is mostly an issue on clusters where a system wide library is provided by the OS (eg HDF5) but we need to build our own or use one provided by modules b/c the system one is too old. At the same time we may need eg pthreads which is always provided by the system (cannot be built from source).

On laptops this is typically less of an issue but can still happen.

For these reasons some libraries are stripped from the LIBDIRS reported by ExternalLibraries' script under the assumption that they are system paths and the compiler will look there even when they are not mentioned.

Unfortunately this is not true for HomeBrew’s gcc compiler which does not look into /usr/local/{lib,include} even though HomeBrew itself installs software there.

Right now this requires an osx-homebrew.cfg file which sets up Cactus options

# 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

which however adds /usr/local/lib to the front of the search path rather than the end. A way to add to the end for the gcc compiler (nothing else matters for generic.ini) is to set CPATH and LIBRARY_PATH environment variables:

export LIBRARY_PATH="${LIBRARY_PATH+$LIBRARY_PATH:}/usr/local/lib64:/usr/local/lib:/usr/lib64:/usr/lib:/lib64:/lib"
export CPATH="${CPATH+$CPATH:}/usr/local/include:/usr/include:/include"

which however needs to be done in envsetup.

Pull request:

does just that.

Comments (2)

  1. Log in to comment