How to install Dolphin 2019 from Git sources in Arch-based systems?

Hello,

In short: I am unable to build Dolfin 2019 (not Dolfinx) from Git sources, and I am going nuts >.0 (that’s my eye twitching).

In a more detailed fashion:

I am able to install FFC, FIAT, UFL and Dijitso by means of the PKGBUILD’s which are in the AUR. I can even produce my own packages to install them from the Git sources. In fact, I was able to build Dolfin, with a PKGBUILD based on a tar ball, but that gives me an error:

>>> import dolfin
Traceback (most recent call last):
  File "<stdin>", line 5, in <module>
  File "<stdin>", line 3, in main
  File "/usr/lib/python3.9/site-packages/dolfin/__init__.py", line 34, in <module>
    from .cpp import __version__
ImportError: /usr/lib/python3.9/site-packages/dolfin/cpp.cpython-39-x86_64-linux-gnu.so: undefined symbol: petsc_allreduce_ct

Installing with tar-balls was my second option. Installing with Conda is out of the question.

Ancillary question: I have noticed that the files and directory structure from the tar-ball and from the Git sources are very different. I am wondering how the tar-ball structure is generated.

I am getting this error with the Git sources:

CMake Error at demo/CMakeLists.txt:10 (add_subdirectory):
  The source directory

   /fenics/dolfin/src/dolfin/cpp/demo/poisson

  does not contain a CMakeLists.txt file.


CMake Error at demo/CMakeLists.txt:14 (add_subdirectory):
  The source directory

    /fenics/dolfin/src/dolfin/cpp/demo/hyperelasticity

  does not contain a CMakeLists.txt file.

I found a generate-cmakefiles.py. This file indicates that it «should be run from the top level directory», but it does nothing there, so I ran it in the cpp directory, and did generate some files. I did the same with generate-form-files.py.

After doing that, I get:

error: invalid use of incomplete type 'const struct ufc_dofmap'
  471 |   std::copy(dofmap.num_entity_dofs, dofmap.num_entity_dofs + 4,
      |             ^~~~~~
In file included from /fenics/dolfin/src/dolfin/cpp/dolfin/fem/utils.cpp:7:
/fenics/dolfin/src/dolfin/cpp/dolfin/fem/utils.h:18:8: note: forward declaration of 'struct ufc_dofmap'
   18 | struct ufc_dofmap;
      |        ^~~~~~~~~~
/fenics/dolfin/src/dolfin/cpp/dolfin/fem/utils.cpp:512:51: error: invalid use of incomplete type 'using element_type = struct ufc_dofmap' {aka 'struct ufc_dofmap'}
  512 |     std::vector<int> parent_map_sub(ufc_sub_dofmap->num_element_support_dofs);
      |                                                   ^~
In file included from /fenics/dolfin/src/dolfin/cpp/dolfin/fem/utils.cpp:7:
/fenics/dolfin/src/dolfin/cpp/dolfin/fem/utils.h:18:8: note: forward declaration of 'using element_type = struct ufc_dofmap' {aka 'struct ufc_dofmap'}
   18 | struct ufc_dofmap;
      |        ^~~~~~~~~~
/fenics/dolfin/src/dolfin/cpp/dolfin/fem/utils.cpp: In function 'std::vector<std::tuple<int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::shared_ptr<dolfin::function::Function> > > dolfin::fem::get_coeffs_from_ufc_form(const ufc_form&)':
/fenics/dolfin/src/dolfin/cpp/dolfin/fem/utils.cpp:540:24: error: invalid use of incomplete type 'const struct ufc_form'
  540 |   const char** names = ufc_form.coefficient_name_map();
      |                        ^~~~~~~~

--- MANY MORE ---
      
In file included from /fenics/dolfin/src/dolfin/cpp/dolfin/fem/FiniteElement.cpp:7:
/fenics/dolfin/src/dolfin/cpp/dolfin/fem/FiniteElement.h:18:8: note: forward declaration of 'struct ufc_finite_element'
   18 | struct ufc_finite_element;
      |        ^~~~~~~~~~~~~~~~~~
/fenics/dolfin/src/dolfin/cpp/dolfin/fem/FiniteElement.cpp:72:43: error: invalid use of incomplete type 'const struct ufc_finite_element'
   72 |     ufc_finite_element* ufc_sub_element = ufc_element.create_sub_element(i);
      |                                           ^~~~~~~~~~~
In file included from /fenics/dolfin/src/dolfin/cpp/dolfin/fem/FiniteElement.cpp:7:
/fenics/dolfin/src/dolfin/cpp/dolfin/fem/FiniteElement.h:18:8: note: forward declaration of 'struct ufc_finite_element'
   18 | struct ufc_finite_element;
      |        ^~~~~~~~~~~~~~~~~~
make[2]: *** [dolfin/CMakeFiles/dolfin.dir/build.make:412: dolfin/CMakeFiles/dolfin.dir/fem/FiniteElement.cpp.o] Error

So, I have tried with all these:

  # # This is one before ufc::finite_element is removed in dolfin
  # git checkout $(git rev-list -1 --before=2018-04-09 main)

  # This is the date for fenics release 2019.1.0
  # git checkout $(git rev-list -1 --before=2019-04-17 main)
  # git checkout d814cf46f1
  # git checkout 9f032e0928
  # git checkout b43927ed50
  # git checkout $(git rev-list -1 --before=2019-04-19 main)

  # git checkout $(git rev-list -1 --before=2019-04-26 main)
  # echo "cmake_minimum_required(VERSION 3.9)" > cpp/demo/CMakeLists.txt
  # echo "project(dolfin-demos)" >> cpp/demo/CMakeLists.txt

  # According to log, one before the syntax changes to dolfinx
  git checkout ac728aa2ef

If you want, you can check these: broncodev/fenics-pkgbuild-group - NotABug.org: Free code hosting

I tried to follow this: Installation — FEniCS Project documentation, but I downloaded the source tar-balls from pypi (or the git repo), instead of doing a pip install (the details are on the repository that I just provided). By the way, the links to the specific installations of DOLFIN and mshr are dead.