Search code examples
mpihdf5openmpi

Can't find files which exist (hdf5,h, mpi.h, fftw3.h, libGLU.so.1) - needed for Athena++ and Visit


Relatively new to Linux and trying to work with a program (Athena++ - https://github.com/PrincetonUniversity/athena-public-version/wiki - , a magnetohydrodynamics code) for my studies.

I've followed the tutorial there and can run simpler simulations, but for anything which requires mpi or hdf5, I'm running into an issue where it says fatal error: hdf5.h: No such file or directory

[sferrel6@phys44222 athena]$ make
g++  -O3 -std=c++11 -c src/main.cpp -o obj/main.o
In file included from src/main.cpp:43:0:
src/outputs/outputs.hpp:22:18: fatal error: hdf5.h: No such file or directory
 #include <hdf5.h>
                  ^
compilation terminated.
make: *** [obj/main.o] Error 1

Similarly I get the same issue for mpi.h, fftw3.h and (when trying to use Visit) libGlu.so.1

These files certainly exist, though I can't figure out how to get my program to see them.

$ find -iname "hdf5.h"
~/local/anaconda2/pkgs/hdf5-1.10.4-nompi_h3c11f04_1106/include/hdf5.h
~/local/anaconda2/pkgs/hdf5-1.10.4-hb1b8bf9_0/include/hdf5.h
~/local/anaconda2/include/hdf5.h
$ find -iname "mpi.h"
~/local/anaconda2/pkgs/openmpi-4.0.1-hc99cbb1_2/include/mpi.h
~/local/anaconda2/include/mpi.h
find -iname "libGLU.so.1"
~/local/anaconda2/lib/libGLU.so.1
~/local/anaconda2/pkgs/libglu-9.0.0-hf484d3e_1/lib/libGLU.so.1

I've tried updating my path in .bash_profile (I'm on RHEL7) to include these paths, but to no avail - still the same error. I've also tried to use export CPATH='~/local/anaconda2/include' but that has not helped.

Please note that I'm working on a university machine, which means I can't use sudo (why everything is through anaconda). Also, it means my directory structure is a bit unorthodox.

~ is nethome/myname and has very limited space so all of my work is at /localdata/myname which is reached via symbolic link at ~/local

I've also tried copying those specific files into my Athena directory (~/local/athena, where I'm running my athena Makefile from) in the hopes that it would then be able to find them and I could better diagnose the issue. No luck there either.


Solution

  • Was able to solve this problem by testing compiler search path with cpp -v which determined that my search paths weren't looking where I was able to find those various .h files. I updated this by using

    export CPATH='/nethome/myname/local/anaconda2/include:/nethome/myname/local/anaconda2/lib'
    

    I'm sure there's a better way to do this (since I've seen cautions against using CPATH in my various googling), but if you happen upon this question, it's at least the method that I found to work for me.