Cannot point to PETSc source installation while building dolfinx

Hi,

I am trying to install dolfinx v0.4.1 on a Ubuntu 20.04 machine. The PETSc that comes with apt-get is <3.15 and hence does not satisfy the requirements of dolfinx. I have a source installation of PETSc v3.17.4 on my machine to which I want to point CMake to, so that I can satisfy the version requirement. How can I do this? I tried to include the include/ directory from the source installation in the CMAKE_INCLUDE_PATH but this did not help. CMake still complains that PETSc is <3.15

Are you sure your $PETSC_DIR is set correctly?

Are you sure you need your own build? The PPA already provides a build of dolfinx 0.4.1 for ubuntu focal.

If you do need your own build, you could save time by using the source packages used for the prebuilt packages

apt-get source fenics-dolfinx
cd fenics-dolfinx-0.4.1
dpkg-buildpackage

Thanks for the comment and also the question from @nate .

Setting $PETSC_DIR did not work, and it wasnt really clear why. In the end I realized that installing everything from source on Ubuntu 20.04 is quite cumbersome, especially as C++20 is a requirement, so I took this as an excuse and upgraded to Ubuntu 22.04 and then installing fenicsx along with all dependencies via apt-get worked perfectly! Thank you for your help!