Installation of precice v2 and its openfoam-adapter

Hi all,
I wanted to switch my precice installation from v1 to v2 so I uninstalled everything (libprecice + openfoam-adapter) and now I am having trouble with installing openfoam-adapter.
I was able to pass the tests after installing precice v2 (via sources or debian package) but I think the installation did not go well because if I run binprecice, the output is:

binprecice: error while loading shared libraries: libprecice.so.2: cannot open shared object file: No such file or directory

It looks to me that there might be a confusion between /usr/local and /usr but I am not an expert in this. If somebody can review the installation process with me, it would be great !

Let us say I download this package.

  1. How can I make sure there won’t be any conflict with any previous installation of precice v1 or v2 that I tried to install/uninstall ?

  2. if everything’s fine, should I just use

    dpkg -i ./libprecice2_2.0.1_bionic.deb
    or
    apt install ./libprecice2_2.0.1_bionic.deb
    ? And do I need to look at something specific before moving to openfoam-adapter ?

Many thanks for your support

After more consideration, I think my installation of libprecice is valid.
However, when I run ./Allwmake for openfoam-adapter, I get the following log:

Building the OpenFOAM adapter for preCICE…

Current OpenFOAM environment:
WM_PROJECT = OpenFOAM
WM_PROJECT_VERSION = 6

The adapter will be built into:
ADAPTER_TARGET_DIR = /home/tdg/OpenFOAM/tdg-6/platforms/linux64GccDPInt64Opt/lib

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

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/usr/local/include
ADAPTER_PKG_CONFIG_LIBS = -L/usr/local/lib -lprecice
ADAPTER_GLOBAL_CPLUS_INC_PATHS =
ADAPTER_GLOBAL_LD_LIBRARY_PATHS = -L/mnt/datasim/OpenFOAM/ThirdParty-6/platforms/linux64Gcc/gperftools-svn/lib -L/mnt/datasim/OpenFOAM/ThirdParty-6/platforms/linux64Gcc/ParaView-5.4.0/lib/paraview-5.4 -L/mnt/datasim/OpenFOAM/OpenFOAM-6/platforms/linux64GccDPInt64Opt/lib/openmpi-system -L/mnt/datasim/OpenFOAM/ThirdParty-6/platforms/linux64GccDPInt64/lib/openmpi-system -L/usr/lib/x86_64-linux-gnu/openmpi/lib -L/home/tdg/OpenFOAM/tdg-6/platforms/linux64GccDPInt64Opt/lib -L/mnt/datasim/OpenFOAM/site/6/platforms/linux64GccDPInt64Opt/lib -L/mnt/datasim/OpenFOAM/OpenFOAM-6/platforms/linux64GccDPInt64Opt/lib -L/mnt/datasim/OpenFOAM/ThirdParty-6/platforms/linux64GccDPInt64/lib -L/mnt/datasim/OpenFOAM/OpenFOAM-6/platforms/linux64GccDPInt64Opt/lib/dummy
ADAPTER_GLOBAL_LIBRARY_PATHS =

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

=== ERROR: Building failed. See wmake.log for more. ===
Possible causes:

Also in step 3 of the installation tutorial, it is said i may have to adapt to a specific branch of the adapter. The above log was made with the master branch. I pulled the branch related to my OF version (OF6) with the following command:

git clone --single-branch --branch OpenFOAM6 https://github.com/precice/openfoam-adapter.git

And the only change I do in ./Allwmake is :

ADAPTER_WMAKE_OPTIONS="-j $(nproc)"

And when I run the ./Allwmake I obtain

Building the OpenFOAM adapter for preCICE...

Current OpenFOAM environment:
  WM_PROJECT = OpenFOAM
  WM_PROJECT_VERSION = 6

