Install dolfin with basix in Arch from source with PKGBUILD

{you can safely skip this paragraph, it’s an apology}
I know that it says on the community page to ask questions about installation on the mailing list, but I have the suspicion that the “love” that I have for Google is reciprocal (I never got an e-mail to join the list).

I am trying to install Dolfin (my end goal is Dolfin_Warp). I created an AUR package for basix which I could install. It does not work.

This leads to an error when compiling dolfin-git (see below). How do I compile basix from source as a package for AUR? (I use an Arch-derivative). Thanks.

==== Edit 1 (30/08/2021) ====
May be I should be more specific: to install with a PKGBUILD,

  1. one needs to specify a temporary installation path
  2. which is later compressed into an actual package.
    This path is independent of the building path and
  3. part of it is stripped from file names during compression (e.g. /my/pkg/usr/ becomes /usr).

If you look at the link which I provide above, you will find that I do:

  _realname=basix
  cmake -DCMAKE_BUILD_TYPE="Release" \
        -B "${srcdir}"/build \
        -S "${srcdir}"/"${_realname}" \
        -DCMAKE_INSTALL_PREFIX=/usr \
        -DCMAKE_PREFIX_PATH="${srcdir}"/build \
        -DXTENSOR_OPTIMIZE=TRUE \
        -Dxtensor_DIR=\
        "$(pacman -Ql xtensor |
                   awk '/xtensorConfig\.cmake/{print $NF}')"
  cmake --build "${srcdir}"/build

  # --- skipped lines ---

  cd "${pkgdir}"
  make -C "${srcdir}"/build DESTDIR="${pkgdir}" install

(${srcdir} is the folder where the git repository of basix lives)

The following error happens with the installation of dolfin-git (from AUR). I suspect that my basix installation is wrong.
=== Edit 1 ends ===

CMake Error at CMakeLists.txt:290 (message):
  Generation of form files failed:

  Traceback (most recent call last):

    File "/build/dolfin-git/src/dolfin/cpp/cmake/scripts/generate-form-files.py", line 22, in <module>
      from ffcx.main import main as ffcx_main
    File "/usr/lib/python3.9/site-packages/ffcx/main.py", line 20, in <module>
      from ffcx import compiler, formatting
    File "/usr/lib/python3.9/site-packages/ffcx/compiler.py", line 71, in <module>
      from ffcx.codegeneration.codegeneration import generate_code
    File "/usr/lib/python3.9/site-packages/ffcx/codegeneration/codegeneration.py", line 18, in <module>
      from ffcx.codegeneration.expressions import generator as expression_generator
    File "/usr/lib/python3.9/site-packages/ffcx/codegeneration/expressions.py", line 12, in <module>
      from ffcx.codegeneration.backend import FFCXBackend
    File "/usr/lib/python3.9/site-packages/ffcx/codegeneration/backend.py", line 9, in <module>
      from ffcx.codegeneration.access import FFCXBackendAccess
    File "/usr/lib/python3.9/site-packages/ffcx/codegeneration/access.py", line 13, in <module>
      from ffcx.element_interface import create_element
    File "/usr/lib/python3.9/site-packages/ffcx/element_interface.py", line 3, in <module>
      import basix
    File "/usr/lib/python3.9/site-packages/basix/__init__.py", line 9, in <module>
      from ._basixcpp import __version__

  ImportError:
  /build/basix/pkg/fenics-basix-git/usr/lib/libbasix.so:
  undefined symbol: cblas_ddot

I got it to work! CBLAS is not being included with find_package(BLAS REQUIRED) in the basix/cpp/CMakeLists.txt file.

To fix that, I found my answer here: I added

set(BLAS_LIBRARIES "-lcblas;-lblas")

above target_link_libraries(basix PRIVATE ${BLAS_LIBRARIES})

After installing the package, I renamed basix/test/test_numba.py, and all tests passed.