Error building adapted CalculiX, still getting "fatal error: precice/SolverInterfaceC.h: No such file or directory"

I installed precice@2.2.0 compiled with gcc@11.4.0 using spack. I am using Ubuntu 22.04.3 LTS (Jammy Jellyfish). When building the CalculiX adapter, I keep getting the error “fatal error: precice/SolverInterfaceC.h: No such file or directory” despite linking the make command to the directory with the file libprecice.pc and cleaning the make.

I read the hint in troubleshooting for linking precice, suggesting that the structure of the directories could be the reason. However, mine should be right, as the header files are located in /include/precice/

Dummy solvers are running fine. So that makes me think that my preCICE installation should be right.

Installation tree

(base) daniel@jefi:~/spack/opt/spack/linux-ubuntu22.04-skylake/gcc-11.4.0/precice-2.2.0-bqdlfa7ltxmxovy5ojilsj2spgsbnzbe$ tree
├── bin
│   └── binprecice
├── include
│   └── precice
│       ├── SolverInterfaceC.h
│       ├── SolverInterfaceFASTEST.hpp
│       ├── SolverInterfaceFortran.hpp
│       └── SolverInterface.hpp
├── lib
│   ├── cmake
│   │   └── precice
│   │       ├── preciceConfig.cmake
│   │       ├── preciceConfigVersion.cmake
│   │       ├── preciceTargets.cmake
│   │       └── preciceTargets-release.cmake
│   ├── ->
│   ├── ->
│   ├──
│   └── pkgconfig
│       └── libprecice.pc
└── share
    ├── doc
    │   └── libprecice2
    │       ├── changelog.gz
    │       └── copyright
    ├── lintian
    │   └── overrides
    │       └── libprecice2
    ├── man
    │   └── man1
    │       └── binprecice.1.gz
    └── precice
        └── examples
            └── solverdummies
                ├── c
                │   ├── CMakeLists.txt
                │   ├──
                │   └── solverdummy.c
                ├── cpp
                │   ├── CMakeLists.txt
                │   ├──
                │   ├── solverdummy.cpp
                │   └── test.cmake
                ├── fortran
                │   ├── CMakeLists.txt
                │   ├──
                │   └── solverdummy.f90
                ├── precice-config.xml
                └── solverdummies.doxys

Spack packages:

(base) daniel@jefi:~$ spack find
-- linux-ubuntu22.04-skylake / gcc@11.4.0 -----------------------
autoconf@2.69                       libevent@2.1.12    pkgconf@1.9.5
automake@1.16.5                     libffi@3.4.4       pmix@4.2.4
berkeley-db@18.1.40                 libiconv@1.17      precice@2.2.0
bison@3.8.2                         libmd@1.0.4        py-cython@0.29.36
boost@1.74.0                        libpciaccess@0.17  py-flit-core@3.9.0
bzip2@1.0.8                         libsigsegv@2.14    py-mpi4py@3.1.4
ca-certificates-mozilla@2023-05-30  libtool@2.4.7      py-numpy@1.25.2
cmake@3.26.3                        libxcrypt@4.4.35   py-packaging@23.1
curl@8.1.2                          libxml2@2.10.3     py-pip@23.1.2
diffutils@3.9                       m4@1.4.19          py-pyprecice@
eigen@3.4.0                         metis@5.1.0        py-setuptools@63.4.3
expat@2.5.0                         ncurses@6.4        py-wheel@0.37.1
findutils@4.9.0                     nghttp2@1.52.0     python@3.10.12
gdbm@1.23                           numactl@2.0.14     readline@8.2
gettext@0.21.1                      openblas@0.3.23    sqlite@3.42.0
gmake@4.4.1                         openmpi@4.1.5      superlu-dist@8.1.2
hdf5@1.14.2                         openssh@9.3p1      tar@1.34
hwloc@2.9.1                         openssl@3.1.2      util-linux-uuid@2.38.1
hypre@2.28.0                        parmetis@4.0.3     util-macros@1.19.3
krb5@1.20.1                         perl@5.38.0        xz@5.4.1
libbsd@0.11.7                       petsc@3.19.4       zlib-ng@2.1.3
libedit@3.1-20210216                pigz@2.7           zstd@1.5.5
==> 66 installed packages

