Problem with installation of openfoam-adapter

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 (2.9 KB) ldd.log (7.4 KB) wmake.log (30.9 KB)
Anybody help?

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?

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.

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.

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.

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

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 (2.2 KB) ldd.log (85.9 KB) wmake.log (28.6 KB)

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?

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

Sorry for bother you. I install the adapter with gcc-5.3.0 . Here is the ldd.log i got:ldd.log (6.8 KB)
The problem of MPI has been solved, but some new error happened.
OpenFOAM is ok, it works.

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

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?

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.

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

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?

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 .

1 Like

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.

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