The adapter will be built into:
  ADAPTER_TARGET_DIR    = /home/tdg/OpenFOAM/tdg-6/platforms/linux64GccDPInt64Opt/lib

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

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/usr/local/include
  ADAPTER_PKG_CONFIG_LIBS         = -L/usr/local/lib -lprecice
  ADAPTER_GLOBAL_CPLUS_INC_PATHS  =
  ADAPTER_GLOBAL_LD_LIBRARY_PATHS = -L/mnt/datasim/OpenFOAM/ThirdParty-6/platforms/linux64Gcc/gperftools-svn/lib -L/mnt/datasim/OpenFOAM/ThirdParty-6/platforms/linux64Gcc/ParaView-5.4.0/lib/paraview-5.4 -L/mnt/datasim/OpenFOAM/OpenFOAM-6/platforms/linux64GccDPInt64Opt/lib/openmpi-system -L/mnt/datasim/OpenFOAM/ThirdParty-6/platforms/linux64GccDPInt64/lib/openmpi-system -L/usr/lib/x86_64-linux-gnu/openmpi/lib -L/home/tdg/OpenFOAM/tdg-6/platforms/linux64GccDPInt64Opt/lib -L/mnt/datasim/OpenFOAM/site/6/platforms/linux64GccDPInt64Opt/lib -L/mnt/datasim/OpenFOAM/OpenFOAM-6/platforms/linux64GccDPInt64Opt/lib -L/mnt/datasim/OpenFOAM/ThirdParty-6/platforms/linux64GccDPInt64/lib -L/mnt/datasim/OpenFOAM/OpenFOAM-6/platforms/linux64GccDPInt64Opt/lib/dummy
  ADAPTER_GLOBAL_LIBRARY_PATHS    =

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 log files

I managed to solve the problems with the installation by following this tutorial.
The thing that I was missing is export the right variables :

export PRECICE_ROOT = /path/to/precice/folder 

and

export LIBRARY_PATH=$LIBRARY_PATH:/usr/local/lib
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
export CPATH=$CPATH:/usr/local/include/precice
1 Like

Hey, it’s me again !
I decided to reinstall the OF-adapter to have the newest version. I cannot manage to successfully install it. Here are wmake.log and Allwmake.log:
wmake.log (4.5 KB) Allwmake.log (2.0 KB)
I notice the problem has to do with the setDeltaT function that is used with two arguments by the adapter, whereas its implementation in OpenFOAM takes only one argument : Time.H.
Can you help me with this ?

Note: I am using OF-6. I tried using the version of the adapter for OF-6 (which is not updated) and the “latest” (supposedly made for OF-7) and none of them worked.

Edit: A curious thing I noticed: Between OF-6 and the latest implementation of Adapter.C, the call to setDeltaT is different: one has this extra argument that upsets the compiler (line 610 approximately).

This is exactly the breaking change introduced in OpenFOAM 6 for which we are maintaining a different branch (and working on a solution to not need separate branches). For now, you indeed need to use the branch OpenFOAM6.

By “latest” you are refering I guess to the master branch. This is the branch that works with most versions at the moment and occasionally we also update the special cases branches (such as OpenFOAM6 and OpenFOAM7). If you need the updates, please ping us (I just updated them), or just do a git merge master.

If you are refering to the branch OpenFOAM7, this is supposed to work with OpenFOAM 7, but not with 6, as OpenFOAM 7 also renamed fileName::DIRECTORY to fileType::directory. In any case (also for future readers), please stick to the instructions in the page Notes on OpenFOAM, this is the central and most up-to-date resource.

This really depends how and where you installed preCICE. Since you installed a Debian package, you should not need this, as you have also installed a pkg-config file under /usr/lib/x86_64-linux-gnu/pkgconfig/, which is a known system location.

If you have preCICE files in /usr/local/, then you probably got them from a previous installation from source, using the default CMAKE_INSTALL_PREFIX. If you still have the the build directory available, you can try running sudo make uninstall from inside the build directory (preCICE v1.6.0 or newer). Otherwise, you could manually clean previously installed files.

In any case, if you are using Ubuntu & friends, the best is to either get the precompiled packages, or build them yourself and install them using your package manager.

In that case:

prefer using apt, as it is more user-friendly. dpkg can give you more options, which you normally don’t need.

Does this solve your issue?

Hello @Makis !

Thanks for the technical precisions and the resources.

Just for clarification, My first 3 posts are for a problem I had with the installation from sources, and its resolving (I chose to include the exports in my .bashrc at that time). My fourth post has to do with another installation of the same OpenFOAM-adapter and you are right: I should have merged from the master git repo. I am a bit uncomfortable with git when it’s out of its basic use, so I did a fresh install which worked thanks to your post by using the command (make sure OpenFOAM is sourced):

git clone --single-branch --branch OpenFOAM6 https://github.com/precice/openfoam-adapter.git
cd openfoam-adapter
./Allclean
./Allwmake

I opted for installing for sources because I need to modify the adapter (cf my other topic).

Thanks a lot !

EDIT: Many also thanks for your reactivity to update the branch !

Don’t worry, @dashqua! We know that Git is not something that our users should be experienced with, I just wrote the details also in case a future reader needs them. :slight_smile:

Feel free to open a different thread for any new problem.