How do I tell dijitso not to use -L/lib64 when compiling?

I have just gotten fenics installed on our HPC system (see Building from source: mpi4py, petsc4py conflict ). But now, when I try to use it, I get the following error:

dijitso failed to load existing file:
/home/lavery/FENICS/cache/lib/libdijitso-dolfin_expression_ff6f80aab13b1031b3384ba23ce13e6f.so
error is:
libhdf5.so.8: cannot open shared object file: No such file or directory
RuntimeError: Unable to compile C++ code with dijitso

I sort of know what the problem is. libhdf5.so.8 is in lib64. It is not the one I want to use, which is in another directory in my LIBRARY_PATH. Checking the dijitso cache, I find the following log file:

$ cat $FENICS/cache/log/dolfin_expression_ff6f80aab13b1031b3384ba23ce13e6f.txt
c++ -Wall -shared -fPIC -std=c++11 -O3 -fno-math-errno -fno-trapping-math -ffinite-math-only -I/cvmfs/soft.computecanada.ca/easybuild/software/2017/avx2/MPI/intel2018.3/openmpi3.1/petsc/3.10.2/include -I/cvmfs/soft.computecanada.ca/easybuild/software/2017/avx2/MPI/intel2018.3/openmpi3.1/boost-mpi/1.68.0/include -I/cvmfs/soft.computecanada.ca/easybuild/software/2017/avx2/Compiler/intel2018.3/openmpi/3.1.2/include -I/cvmfs/soft.computecanada.ca/easybuild/software/2017/avx2/MPI/intel2018.3/openmpi3.1/hdf5-mpi/1.10.3/include -I/home/lavery/projects/def-bingalls/lavery/FENICS/include/eigen3 -I/home/lavery/projects/def-bingalls/lavery/FENICS/lib/python3.7/site-packages/ffc/backends/ufc -I/home/lavery/FENICS/cache/include dolfin_expression_ff6f80aab13b1031b3384ba23ce13e6f.cpp -L/cvmfs/soft.computecanada.ca/easybuild/software/2017/avx2/Compiler/intel2018.3/openmpi/3.1.2/lib -L/cvmfs/soft.computecanada.ca/easybuild/software/2017/avx2/MPI/intel2018.3/openmpi3.1/petsc/3.10.2/lib -L/lib64 -L/cvmfs/restricted.computecanada.ca/easybuild/software/2017/Core/icc/2018.3.222/lib/intel64 -L/cvmfs/soft.computecanada.ca/easybuild/software/2017/avx2/MPI/intel2018.3/openmpi3.1/hdf5-mpi/1.10.3/lib -L/cvmfs/soft.computecanada.ca/easybuild/software/2017/avx2/MPI/intel2018.3/openmpi3.1/boost-mpi/1.68.0/lib -L/home/lavery/FENICS/lib64 -L/home/lavery/FENICS/cache/lib -Wl,-rpath,/home/lavery/FENICS/cache/lib -lmpi -lmpi_cxx -lpetsc -lpthread -liomp5 -lm -ldl -lz -lhdf5 -lboost_timer-mt -ldolfin -olibdijitso-dolfin_expression_ff6f80aab13b1031b3384ba23ce13e6f.so

/cvmfs/soft.computecanada.ca/nix/store/xs99yskj0vhrf6cmn2048i870r8nzqm0-binutils-2.28/bin/ld: warning: libhdf5.so.103, needed by /cvmfs/soft.computecanada.ca/easybuild/software/2017/avx2/MPI/intel2018.3/openmpi3.1/petsc/3.10.2/lib/libpetsc.so, may conflict with libhdf5.so.8

Looking closely, you will notice the option -L/lib64 in the compile command. Is there a way to tell dijitso not to do this? I notice that ‘dijitso config’ lists a key called lib_dirs. But I can’t figure out how to set it, or what the syntax would be if I could.

Thanks.

Well, I have solved this problem with a kludge. I created a python script, cppcensor.py, in my $HOME/bin directory. This script simply goes through its arguments, deleting every occurence of ‘-L/lib64’. It then execs the actual c++ compiler (using an absolute path) with the censored argument list. I then symlinked this script to c++ in the same directory. ~/bin is in my path ahead of the actual c++ compiler, so the script takes precedence. This is ugly, but it actually solves problems I had in installing dolfin, too (Building from source: mpi4py, petsc4py conflict).

And, it seems to work!