# Error in petsc header files

**URL:** <https://precice.discourse.group/t/error-in-petsc-header-files/727>\
**Category:** Installing preCICE\
**Tags:** petsc\
**Created:** [September 19, 2021, 12:45pm UTC](https://precice.discourse.group/t/error-in-petsc-header-files/727 "2021-09-19T12:45:11Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![kursatyurt](https://yyz2.discourse-cdn.com/free1/user_avatar/precice.discourse.group/kursatyurt/32/802_2.png) [@kursatyurt](https://precice.discourse.group/u/kursatyurt)\
**Post date:** [September 19, 2021, 12:45pm UTC](https://precice.discourse.group/t/error-in-petsc-header-files/727/1 "2021-09-19T12:45:11Z")

</div>

Hello everybody we are facing a problem when installing preCICE from the source. Every dependency is compiled from the source.

Our system is

- preCICE version 2.2.0
- Operating system Ubuntu 16
- All from source code
- Boost 1.77, PETSc 3.15, OpenMPI 4.0.5, Eigen 3.3.9

Here is the error message, is there any suggestion for us?

```
[38%] Building CXX object CMakeFiles/precice.dir/src/mapping/config/MappingConfiguration.cpp.o
In file included from /scratch/ge79qad/install_precice/dependencies/petsc/include/petscsys.h:14:0,
                 from /scratch/ge79qad/install_precice/dependencies/petsc/include/petscis.h:7,
                 from /scratch/ge79qad/install_precice/dependencies/petsc/include/petscao.h:8,
                 from /scratch/ge79qad/install_precice/precice_source/precice-2.2.0/src/utils/Petsc.hpp:44,
                 from /scratch/ge79qad/install_precice/precice_source/precice-2.2.0/src/mapping/PetRadialBasisFctMapping.hpp:23,
                 from /scratch/ge79qad/install_precice/precice_source/precice-2.2.0/src/mapping/config/MappingConfiguration.cpp:13:
/scratch/ge79qad/install_precice/dependencies/petsc/include/petscviewer.h:134:3: error: expected ‘}’ before ‘__attribute’
   PETSC_VIEWER_ASCII_VTK_ATTR = PETSC_VIEWER_ASCII_VTK_DEPRECATED,
   ^
In file included from /scratch/ge79qad/install_precice/dependencies/petsc/include/petscvec.h:12:0,
                 from /scratch/ge79qad/install_precice/dependencies/petsc/include/petscmat.h:6,
                 from /scratch/ge79qad/install_precice/dependencies/petsc/include/petscpc.h:6,
                 from /scratch/ge79qad/install_precice/dependencies/petsc/include/petscksp.h:6,
                 from /scratch/ge79qad/install_precice/precice_source/precice-2.2.0/src/utils/Petsc.hpp:46,
                 from /scratch/ge79qad/install_precice/precice_source/precice-2.2.0/src/mapping/PetRadialBasisFctMapping.hpp:23,
                 from /scratch/ge79qad/install_precice/precice_source/precice-2.2.0/src/mapping/config/MappingConfiguration.cpp:13:
/scratch/ge79qad/install_precice/dependencies/petsc/include/petscviewer.h:134:31: error: expected unqualified-id before ‘=’ token
   PETSC_VIEWER_ASCII_VTK_ATTR = PETSC_VIEWER_ASCII_VTK_DEPRECATED,
                               ^
/scratch/ge79qad/install_precice/dependencies/petsc/include/petscviewer.h:164:3: error: expected declaration before ‘}’ token
   } PetscViewerFormat;
   ^
CMakeFiles/precice.dir/build.make:1111: recipe for target 'CMakeFiles/precice.dir/src/mapping/config/MappingConfiguration.cpp.o' failed
make[2]: *** [CMakeFiles/precice.dir/src/mapping/config/MappingConfiguration.cpp.o] Error 1
CMakeFiles/Makefile2:187: recipe for target 'CMakeFiles/precice.dir/all' failed
make[1]: *** [CMakeFiles/precice.dir/all] Error 2
Makefile:165: recipe for target 'all' failed
make: *** [all] Error 2

```

---

<div class="post-metadata">

**Author:** ![ajaust](https://yyz2.discourse-cdn.com/free1/user_avatar/precice.discourse.group/ajaust/32/160_2.png) [@ajaust](https://precice.discourse.group/u/ajaust)\
**Post date:** [September 19, 2021, 3:04pm UTC](https://precice.discourse.group/t/error-in-petsc-header-files/727/2 "2021-09-19T15:04:41Z")

</div>

What version of GCC is your OpenMPI based on? You can check with `mpicc --version`. Did the installation of PETSc (including `make test`) succeed?

My guess that your underlying GCC might be too old so you could try an older version of PETSc and see if this works for you.

---

<div class="post-metadata">

**Author:** ![kursatyurt](https://yyz2.discourse-cdn.com/free1/user_avatar/precice.discourse.group/kursatyurt/32/802_2.png) [@kursatyurt](https://precice.discourse.group/u/kursatyurt)\
**Post date:** [September 19, 2021, 4:29pm UTC](https://precice.discourse.group/t/error-in-petsc-header-files/727/3 "2021-09-19T16:29:59Z")

</div>

Our gcc version is gcc (GCC) 7.5.0

the compilation and compilation check done without any error.

the test summary is as follows

```
# Summary    
# -------------
# FAILED ts_tutorials_eimex-ct_vdp_imex ts_tutorials_eimex-ct_vdp_imex_adapt vec_is_sf_tests-ex1_window_nsize-1+sf_window_flavor-dynamic_sf_window_sync-fence vec_is_sf_tests-ex1_window_nsize-1+sf_window_flavor-dynamic_sf_window_sync-active vec_is_sf_tests-ex1_window_nsize-1+sf_window_flavor-dynamic_sf_window_sync-lock diff-vec_is_sf_tests-ex4_2_window+sf_window_sync-fence_sf_window_flavor-dynamic vec_is_sf_tests-ex4_2_window+sf_window_sync-active_sf_window_flavor-dynamic diff-vec_is_sf_tests-ex4_2_window+sf_window_sync-lock_sf_window_flavor-dynamic diff-vec_is_sf_tutorials-ex3_window_dupped+sf_window_sync-fence_sf_window_flavor-dynamic vec_is_sf_tutorials-ex3_window_dupped+sf_window_sync-active_sf_window_flavor-dynamic diff-vec_is_sf_tutorials-ex3_window_dupped+sf_window_sync-lock_sf_window_flavor-dynamic diff-vec_is_sf_tutorials-ex3_window+sf_window_sync-fence_sf_window_flavor-dynamic diff-vec_is_sf_tutorials-ex3_window+sf_window_sync-active_sf_window_flavor-dynamic diff-vec_is_sf_tutorials-ex3_window+sf_window_sync-lock_sf_window_flavor-dynamic snes_tutorials-ex33_0
# success 7247/9408 tests (77.0%)
# failed 15/9408 tests (0.2%)
# todo 225/9408 tests (2.4%)
# skip 1921/9408 tests (20.4%)

```

---

<div class="post-metadata">

**Author:** ![ajaust](https://yyz2.discourse-cdn.com/free1/user_avatar/precice.discourse.group/ajaust/32/160_2.png) [@ajaust](https://precice.discourse.group/u/ajaust)\
**Post date:** [September 19, 2021, 6:21pm UTC](https://precice.discourse.group/t/error-in-petsc-header-files/727/4 "2021-09-19T18:21:25Z")

</div>

It would be interesting to see the full configuration and compilation output of preCICE. As a quick solution I would try an older PETSc release (3.13 or 3.14) and see if the error persists.

---

<div class="post-metadata">

**Author:** ![kursatyurt](https://yyz2.discourse-cdn.com/free1/user_avatar/precice.discourse.group/kursatyurt/32/802_2.png) [@kursatyurt](https://precice.discourse.group/u/kursatyurt)\
**Post date:** [September 19, 2021, 8:15pm UTC](https://precice.discourse.group/t/error-in-petsc-header-files/727/5 "2021-09-19T20:15:59Z")

</div>

The CMake configuration that I am using is as follows

```
cmake -DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX=/scratch/ge79qad/install_precice/precice_source/precice-2.2.0/ -DCMAKE_BUILD_TYPE=RelWithDebInfo -DPRECICE_PythonActions=OFF ..

```

I will try older PETSc release 🙂

---

<div class="post-metadata">

**Author:** ![ajaust](https://yyz2.discourse-cdn.com/free1/user_avatar/precice.discourse.group/ajaust/32/160_2.png) [@ajaust](https://precice.discourse.group/u/ajaust)\
**Post date:** [September 20, 2021, 7:35am UTC](https://precice.discourse.group/t/error-in-petsc-header-files/727/6 "2021-09-20T07:35:26Z")

</div>

Keep us posted! 🙂

Just for reference: With “output” I meant all the output CMake prints to the terminal when you run the configuration and the compilation step and not only the command line you used for the configuration. The output helps to check whether the correct libraries, compilers etc. were picked up.

---

<div class="post-metadata">

**Author:** ![kursatyurt](https://yyz2.discourse-cdn.com/free1/user_avatar/precice.discourse.group/kursatyurt/32/802_2.png) [@kursatyurt](https://precice.discourse.group/u/kursatyurt)\
**Post date:** [September 20, 2021, 10:24am UTC](https://precice.discourse.group/t/error-in-petsc-header-files/727/7 "2021-09-20T10:24:39Z")

</div>

> [@ajaust](#):
>
> With “output” I meant all the output CMake prints to the terminal when you run the configuration and the compilation step and not only the command line you used for th

Using PETSc 3.13 I finally managed to install preCICE itself.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/precice/original/1X/67d2a5fa6f80e597e2267ff17fa8c1673cd11caa.svg) [@system](https://precice.discourse.group/u/system)\
**Post date:** [September 23, 2021, 10:24am UTC](https://precice.discourse.group/t/error-in-petsc-header-files/727/8 "2021-09-23T10:24:44Z")

</div>

Closed on September 23, 2021, 10:24am UTC

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