CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   symbol lookup error (https://www.cfd-online.com/Forums/openfoam-programming-development/92455-symbol-lookup-error.html)

mirko September 14, 2011 16:04

symbol lookup error
 
Hello,

I am developing a boundary condition based on turbulentTemperatureCoupledBaffle and compiling with
Code:

wmake libso
The code compiles, but when I run it, I immediately get the following error:
Code:

multiRegionRadSimpleSolver: symbol lookup error: /opt/OpenFOAM/OpenFOAM-2.0.x/platforms/linux64Gcc45DPOpt/lib/libcoupledDerivedFvPatchFields.so: undefined symbol:
_ZN4Foam9NamedEnumINS_22temperatureCoupledBase11KMethodTypeELi4EE5namesE

But, when I list the symbols in the library, this symbol is present:
Code:

nm  /opt/OpenFOAM/OpenFOAM-2.0.x/platforms/linux64Gcc45DPOpt/lib/libcoupledDerivedFvPatchFields.so | grep _ZN4Foam9NamedEnumINS_22temperatureCoupledBase11KMethodTypeELi4EE5namesE
                U _ZN4Foam9NamedEnumINS_22temperatureCoupledBase11KMethodTypeELi4EE5namesE

Any thoughts on what could be going on here?

Thank you,

Mirko

marupio September 14, 2011 16:35

Whenever I get weird, inconsistent errors like that, I try recompiling OpenFOAM. That's my shot in the dark.

mbeaudoin September 14, 2011 17:09

Quote:

Originally Posted by mirko (Post 324153)

But, when I list the symbols in the library, this symbol is present:
Code:

nm  /opt/OpenFOAM/OpenFOAM-2.0.x/platforms/linux64Gcc45DPOpt/lib/libcoupledDerivedFvPatchFields.so | grep _ZN4Foam9NamedEnumINS_22temperatureCoupledBase11KMethodTypeELi4EE5namesE
                U _ZN4Foam9NamedEnumINS_22temperatureCoupledBase11KMethodTypeELi4EE5namesE


Your symbol might be present, but it is still undefined in that library.
The capital letter U in front of the symbol stands for Undefined...

'man nm' is your friend here.

Martin

mirko September 14, 2011 17:33

I was wondering what the `U' meant :-) I should have pursued it further.

Mirko

mirko September 15, 2011 13:46

I think I understand what went wrong: I was overriding an OpenFOAM library with my own incomplete library.

I am adding a boundary condition derived from compressible::turbulentTemperatureCoupledBaffle. In Make/files, I specified as the destination $FOAM_USER_LIBBIN/libcompressibleTurbulenceModel.

Presumably, this prevented the $FOAM_LIBBIN/libcompressibleTurbulenceModel from linking.

Mirko

sharonyue June 24, 2013 20:00

Quote:

Originally Posted by mirko (Post 324280)
I think I understand what went wrong: I was overriding an OpenFOAM library with my own incomplete library.

I am adding a boundary condition derived from compressible::turbulentTemperatureCoupledBaffle. In Make/files, I specified as the destination $FOAM_USER_LIBBIN/libcompressibleTurbulenceModel.

Presumably, this prevented the $FOAM_LIBBIN/libcompressibleTurbulenceModel from linking.

Mirko

Dear Mirko,

If it prevented the lib from linking, how to relink it with your own lib?

Hisham November 28, 2013 07:37

Dear all,

I got a similar error like that today and it went away after fixing an error in the code. The error was forgetting to add the class name before the function name for some reimplemented virtual functions:

void className::functionName()

instead of just:

void functionName()


Hisham

ziemowitzima October 28, 2014 11:18

Dear Mirko,
I now that it was in 2009...
but I have similar problem,
but even more strange...

I developed new BC as well,
but im my case everything run well on one processor, but If I want to run in parallel I got the same error as u had.

running decomposeParDic:

dlopen error : /home/user/OpenFOAM/user-2.3.0/platforms/linux64GccDPOpt/lib/customlibcompressibleTurbulenceModel.so: undefined symbol: _ZN4Foam9NamedEnumINS_22temperatureCoupledBase11KM ethodTypeELi4EE5namesE

any idea ?

thank you
MM

vcvedant August 10, 2017 08:40

Any solution?
 
was anyone able to solve this problem?
I am stuck here and can't move forward.

Joe Wang October 2, 2017 17:43

Hi,
I got the same problem. Still looking for information to solve it.
Joe

Joe Wang October 24, 2017 21:13

Hi,
I'm not sure if it's exactly the same problem as I came across as the following link and I solved mine.
Good luck!
Joe

https://www.cfd-online.com/Forums/op...kup-error.html

tooran March 5, 2020 15:07

Hi All,


In order to access the mesh information add the follwoing lines in my own library :


const objectRegistry& db();
const volVectorField& U = db().lookupObject<volVectorField>("U");
const fvMesh & mesh = U.mesh();

forAll ( etat, cellI) //loop through cell centres
{

etat[cellI]=mesh.C()[cellI].y();

if ( etat[cellI]< 0.048).....




But because of the
const objectRegistry& db();
const volVectorField& U = db().lookupObject<volVectorField>("U");
const fvMesh & mesh = U.mesh();


when I run it, it shows me error :

symbol lookup error:........................

undefined symbol: _ZN4Foam15viscosityModels2dbEv

Does anybody can help me?




Thanks

tooran March 6, 2020 20:07

I solved the problem by removing the following lines


const objectRegistry& db();
const volVectorField& U = db().lookupObject<volVectorField>("U");
const fvMesh & mesh = U.mesh();


And just write the following line:
const fvMesh& mesh = U_.mesh();

ttsurvase February 5, 2021 03:24

I have faced the similar type of issue. Libraries need to be compiled correctly. Check the file and options of Make folder. In my case, the libraries were not linked. Hope it helps.

Ells96 August 17, 2021 09:09

Quote:

Originally Posted by tooran (Post 760793)
I solved the problem by removing the following lines


const objectRegistry& db();
const volVectorField& U = db().lookupObject<volVectorField>("U");
const fvMesh & mesh = U.mesh();


And just write the following line:
const fvMesh& mesh = U_.mesh();

I'm trying to implement a similar thing and had the same code as you first used. I've tried using the same change but get the following error:

Code:

error: ‘const volVectorField& Foam::constitutiveEq::U_’ is private within this context
  147 |    const fvMesh& mesh = U_.mesh();

Did you receive this error? And how do you allow access to U_? Thanks


All times are GMT -4. The time now is 01:28.