Structure with of precice installation showing where headers and libprecice.pc are located

(base) daniel@jefi:~/CalculiX/calculix-adapter-2.20.0$ cd /home/daniel/spack/opt/spack/linux-ubuntu22.04-skylake/gcc-11.4.0/precice-2.2.0-bqdlfa7ltxmxovy5ojilsj2spgsbnzbe/include
(base) daniel@jefi:~/spack/opt/spack/linux-ubuntu22.04-skylake/gcc-11.4.0/precice-2.2.0-bqdlfa7ltxmxovy5ojilsj2spgsbnzbe/include$ ls
(base) daniel@jefi:~/spack/opt/spack/linux-ubuntu22.04-skylake/gcc-11.4.0/precice-2.2.0-bqdlfa7ltxmxovy5ojilsj2spgsbnzbe/include$ cd precice/
(base) daniel@jefi:~/spack/opt/spack/linux-ubuntu22.04-skylake/gcc-11.4.0/precice-2.2.0-bqdlfa7ltxmxovy5ojilsj2spgsbnzbe/include/precice$ ls
SolverInterfaceC.h          SolverInterfaceFortran.hpp
SolverInterfaceFASTEST.hpp  SolverInterface.hpp
(base) daniel@jefi:~/spack/opt/spack/linux-ubuntu22.04-skylake/gcc-11.4.0/precice-2.2.0-bqdlfa7ltxmxovy5ojilsj2spgsbnzbe/include/precice$ cd ../../lib/pkgconfig/
(base) daniel@jefi:~/spack/opt/spack/linux-ubuntu22.04-skylake/gcc-11.4.0/precice-2.2.0-bqdlfa7ltxmxovy5ojilsj2spgsbnzbe/lib/pkgconfig$ ls

Error message when building (omitted make clean to shorten the output message)

(base) daniel@jefi:~/CalculiX/calculix-adapter-2.20.0$ source ~/spack/share/spack/
(base) daniel@jefi:~/CalculiX/calculix-adapter-2.20.0$ pkg-config --cflags libprecice
Package libprecice was not found in the pkg-config search path.
Perhaps you should add the directory containing `libprecice.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libprecice' found
(base) daniel@jefi:~/CalculiX/calculix-adapter-2.20.0$ PKG_CONFIG_PATH=~/spack/opt/spack/linux-ubuntu22.04-skylake/gcc-11.4.0/precice-2.2.0-bqdlfa7ltxmxovy5ojilsj2spgsbnzbe/lib/pkgconfig make
g++ -std=c++11 -I/usr/include/ -c adapter/2D3DCoupling.cpp -o bin/2D3DCoupling.o -lspooles -L/home/daniel/spack/opt/spack/linux-ubuntu22.04-skylake/gcc-11.4.0/precice-2.2.0-bqdlfa7ltxmxovy5ojilsj2spgsbnzbe/lib -lprecice -lstdc++ -lyaml-cpp -larpack -llapack -lblas -lpthread -lm -lc
adapter/2D3DCoupling.cpp:16:10: fatal error: precice/SolverInterfaceC.h: No such file or directory
   16 | #include <precice/SolverInterfaceC.h>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make: *** [Makefile:92: bin/2D3DCoupling.o] Error 1

I know something must have gone wrong, but at this point, I am not sure about what I could try.


Which state of the CalculiX adapter are you trying to build?

We have a new page in the documentation on finding the preCICE installation: Building from source - Finding | preCICE - The Coupling Library

Try manually setting the CPATH, as a workaround.


Thank you for the reply. It works now! By following the instructions to set PRECICE_PREFIX from the documentation, I do not get any errors anymore.

I am using the adapter of CalculiX for preCICE 2.2.0. Basically, the one from the link in the documentation (


1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.