# Problem with installation of openfoam-adapter

**URL:** <https://precice.discourse.group/t/problem-with-installation-of-openfoam-adapter/419>\
**Category:** Official adapters and tutorials\
**Tags:** openfoam, adapters\
**Created:** [January 12, 2021, 6:50am UTC](https://precice.discourse.group/t/problem-with-installation-of-openfoam-adapter/419 "2021-01-12T06:50:06Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![littlecucumer](https://yyz2.discourse-cdn.com/free1/user_avatar/precice.discourse.group/littlecucumer/32/489_2.png) [@littlecucumer](https://precice.discourse.group/u/littlecucumer)\
**Post date:** [January 12, 2021, 6:50am UTC](https://precice.discourse.group/t/problem-with-installation-of-openfoam-adapter/419/1 "2021-01-12T06:50:06Z")

</div>

Some errors occured when i installed openfoam-adapter in my system.  
Here is the description of my system:

- precice-2.1.0(build as a shared library)
- openfoam5.x
- centos7.4

when I run **./Allwmake** , I get the following log:

```
Building the OpenFOAM adapter for preCICE...
    Current OpenFOAM environment:
      WM_PROJECT = OpenFOAM
      WM_PROJECT_VERSION = 5.x

    The adapter will be built into:
      ADAPTER_TARGET_DIR = /home/hhuzty/OpenFOAM/hhuzty-5.x/platforms/linux64GccDPInt64Opt/lib

    The following building options will be used:
      ADAPTER_PREP_FLAGS = -DADAPTER_DEBUG_MODE
      ADAPTER_WMAKE_OPTIONS = 

    Dependencies (preCICE) will be located using the following environment variables:
      ADAPTER_PRECICE_ROOT = 
          preCICE dependencies: not specified (ok if preCICE is built as a shared library)
      ADAPTER_PKG_CONFIG_CFLAGS = -I/home/hhuzty/precice-2.1.0/include  
      ADAPTER_PKG_CONFIG_LIBS = -L/home/hhuzty/precice-2.1.0/lib64 -lprecice  
      ADAPTER_GLOBAL_CPLUS_INC_PATHS = -I/home/hhuzty/boost-1.72.0/include -I/home/hhuzty/boost-1.72.0/include -I/home/hhuzty/boost-1.72.0/include -I/home/hhuzty/boost-1.72.0/include 
      ADAPTER_GLOBAL_LD_LIBRARY_PATHS = -L/home/hhuzty/OpenFOAM/ThirdParty-5.x/platforms/linux64Gcc/CGAL-4.10/lib64 -L/home/hhuzty/OpenFOAM/ThirdParty-5.x/platforms/linux64Gcc/boost_1_55_0/lib -L/home/hhuzty/OpenFOAM/ThirdParty-5.x/platforms/linux64Gcc/gperftools-svn/lib -L/home/hhuzty/OpenFOAM/ThirdParty-5.x/platforms/linux64Gcc/ParaView-5.4.0/lib/paraview-5.4 -L/home/hhuzty/OpenFOAM/OpenFOAM-5.x/platforms/linux64GccDPInt64Opt/lib/openmpi-2.1.1 -L/home/hhuzty/OpenFOAM/ThirdParty-5.x/platforms/linux64GccDPInt64/lib/openmpi-2.1.1 -L/home/hhuzty/OpenFOAM/ThirdParty-5.x/platforms/linux64Gcc/openmpi-2.1.1/lib -L/home/hhuzty/OpenFOAM/ThirdParty-5.x/platforms/linux64Gcc/openmpi-2.1.1/lib64 -L/home/hhuzty/OpenFOAM/hhuzty-5.x/platforms/linux64GccDPInt64Opt/lib -L/home/hhuzty/OpenFOAM/site/5.x/platforms/linux64GccDPInt64Opt/lib -L/home/hhuzty/OpenFOAM/OpenFOAM-5.x/platforms/linux64GccDPInt64Opt/lib -L/home/hhuzty/OpenFOAM/ThirdParty-5.x/platforms/linux64GccDPInt64/lib -L/home/hhuzty/OpenFOAM/OpenFOAM-5.x/platforms/linux64GccDPInt64Opt/lib/dummy -L/home/hhuzty/precice-2.1.0/lib64 -L/home/hhuzty/petsc-3.14.0//lib -L/home/hhuzty/openmpi-2.1.1/lib -L/home/hhuzty/boost-1.72.0/lib -L/home/hhuzty/gcc-5.3.0/libexe -L/home/hhuzty/gcc-5.3.0/lib64 -L/home/hhuzty/gcc-5.3.0/lib -L/home/hhuzty/gcc-5.3.0/libexe -L/home/hhuzty/openmpi-2.1.1/lib/ -L/home/hhuzty/gcc-5.3.0/libexe -L/home/hhuzty/gcc-5.3.0/libexe 
      ADAPTER_GLOBAL_LIBRARY_PATHS = -L/home/hhuzty/boost-1.72.0/lib -L/home/hhuzty/boost-1.72.0/lib -L/home/hhuzty/boost-1.72.0/lib -L/home/hhuzty/boost-1.72.0/lib 

    Building with WMake (see the wmake.log log file)...

    === ERROR: Building completed with linking problems: there were undefined symbols. ===
    Possible causes:
    - Is preCICE discoverable at runtime? Check the content of ADAPTER_PKG_CONFIG_LIBS and ADAPTER_GLOBAL_LD_LIBRARY_PATHS above.
    - If preCICE is (in purpose) only build as a static library, please set the ADAPTER_PRECICE_DEP in this script appropriately (see comments).
    See wmake.log and ldd.log for more details.

```

Here are the wmake.log, Allwmake.log and ldd.log:  
[Allwmake.log](https://precice.discourse.group/uploads/short-url/57LAeHpk73udZDp6pcOIWR5fKNa.log) (2.9 KB) [ldd.log](https://precice.discourse.group/uploads/short-url/kclXVOg6vTkOT0ekEfZhsxYPXCg.log) (7.4 KB) [wmake.log](https://precice.discourse.group/uploads/short-url/efpscvNMT33YYIrI6HLdBNRjsbC.log) (30.9 KB)  
Anybody help?

---

<div class="post-metadata">

**Author:** ![Makis](https://yyz2.discourse-cdn.com/free1/user_avatar/precice.discourse.group/makis/32/25_2.png) [@Makis](https://precice.discourse.group/u/Makis)\
**Post date:** [January 12, 2021, 7:20am UTC](https://precice.discourse.group/t/problem-with-installation-of-openfoam-adapter/419/2 "2021-01-12T07:20:56Z")

</div>

Welcome, @littlecucumer!

I am afraid this has nothing to do with the adapter, but it should affect your complete OpenFOAM installation. At the end of your `ldd.log` you have the following undefined symbols:

```
undefined symbol: opal_uses_threads	(/home/hhuzty/OpenFOAM/ThirdParty-5.x/platforms/linux64Gcc/openmpi-2.1.1/lib64/libmpi.so.20)
undefined symbol: mpi_conversion_fn_null_	(/home/hhuzty/openmpi-2.1.1/lib/libmpi_mpifh.so.20)
undefined symbol: ompi_fortran_argv_f2c	(/home/hhuzty/openmpi-2.1.1/lib/libmpi_mpifh.so.20)
undefined symbol: ompi_fortran_string_f2c	(/home/hhuzty/openmpi-2.1.1/lib/libmpi_mpifh.so.20)
undefined symbol: ompi_fortran_multiple_argvs_f2c	(/home/hhuzty/openmpi-2.1.1/lib/libmpi_mpifh.so.20)
undefined symbol: ompi_fortran_string_c2f	(/home/hhuzty/openmpi-2.1.1/lib/libmpi_mpifh.so.20)
undefined symbol: _ZN4Foam9UOPstream11writeQuotedERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEb	(/home/hhuzty/OpenFOAM/hhuzty-5.x/platforms/linux64GccDPInt64Opt/lib/libpreciceAdapterFunctionObject.so)
undefined symbol: _ZN4FoamlsERNS_7OstreamERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE	(/home/hhuzty/OpenFOAM/hhuzty-5.x/platforms/linux64GccDPInt64Opt/lib/libpreciceAdapterFunctionObject.so)

```

This means that the OpenFOAM function object that gets produced cannot link correctly to MPI.

Are you maybe mixing MPI implementation versions? I see that it is linking against an MPI installation at `/home/hhuzty/openmpi-2.1.1/`. Was OpenFOAM compiled with the same version?

---

<div class="post-metadata">

**Author:** ![littlecucumer](https://yyz2.discourse-cdn.com/free1/user_avatar/precice.discourse.group/littlecucumer/32/489_2.png) [@littlecucumer](https://precice.discourse.group/u/littlecucumer)\
**Post date:** [January 12, 2021, 7:42am UTC](https://precice.discourse.group/t/problem-with-installation-of-openfoam-adapter/419/3 "2021-01-12T07:42:22Z")

</div>

Maybe i should install openfoam5.x again, i think.  
There is an openmpi-2.1.1 in the **/OpenFOAM/Thirdparty5.x**. when i run **cmake** for precice-2.1.0, it can not found the MPICXX, so i install another openmpi-2.1.1 in **/home/hhuzty**.  
Same version, but not same package,that is the problem probably.

---

<div class="post-metadata">

**Author:** ![Makis](https://yyz2.discourse-cdn.com/free1/user_avatar/precice.discourse.group/makis/32/25_2.png) [@Makis](https://precice.discourse.group/u/Makis)\
**Post date:** [January 12, 2021, 7:57am UTC](https://precice.discourse.group/t/problem-with-installation-of-openfoam-adapter/419/4 "2021-01-12T07:57:38Z")

</div>

preCICE should not be able to find the MPI that comes in the Thirdparty directory of OpenFOAM, unless installed globally on your system.

I would recommend that you install MPI on your system first, and then install OpenFOAM and build preCICE with the same version. If you are on your own system, maybe there are system packages for both. If not, both OpenFOAM and preCICE are [available through Spack](https://www.precice.org/installation-spack.html).

By the way, if you are installing OpenFOAM now, why not go for a more recent version? Right now I would recommend OpenFOAM v2012. Although I guess you have your own OpenFOAM solvers/tools.

---

<div class="post-metadata">

**Author:** ![littlecucumer](https://yyz2.discourse-cdn.com/free1/user_avatar/precice.discourse.group/littlecucumer/32/489_2.png) [@littlecucumer](https://precice.discourse.group/u/littlecucumer)\
**Post date:** [January 12, 2021, 8:11am UTC](https://precice.discourse.group/t/problem-with-installation-of-openfoam-adapter/419/5 "2021-01-12T08:11:22Z")

</div>

Thanks for your reply and suggestions @Makis !I need to install MPI first, and install the OpenFOAM with SYSTEMMPI.

---

<div class="post-metadata">

**Author:** ![littlecucumer](https://yyz2.discourse-cdn.com/free1/user_avatar/precice.discourse.group/littlecucumer/32/489_2.png) [@littlecucumer](https://precice.discourse.group/u/littlecucumer)\
**Post date:** [January 12, 2021, 1:13pm UTC](https://precice.discourse.group/t/problem-with-installation-of-openfoam-adapter/419/6 "2021-01-12T13:13:04Z")

</div>

I have installed the openfoam with **SYSTEMMPI**. I get the same error:

```
=== ERROR: Building completed with linking problems: there were undefined symbols. ===
    Possible causes:
    - Is preCICE discoverable at runtime? Check the content of ADAPTER_PKG_CONFIG_LIBS and ADAPTER_GLOBAL_LD_LIBRARY_PATHS above.
    - If preCICE is (in purpose) only build as a static library, please set the ADAPTER_PRECICE_DEP in this script appropriately (see comments).
    See wmake.log and ldd.log for more details.

```

However, i get new wmake.log, Allwmake.log and ldd.log:  
[Allwmake.log](https://precice.discourse.group/uploads/short-url/luvXGNmAXdZ9oYYB7oJ91CIJrn4.log) (2.2 KB) [ldd.log](https://precice.discourse.group/uploads/short-url/aDDoMXKXKdsCnxxIYN0mmuHPXnQ.log) (85.9 KB) [wmake.log](https://precice.discourse.group/uploads/short-url/iYd72nFaOEuKp8Qvf7Bocxg3PP0.log) (28.6 KB)

---

<div class="post-metadata">

**Author:** ![Makis](https://yyz2.discourse-cdn.com/free1/user_avatar/precice.discourse.group/makis/32/25_2.png) [@Makis](https://precice.discourse.group/u/Makis)\
**Post date:** [January 12, 2021, 1:32pm UTC](https://precice.discourse.group/t/problem-with-installation-of-openfoam-adapter/419/7 "2021-01-12T13:32:36Z")

</div>

You now get even more errors with more dependencies, not only MPI (I see this in your `ldd.log`).

What did you do exactly to build OpenFOAM? Do non-preCICE OpenFOAM simulations run?

---

<div class="post-metadata">

**Author:** ![littlecucumer](https://yyz2.discourse-cdn.com/free1/user_avatar/precice.discourse.group/littlecucumer/32/489_2.png) [@littlecucumer](https://precice.discourse.group/u/littlecucumer)\
**Post date:** [January 12, 2021, 1:45pm UTC](https://precice.discourse.group/t/problem-with-installation-of-openfoam-adapter/419/8 "2021-01-12T13:45:42Z")

</div>

I use the wrong gcc(v4.8.5) when i install the adapter.So careless. I should switch version to v5.3.0.

---

<div class="post-metadata">

**Author:** ![littlecucumer](https://yyz2.discourse-cdn.com/free1/user_avatar/precice.discourse.group/littlecucumer/32/489_2.png) [@littlecucumer](https://precice.discourse.group/u/littlecucumer)\
**Post date:** [January 12, 2021, 1:56pm UTC](https://precice.discourse.group/t/problem-with-installation-of-openfoam-adapter/419/9 "2021-01-12T13:56:53Z")

</div>

Sorry for bother you. I install the adapter with **gcc-5.3.0**. Here is the ldd.log i got:[ldd.log](https://precice.discourse.group/uploads/short-url/z1W5y6RwaSZKqRR6zCI4CwWNO40.log) (6.8 KB)  
The problem of MPI has been solved, but some new error happened.  
OpenFOAM is ok, it works.

---

<div class="post-metadata">

**Author:** ![Makis](https://yyz2.discourse-cdn.com/free1/user_avatar/precice.discourse.group/makis/32/25_2.png) [@Makis](https://precice.discourse.group/u/Makis)\
**Post date:** [January 12, 2021, 9:15pm UTC](https://precice.discourse.group/t/problem-with-installation-of-openfoam-adapter/419/10 "2021-01-12T21:15:55Z")

</div>

This still seems to be something wrong in the OpenFOAM installation. Did you build it from source? Can you run OpenFOAM simulations in parallel?

---

<div class="post-metadata">

**Author:** ![littlecucumer](https://yyz2.discourse-cdn.com/free1/user_avatar/precice.discourse.group/littlecucumer/32/489_2.png) [@littlecucumer](https://precice.discourse.group/u/littlecucumer)\
**Post date:** [January 13, 2021, 6:44am UTC](https://precice.discourse.group/t/problem-with-installation-of-openfoam-adapter/419/12 "2021-01-13T06:44:52Z")

</div>

I run a tutorial (/OpenFOAM/OpenFOAM-5.x/tutorials/incompressible/simpleFoam/motorBike) in parallel with OpenFOAM. The result in paraview looks good. The parallel simulation is ok, i think.

I built OpenFAOM and preCICE with diffferent versions of boost. Is that the cause of the error? Should i switch my system to Ubuntu or build them by SPACK?

---

<div class="post-metadata">

**Author:** ![Makis](https://yyz2.discourse-cdn.com/free1/user_avatar/precice.discourse.group/makis/32/25_2.png) [@Makis](https://precice.discourse.group/u/Makis)\
**Post date:** [January 13, 2021, 9:55am UTC](https://precice.discourse.group/t/problem-with-installation-of-openfoam-adapter/419/13 "2021-01-13T09:55:09Z")

</div>

> [@littlecucumer](#):
>
> I run a tutorial (/OpenFOAM/OpenFOAM-5.x/tutorials/incompressible/simpleFoam/motorBike) in parallel with OpenFOAM. The result in paraview looks good. The parallel simulation is ok, i think.

Then OpenFOAM itself works fine. You could then try building any function object. It will be installed to your `$FOAM_USER_LIBBIN` directory. You could then run `ldd $FOAM_USER_LIBBIN/your_function_object.so` and see if you get similar errors. But I am not sure if it is worth the effort, it will not help you fix the problem.

> [@littlecucumer](#):
>
> I built OpenFAOM and preCICE with diffferent versions of boost. Is that the cause of the error?

Different version of Boost is fine. The only important point is that OpenFOAM and preCICE link to the same MPI.

> [@littlecucumer](#):
>
> Should i switch my system to Ubuntu or build them by SPACK?

preCICE works with any Linux system, Ubuntu is just easier to set everything up, because it is more widespread and many projects (including OpenFOAM and preCICE) provide binary packages to install.

Spack simply makes it easy to build software when you don’t have all the dependencies you need. I would recommend giving it a try, but you should then either also build OpenFOAM with Spack (with the same MPI version), or tell Spack to use the same MPI for preCICE, as the one used for OpenFOAM. It can definitely get complicated.

By the way, CentOS provides an `mpi-selector`, which lets you select your MPI installation. Are you aware of this?

---

<div class="post-metadata">

**Author:** ![littlecucumer](https://yyz2.discourse-cdn.com/free1/user_avatar/precice.discourse.group/littlecucumer/32/489_2.png) [@littlecucumer](https://precice.discourse.group/u/littlecucumer)\
**Post date:** [January 14, 2021, 7:54am UTC](https://precice.discourse.group/t/problem-with-installation-of-openfoam-adapter/419/14 "2021-01-14T07:54:46Z")

</div>

I solved my problem! Not only we need to use same MPI, but also we need to build OpenFOAM, preCICE and OpenFOAM-adpater with same version of GCC. My preCICE was built with gcc-5.3.0, and OpenFOAM was built with gcc-4.8.5. l link adapter to preCICE successfully after i installed the OpenFOAM which was build by gcc-5.3.0.

Thanks for your suggestions and patience, @Makis .

---

<div class="post-metadata">

**Author:** ![Makis](https://yyz2.discourse-cdn.com/free1/user_avatar/precice.discourse.group/makis/32/25_2.png) [@Makis](https://precice.discourse.group/u/Makis)\
**Post date:** [January 14, 2021, 3:38pm UTC](https://precice.discourse.group/t/problem-with-installation-of-openfoam-adapter/419/15 "2021-01-14T15:38:11Z")

</div>

Very nice to hear that! Compiling with the same compiler should not normally be necessary, but there can be such situations. We [want to make this more robust in the future](https://github.com/precice/precice/issues/623).

---

<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:** [January 17, 2021, 3:38pm UTC](https://precice.discourse.group/t/problem-with-installation-of-openfoam-adapter/419/16 "2021-01-17T15:38:13Z")

</div>

Closed on January 17, 2021, 3:38pm UTC

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