Compiling the OpenFOAM adapter complains about std::make_unique

Here’s the info

Please describe your system, and especially:

  • preCICE version 2.5

  • Operating system or platform (e.g. “Ubuntu 20.04”, “SuperMUC-NG”): Ubuntu 20.04 WSL
    Allwmake.log (910 Bytes)
    wmake.log (34.7 KB)

  • Installation method (e.g. building with CMake, Spack, other packages) preCICE admin deb install.

openfoam-adapter downloaded from Release v1.2.0 · precice/openfoam-adapter · GitHub and run ./Allwmake

Error

wmkdepend: could not open 'precice/SolverInterface.hpp' for source file 'Adapter.C': No such file or directory
wmkdepend: could not open 'precice/SolverInterface.hpp' for source file 'preciceAdapterFunctionObject.C': No such file or directory
wmkdepend: could not open 'precice/SolverInterface.hpp' for source file 'FF/FF.C': No such file or directory
wmkdepend: could not open 'precice/SolverInterface.hpp' for source file 'FSI/FSI.C': No such file or directory
wmkdepend: could not open 'precice/SolverInterface.hpp' for source file 'CHT/CHT.C': No such file or directory
wmkdepend: could not open 'precice/SolverInterface.hpp' for source file 'Interface.C': No such file or directory

Allwmake.log wmake.log attached.

Thank you!

Thank you for being part of the preCICE community! :hugs:

Dear @quarkz,

the actual error is:

