|
[Sponsors] |
October 9, 2011, 13:24 |
Linking problems dynamic library
|
#1 |
New Member
Join Date: Jun 2011
Location: Rotterdam, the Netherlands
Posts: 9
Rep Power: 15 |
Dear all,
Using Ubuntu 11.04 I recently upgraded to OF 2.0.1. I have created a custom library without problems. However, the following error message keeps appearing when I try to use this new library (libfvMotionSolversNew.so): --> FOAM Warning : From function dlLibraryTable:pen(const fileName&, const bool) in file db/dynamicLibrary/dlLibraryTable/dlLibraryTable.C at line 96 could not load "libfvMotionSolversNew.so" For some reason OF cannot find the library, although I did add the line libs ("libfvMotionSolversNew.so"); to the file controlDict. The new library is placed in the folder $FOAM_USER_LIBBIN, copying it to $FOAM_LIBBIN does not solve the problem. Does anyone have a suggestion to solve this? Regards, Kevin |
|
October 10, 2011, 12:13 |
|
#2 |
Senior Member
Bernhard
Join Date: Sep 2009
Location: Delft
Posts: 790
Rep Power: 22 |
This is normally how it should work afaik.
Probably the solution is simple, no typo somewhere? Compilation problems? Did you compile with "wmake libso"? Do you have such a problem with other libraries (I guess not)? |
|
October 10, 2011, 13:42 |
|
#3 |
New Member
Join Date: Jun 2011
Location: Rotterdam, the Netherlands
Posts: 9
Rep Power: 15 |
Compiling using "wmake libso" works without problems.
Using the standard libraries provided with OF is also no problem. The only thing is that OF cannot find the newly created library. Maybe my 'options' file contains an error in the linking? Please see below: EXE_INC = \ -I$(LIB_SRC)/triSurface/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/dynamicMesh/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/postProcessing/functionObjects/forces/lnInclude \ -I$(LIB_SRC)/fvMotionSolver/lnInclude \ LIB_LIBS = \ -L$(FOAM_USER_LIBBIN) \ -ltriSurface \ -lmeshTools \ -ldynamicMesh \ -lfiniteVolume \ /*-lforces include in controlDict if needed */ |
|
October 11, 2011, 04:22 |
|
#4 |
Senior Member
ata kamyabi
Join Date: Aug 2009
Location: Kerman
Posts: 323
Rep Power: 18 |
Hi
I think you must remove the "back slash"(\) from the last lines: EXE_INC = \ -I$(LIB_SRC)/triSurface/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/dynamicMesh/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/postProcessing/functionObjects/forces/lnInclude \ -I$(LIB_SRC)/fvMotionSolver/lnInclude LIB_LIBS = \ -L$(FOAM_USER_LIBBIN) \ -ltriSurface \ -lmeshTools \ -ldynamicMesh \ -lfiniteVolume |
|
October 21, 2011, 10:18 |
|
#5 |
Senior Member
Francois
Join Date: Jun 2010
Posts: 107
Rep Power: 21 |
If you add the options you specified in:
As a matter of fact, your library should then be usable even without adding the line: Code:
libs("libfvMotionSolversNew.so"); Hope this helps. Kind regards, Francois. |
|
October 21, 2011, 10:20 |
|
#6 |
Senior Member
Francois
Join Date: Jun 2010
Posts: 107
Rep Power: 21 |
Of course, don't forget to recompile the original library once you changed the "options" file...
|
|
October 21, 2011, 10:37 |
|
#7 |
Senior Member
David Gaden
Join Date: Apr 2009
Location: Winnipeg, Canada
Posts: 437
Rep Power: 22 |
I've encountered linking problems trying to compile it in Ubuntu 11.10. See this thread: http://www.cfd-online.com/Forums/ope...tml#post328779
It could be related, and it could be a compiler issue.
__________________
~~~ Follow me on twitter @DavidGaden |
|
October 21, 2011, 11:51 |
|
#8 |
New Member
Join Date: Jun 2011
Location: Rotterdam, the Netherlands
Posts: 9
Rep Power: 15 |
Dear all,
Thanks for the replies. I just found another message running OF 2.0.1, it says to disallow user-supplied system cal operations, see below: (...) nProcs : 1 sigFpe : Enabling floating point exception trapping (FOAM_SIGFPE). fileModificationChecking : Monitoring run-time modified files using timeStampMaster allowSystemOperations : Disallowing user-supplied system call operations // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // Create time (...) I guess OF doesn't allow me to access my new library? Secondly, it seems that the new library does work when using OF 1.7.1. That is, there are no problems accessing the library and I can start debugging. Although I'm a bit short on time (who isn't?) I'll get back on this. Regards, Kevin |
|
October 21, 2011, 12:13 |
|
#9 | |
Senior Member
Francois
Join Date: Jun 2010
Posts: 107
Rep Power: 21 |
No, it shouldn't matter.
The Quote:
Kind regards, Francois. |
||
October 22, 2011, 09:26 |
|
#10 |
Senior Member
David Boger
Join Date: Mar 2009
Location: Penn State Applied Research Laboratory
Posts: 146
Rep Power: 17 |
I ran into a problem loading a library in 2.0.x yesterday, and a colleague suggested this solution, which helped a lot. I added the following lines to OpenFOAM-2.0.x/src/OSspecific/POSIX/POSIX.C. In that file, around line 1138, you'll find this line:
Code:
void* handle = ::dlopen(lib.c_str(), RTLD_LAZY|RTLD_GLOBAL); Code:
// find error (if any) Info << "Checking for error" << endl; char *error = ::dlerror(); if (error) { WarningIn("dlOpen(const fileName&)") << "dlopen error : " << error << endl; } With that, you should get more information on why the .so file wouldn't load. (In my case, I found that I forgot that I also needed to first load a second .so file.) I've submitted this as a "feature request" to OpenCFD, so maybe future versions will give better feedback. Hope it helps! David
__________________
David A. Boger |
|
July 30, 2012, 23:19 |
|
#11 |
Senior Member
mahdi abdollahzadeh
Join Date: Mar 2011
Location: Covilha,Portugal
Posts: 153
Rep Power: 15 |
Dear All
I have also created my custom library without problems. However, I am also getting the following error message when I try to use this new library (libfvMotionSolversNew.so): --> FOAM Warning : From function dlLibraryTable:pen(const fileName&, const bool) in file db/dynamicLibrary/dlLibraryTable/dlLibraryTable.C at line 96 Could you help me please? Best Mahdi |
|
July 31, 2012, 02:19 |
|
#12 |
Senior Member
ata kamyabi
Join Date: Aug 2009
Location: Kerman
Posts: 323
Rep Power: 18 |
Hi
Did you add the library name to the controldict? |
|
July 31, 2012, 05:02 |
|
#13 | |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128 |
Greetings to all!
Mahdi, I got the private message you sent me. You should have also indicated the thread where you asked your question as well. Either way, this isn't sufficient information: Quote:
Bruno
__________________
|
||
July 31, 2012, 06:50 |
|
#14 |
Senior Member
mahdi abdollahzadeh
Join Date: Mar 2011
Location: Covilha,Portugal
Posts: 153
Rep Power: 15 |
Dear Bruno and Ata
Thanks for your kind reply. I am working with OpenFOAM-2.0.x on Ubuntu 10.04 LTS. to create my boundary condition I did that : 1- I have copied the turbulentTemperatureCoupledBaffleMixed boundary condition and renamed it to myturbulentTemperatureCoupledBaffleMixed 2-secondly I have done my changes 3- I complied it as a dynamic library with wmake libso. then I have tested two things. 1-first I just added a libs ("mylibfinvoll.so"); to the controldict and start running and then I got the following message. Code:
/*---------------------------------------------------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 2.0.x | | \\ / A nd | Web: www.OpenFOAM.com | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ Build : 2.0.x Exec : ppplasmaFoam Date : Jul 31 2012 Time : 10:26:01 Host : octopus100.ubi.pt PID : 30164 Case : /home/mahdi/OpenFOAM/mahdi-2.0.x/run/mmunfer nProcs : 1 sigFpe : Enabling floating point exception trapping (FOAM_SIGFPE). fileModificationChecking : Monitoring run-time modified files using timeStampMaster allowSystemOperations : Disallowing user-supplied system call operations // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // Create time --> FOAM Warning : From function dlLibraryTable::open(const fileName&) in file db/dynamicLibrary/dlLibraryTable/dlLibraryTable.C at line 99 could not load "mylibfinvoll.so" Create fluid mesh for region MainAir for time = 0 Create solid mesh for region Dielectric for time = 0 Reading field p Reading field U --> FOAM FATAL IO ERROR: Unknown patchField type compressible::myturbulentTemperatureCoupledBaffleMixed for patch type directMappedWall Valid patchField types are : 98 ( MarshakRadiation MarshakRadiationFixedT advective alphatJayatillekeWallFunction alphatWallFunction atmBoundaryLayerInletEpsilon buoyantPressure calculated codedFixedValue compressible::epsilonWallFunction compressible::kqRWallFunction compressible::omegaWallFunction compressible::temperatureThermoBaffle1D<constSolidThermoPhysics> compressible::temperatureThermoBaffle1D<expoSolidThermoPhysics> compressible::turbulentHeatFluxTemperature compressible::turbulentMixingLengthDissipationRateInlet compressible::turbulentMixingLengthFrequencyInlet compressible::turbulentTemperatureCoupledBaffle compressible::turbulentTemperatureCoupledBaffleMixed compressible::turbulentTemperatureRadCoupledMixed cyclic cyclicSlip directMapped directMappedField directMappedFixedInternalValue directMappedFixedPushedInternalValue directionMixed empty epsilonWallFunction fan fanPressure fixedEnthalpy fixedFluxPressure fixedGradient fixedInternalEnergy fixedInternalValue fixedPressureCompressibleDensity fixedValue freestream freestreamPressure gradientEnthalpy gradientInternalEnergy greyDiffusiveRadiation greyDiffusiveRadiationViewFactor htcConvection inletOutlet inletOutletTotalTemperature kappatJayatillekeWallFunction kqRWallFunction mixed mixedEnthalpy mixedInternalEnergy mutLowReWallFunction mutURoughWallFunction mutUSpaldingWallFunction mutUWallFunction mutkRoughWallFunction mutkWallFunction nonuniformTransformCyclic nuSgsUSpaldingWallFunction nutLowReWallFunction nutTabulatedWallFunction nutURoughWallFunction nutUSpaldingWallFunction nutUWallFunction nutkRoughWallFunction nutkWallFunction omegaWallFunction oscillatingFixedValue outletInlet outletMappedUniformInlet partialSlip processor processorCyclic rotatingTotalPressure selfContainedDirectMapped sliced slip symmetryPlane syringePressure timeVaryingMappedFixedValue timeVaryingTotalPressure timeVaryingUniformFixedValue totalFlowRateAdvectiveDiffusive totalPressure totalTemperature turbulentHeatFluxTemperature turbulentInlet turbulentIntensityKineticEnergyInlet turbulentMixingLengthDissipationRateInlet turbulentMixingLengthFrequencyInlet uniformDensityHydrostaticPressure uniformFixedValue wallHeatTransfer waveTransmissive wedge wideBandDiffusiveRadiation zeroGradient ) file: /home/mahdi/OpenFOAM/mahdi-2.0.x/run/mmunfer/0/MainAir/phielec::boundaryField::interfaceA from line 27 to line 31. From function fvPatchField<Type>::New(const fvPatch&, const DimensionedField<Type, volMesh>&, const dictionary&) in file /home/mahdi/centFOAM//OpenFOAM/OpenFOAM-2.0.x/src/finiteVolume/lnInclude/fvPatchFieldNew.C at line 135. FOAM exiting 2- secondly instead of adding the libentry in controldict i add the library to Option file my solver which looks like: Code:
EXE_INC = \ -Iinclude \ -Ifluid \ -Isolid \ -I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/turbulenceModels/incompressible/turbulenceModel \ -I$(LIB_SRC)/transportModels \ -I$(LIB_SRC)/transportModels/incompressible/singlePhaseTransportModel \ -I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/turbulenceModels \ -I$(LIB_SRC)/thermophysicalModels/basicSolidThermo/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \ -I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel/lnInclude EXE_LIBS = \ -lincompressibleTurbulenceModel \ -lincompressibleRASModels \ -lincompressibleLESModels \ -lincompressibleTransportModels \ -lfiniteVolume \ -lcompressibleRASModels \ -lmeshTools \ -lspecie \ -L$(FOAM_USER_LIBBIN)/ \ -lbasicSolidThermo Code:
*---------------------------------------------------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 2.0.x | | \\ / A nd | Web: www.OpenFOAM.com | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ Build : 2.0.x Exec : ppplasmaFoam Date : Jul 31 2012 Time : 10:45:33 Host : octopus100.ubi.pt PID : 1158 Case : /home/mahdi/OpenFOAM/mahdi-2.0.x/run/mmunfer nProcs : 1 sigFpe : Enabling floating point exception trapping (FOAM_SIGFPE). fileModificationChecking : Monitoring run-time modified files using timeStampMaster allowSystemOperations : Disallowing user-supplied system call operations // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // Create time Create fluid mesh for region MainAir for time = 0 Create solid mesh for region Dielectric for time = 0 Reading field p Reading field U --> FOAM FATAL IO ERROR: Unknown patchField type compressible::myturbulentTemperatureCoupledBaffleMixed for patch type directMappedWall Valid patchField types are : 98 ( MarshakRadiation MarshakRadiationFixedT advective alphatJayatillekeWallFunction alphatWallFunction atmBoundaryLayerInletEpsilon buoyantPressure calculated codedFixedValue compressible::epsilonWallFunction compressible::kqRWallFunction compressible::omegaWallFunction compressible::temperatureThermoBaffle1D<constSolidThermoPhysics> compressible::temperatureThermoBaffle1D<expoSolidThermoPhysics> compressible::turbulentHeatFluxTemperature compressible::turbulentMixingLengthDissipationRateInlet compressible::turbulentMixingLengthFrequencyInlet compressible::turbulentTemperatureCoupledBaffle compressible::turbulentTemperatureCoupledBaffleMixed compressible::turbulentTemperatureRadCoupledMixed cyclic cyclicSlip directMapped directMappedField directMappedFixedInternalValue directMappedFixedPushedInternalValue directionMixed empty epsilonWallFunction fan fanPressure fixedEnthalpy fixedFluxPressure fixedGradient fixedInternalEnergy fixedInternalValue fixedPressureCompressibleDensity fixedValue freestream freestreamPressure gradientEnthalpy gradientInternalEnergy greyDiffusiveRadiation greyDiffusiveRadiationViewFactor htcConvection inletOutlet inletOutletTotalTemperature kappatJayatillekeWallFunction kqRWallFunction mixed mixedEnthalpy mixedInternalEnergy mutLowReWallFunction mutURoughWallFunction mutUSpaldingWallFunction mutUWallFunction mutkRoughWallFunction mutkWallFunction nonuniformTransformCyclic nuSgsUSpaldingWallFunction nutLowReWallFunction nutTabulatedWallFunction nutURoughWallFunction nutUSpaldingWallFunction nutUWallFunction nutkRoughWallFunction nutkWallFunction omegaWallFunction oscillatingFixedValue outletInlet outletMappedUniformInlet partialSlip processor processorCyclic rotatingTotalPressure selfContainedDirectMapped sliced slip symmetryPlane syringePressure timeVaryingMappedFixedValue timeVaryingTotalPressure timeVaryingUniformFixedValue totalFlowRateAdvectiveDiffusive totalPressure totalTemperature turbulentHeatFluxTemperature turbulentInlet turbulentIntensityKineticEnergyInlet turbulentMixingLengthDissipationRateInlet turbulentMixingLengthFrequencyInlet uniformDensityHydrostaticPressure uniformFixedValue wallHeatTransfer waveTransmissive wedge wideBandDiffusiveRadiation zeroGradient ) file: /home/mahdi/OpenFOAM/mahdi-2.0.x/run/mmunfer/0/MainAir/phielec::boundaryField::interfaceA from line 27 to line 31. From function fvPatchField<Type>::New(const fvPatch&, const DimensionedField<Type, volMesh>&, const dictionary&) in file /home/mahdi/centFOAM//OpenFOAM/OpenFOAM-2.0.x/src/finiteVolume/lnInclude/fvPatchFieldNew.C at line 135. FOAM exiting Do you think that it it could be related to DL_LIBrary_PATH? I have readed in some of the threads in forum. Best Mahdi |
|
July 31, 2012, 07:24 |
|
#15 |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128 |
In a nutshell:
__________________
|
|
July 31, 2012, 08:07 |
|
#16 |
Senior Member
mahdi abdollahzadeh
Join Date: Mar 2011
Location: Covilha,Portugal
Posts: 153
Rep Power: 15 |
Dear Burno
Thanks for your kind reply I have corrected the name. but it didn't solved. if i don't add in the solver I will receive the same message. but if add it it will gives the follwing error: Code:
g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -O3 -DNoRepository -ftemplate-depth-100 -Iinclude -Ifluid -Isolid -I/home/mahdi/centFOAM//OpenFOAM/OpenFOAM-2.0.x/src/meshTools/lnInclude -I/home/mahdi/centFOAM//OpenFOAM/OpenFOAM-2.0.x/src/turbulenceModels/incompressible/turbulenceModel -I/home/mahdi/centFOAM//OpenFOAM/OpenFOAM-2.0.x/src/transportModels -I/home/mahdi/centFOAM//OpenFOAM/OpenFOAM-2.0.x/src/transportModels/incompressible/singlePhaseTransportModel -I/home/mahdi/centFOAM//OpenFOAM/OpenFOAM-2.0.x/src/finiteVolume/lnInclude -I/home/mahdi/centFOAM//OpenFOAM/OpenFOAM-2.0.x/src/turbulenceModels -I/home/mahdi/OpenFOAM/mahdi-2.0.x/src/MultiRegionBound/lnInclude -I/home/mahdi/centFOAM//OpenFOAM/OpenFOAM-2.0.x/src/thermophysicalModels/basicSolidThermo/lnInclude -I/home/mahdi/centFOAM//OpenFOAM/OpenFOAM-2.0.x/src/thermophysicalModels/specie/lnInclude -I/home/mahdi/centFOAM//OpenFOAM/OpenFOAM-2.0.x/src/turbulenceModels/compressible/turbulenceModel/lnInclude -IlnInclude -I. -I/home/mahdi/centFOAM//OpenFOAM/OpenFOAM-2.0.x/src/OpenFOAM/lnInclude -I/home/mahdi/centFOAM//OpenFOAM/OpenFOAM-2.0.x/src/OSspecific/POSIX/lnInclude -fPIC -Xlinker --add-needed Make/linux64Gcc45DPOpt/incompressibleCourantNo.o Make/linux64Gcc45DPOpt/solidRegionDiffNo.o Make/linux64Gcc45DPOpt/ppplasmaFoam.o -L/home/mahdi/centFOAM//OpenFOAM/OpenFOAM-2.0.x/platforms/linux64Gcc45DPOpt/lib \ -lincompressibleTurbulenceModel -lincompressibleRASModels -lincompressibleLESModels -lincompressibleTransportModels -lfiniteVolume -lcompressibleRASModels -lmeshTools -lspecie -lmyfinvoll -lbasicSolidThermo -lOpenFOAM -ldl -lm -o /home/mahdi/OpenFOAM/mahdi-2.0.x/platforms/linux64Gcc45DPOpt/bin/ppplasmaFoam /usr/bin/ld: cannot find -lmyfinvoll collect2: ld returned 1 exit status make: *** [/home/mahdi/OpenFOAM/mahdi-2.0.x/platforms/linux64Gcc45DPOpt/bin/ppplasmaFoam] Error 1 |
|
July 31, 2012, 17:45 |
|
#17 |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128 |
Hi Mahdi,
I'm too tired right now to guess was going on wrong... well, I can guess that you removed the last "-L*" line and replaced it with the "-lmyfinvoll", when you should have added the last one. Either way, here are a few tutorials on how to modify OpenFOAM code for personal modifications, for you to study and draw ideas from:
Bruno
__________________
|
|
August 2, 2012, 11:52 |
|
#18 |
Senior Member
mahdi abdollahzadeh
Join Date: Mar 2011
Location: Covilha,Portugal
Posts: 153
Rep Power: 15 |
Dear Buruno
Thanks for your kind reply.... the first problem as you mwntioned was with the name of library. and the second was that I didnt add the correct libralry when compiling my own library ...( but it was compiling correctly and without any waring or error!!!)... When I add that library and changed the name, it works ... Thanks for your help. |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[ICEM] Problems with coedge curves and surfaces | tommymoose | ANSYS Meshing & Geometry | 6 | December 1, 2020 12:12 |
OpenFOAM with Cygwin | kitchener | OpenFOAM Installation | 6 | April 25, 2006 00:09 |
previewing dynamic mesh | emma chen | FLUENT | 2 | May 12, 2003 04:52 |
unstructured grid | sreekanth | Main CFD Forum | 1 | August 6, 2001 16:09 |
Good library to solve huge linear system | Ricardo Bonon | Main CFD Forum | 3 | May 19, 2000 07:24 |