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:
error is: 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. 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/ -I/cvmfs/ -I/cvmfs/ -I/cvmfs/ -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/ -L/cvmfs/ -L/lib64 -L/cvmfs/ -L/cvmfs/ -L/cvmfs/ -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

/cvmfs/ warning:, needed by /cvmfs/, may conflict with

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.


Well, I have solved this problem with a kludge. I created a python script,, 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!