g++ -std=c++11 -m64 -pthread -DOPENFOAM=2206 -DWM_DP -DWM_LABEL_SIZE=32 -Wall -Wextra -Wold-style-cast -Wnon-virtual-dtor -Wno-unused-parameter -Wno-invalid-offsetof -Wno-attributes -Wno-unknown-pragmas -O3  -DNoRepository -ftemplate-depth-100  -I/home/user/OpenFOAM/OpenFOAM-v2206/src/finiteVolume/lnInclude -I/home/user/OpenFOAM/OpenFOAM-v2206/src/meshTools/lnInclude -I/home/user/OpenFOAM/OpenFOAM-v2206/src/transportModels/ -I/home/user/OpenFOAM/OpenFOAM-v2206/src/transportModels/incompressible/lnInclude -I/home/user/OpenFOAM/OpenFOAM-v2206/src/transportModels/compressible/lnInclude -I/home/user/OpenFOAM/OpenFOAM-v2206/src/transportModels/twoPhaseMixture/lnInclude -I/home/user/OpenFOAM/OpenFOAM-v2206/src/transportModels/interfaceProperties/lnInclude -I/home/user/OpenFOAM/OpenFOAM-v2206/src/transportModels/immiscibleIncompressibleTwoPhaseMixture/lnInclude -I/home/user/OpenFOAM/OpenFOAM-v2206/src/thermophysicalModels/basic/lnInclude -I/home/user/OpenFOAM/OpenFOAM-v2206/src/TurbulenceModels/turbulenceModels/lnInclude -I/home/user/OpenFOAM/OpenFOAM-v2206/src/TurbulenceModels/compressible/lnInclude -I/home/user/OpenFOAM/OpenFOAM-v2206/src/TurbulenceModels/incompressible/lnInclude -I/home/user/OpenFOAM/OpenFOAM-v2206/src/triSurface/lnInclude  -I../  -iquote. -IlnInclude -I/home/user/OpenFOAM/OpenFOAM-v2206/src/OpenFOAM/lnInclude -I/home/user/OpenFOAM/OpenFOAM-v2206/src/OSspecific/POSIX/lnInclude   -fPIC -c preciceAdapterFunctionObject.C -o Make/linux64Gcc940DPInt32Opt/preciceAdapterFunctionObject.o
FSI/Force.C: In constructor ‘preciceAdapter::FSI::Force::Force(const Foam::fvMesh&, std::string, std::string)’:
FSI/Force.C:22:29: error: ‘make_unique’ is not a member of ‘std’
   22 |         ForceOwning_ = std::make_unique<volVectorField>(volVectorField(
      |                             ^~~~~~~~~~~
FSI/Force.C:22:29: note: ‘std::make_unique’ is only available from C++14 onwards
FSI/Force.C:22:55: error: expected primary-expression before ‘>’ token
   22 |         ForceOwning_ = std::make_unique<volVectorField>(volVectorField(
      |                                                       ^

which I already experienced with some older OpenFOAM versions. I assume that in this case it must be an old compiler or a similar issue. Could you please run g++ --version and report the version?

Can you please try changing:

  • In FSI/Force.H, change the ForceOwning_ declaration to Foam::autoPtr<Foam::volVectorField> ForceOwning_;
  • In FSI/Force.C, change line 22 to ForceOwning_ = new volVectorField(

If this works for you, I think we should make a bugfix release with this change. Related issue: Adapter requires C++14 · Issue #263 · precice/openfoam-adapter · GitHub

Hi Makis,

wmake2.log (36.1 KB)

wmake1.log (35.3 KB)

Allwmake.log (910 Bytes)

Allwmake1.log (534 Bytes)

It looks like you have written:

std::unique_ptr<Foam::volVectorField> Foam::autoPtr<Foam::volVectorField> ForceOwning_;

please make this:

Foam::autoPtr<Foam::volVectorField> ForceOwning_;

Hi,

Yes, in fact I tried both. I just tried again. The error msg:

FSI/Force.C: In constructor ‘preciceAdapter::FSI::Force::Force(const Foam::fvMesh&, std::string, std::string)’:
FSI/Force.C:34:36: error: use of deleted function ‘void Foam::autoPtr::operator=(T*) [with T = Foam::GeometricField<Foam::Vector, Foam::fvPatchField, Foam::volMesh>]’
34 | Foam::vector::zero)));
| ^
In file included from /home/user/OpenFOAM/OpenFOAM-v2206/src/OpenFOAM/lnInclude/runTimeSelectionTables.H:46,
from /home/user/OpenFOAM/OpenFOAM-v2206/src/OpenFOAM/lnInclude/token.H:52,
from /home/user/OpenFOAM/OpenFOAM-v2206/src/OpenFOAM/lnInclude/Istream.H:50,
from /home/user/OpenFOAM/OpenFOAM-v2206/src/OpenFOAM/lnInclude/ISstream.H:42,
from /home/user/OpenFOAM/OpenFOAM-v2206/src/OpenFOAM/lnInclude/IOstreams.H:41,
from ./Utilities.H:40,
from ./CouplingDataUser.H:4,
from FSI/ForceBase.H:5,
from FSI/Force.H:4,
from FSI/Force.C:1:
/home/user/OpenFOAM/OpenFOAM-v2206/src/OpenFOAM/lnInclude/autoPtr.H:253:14: note: declared here
253 | void operator=(T* p) = delete;
| ^~~~~~~~
make: *** [/home/user/OpenFOAM/OpenFOAM-v2206/wmake/rules/General/transform:34: Make/linux64Gcc940DPInt32Opt/FSI/Force.o] Error 1

The previous email has the log files attached.

I’m using my own compiled OF. Other than, it’s all quite standard.

So any idea how to solve this problem?

Sorry for the delay, I wanted to look closer into this before answering.
This change should work. Could you please check?

In Force.C:

-        ForceOwning_ = std::make_unique<volVectorField>(volVectorField(
+        ForceOwning_.reset(new volVectorField(

Ignore my previous suggestions. The solution I proposed above works for some older .com and all .org, but not for the latest .com version.

Hi,

Thanks for the help. No worries such I understand the problem may not be easy to solve.

There seems to be improvement but still some errors in the end. I have attached the log files.

wmake.log (36.6 KB)

Allwmake.log (1021 Bytes)

But this is now something different. Could you please upload your ldd.log as well? This probably points to some undefined symbols.

Hi Makis,

Here’s the ldd.log.

ldd.log (9.53 KB)

The relevant part is at the bottom:

undefined symbol: fftw_taint	(/lib/x86_64-linux-gnu/libfftw3_mpi.so.3)
undefined symbol: fftw_join_taint	(/lib/x86_64-linux-gnu/libfftw3_mpi.so.3)

You mentioned that you are building OpenFOAM yourself. This is a problem I have seen before and that has nothing to do with preCICE/the adapter. See Search results for 'fftw_taint' - preCICE Forum on Discourse

Hi Makis,

Sure, thanks anyway, I’ll check it out.

Hi Makis,

I saw some solutions but it didn’t work. Some mention reinstalling OF but I’m afraid it still might not work.

Anyway, I installed the deb compiled OF and now the adapter has compiled successfully.

1 Like

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