I don't have much control over the build process, but I am getting an undefined reference to symbols error when my next piece of code tries to link with the previously compiled shared library. [Although the said symbols are there in the so]
here is a snippet of symbols from the shared library of interest (libmycode.so below complete real name is given), I want to remove last two lines of this snippet and test if removing those helps my case.
U _ZN4Foam5token21transferCompoundTokenERKNS_7IstreamE
U _ZN4Foam5token8compound10isCompoundERKNS_4wordE
U _ZN4Foam5tokenC1ERNS_7IstreamE
U _ZN4Foam6fvMeshC1ERKNS_8IOobjectE
U _ZN4Foam6fvMeshD1Ev
I repeat, I can't just compile them using g++ -unresolved-symbols -fdata-sections -ffunction-sections.
Also
objcopy -N 'Foam::fvMesh()' libmycode.so
didn't work
Also I have another libmycode2.so which links just fine with my code and the difference between these two objects is the additional two lines which I mentioned in the snippet.
options and files of executables
chem1dReader.C
chem1dToFoam.C
EXE = $(FOAM_USER_APPBIN)/pasrChem1dToFoam_m
Now options
EXE_INC = \
-I$(LIB_SRC)/OpenFOAM/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/turbulenceModels \
-I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel/lnInclude \
-I$(LIB_SRC)/turbulenceModels/compressible/RAS/lnInclude \
-I$(LIB_SRC)/turbulenceModels/compressible/LES/lnInclude \
-I$(LIB_SRC)/turbulenceModels/LES/LESdeltas/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
-I$(LIB_pasrFGM_m_SRC)/pdfFGMThermo/basic/lnInclude \
-I$(LIB_pasrFGM_m_SRC)/pdfFGMThermo/reactionThermo/lnInclude \
-I$(LIB_pasrFGM_m_SRC)/combustionModels/lnInclude
EXE_LIBS = \
-L$(FOAM_USER_LIBBIN) \
-lODE \
-lspecie \
-lcompressibleLESModels \
-lcompressibleTurbulenceModel \
-lcompressibleRASModels \
-lpdfFGMbasicThermophysicalModels \
-lpdfFGMreactionThermophysicalModels \
-lpdfFGMCombustionModels \
-lfiniteVolume
Exact error message when I try to compile pasrChem1dToFoam_m
dReader.o Make/linux64GccDPOpt/chem1dToFoam.o -L/home/vasu/OpenFOAM/OpenFOAM-2.3.1/platforms/linux64GccDPOpt/lib \
-L/home/vasu/OpenFOAM/vasu-2.3.1/platforms/linux64GccDPOpt/lib -lODE -lspecie -lcompressibleLESModels -lcompressibleTurbulenceModel - lcompressibleRASModels -lpdfFGMbasicThermophysicalModels - lpdfFGMreactionThermophysicalModels -lpdfFGMCombustionModels - lfiniteVolume -lOpenFOAM -ldl -lm -o
/home/vasu/OpenFOAM/vasu- 2.3.1/platforms/linux64GccDPOpt/bin/pasrChem1dToFoam_m
/home/vasu/OpenFOAM/vasu-2.3.1/platforms/linux64GccDPOpt/lib/libpdfFGMbasicThermophysicalModels.so: undefined reference to `Foam::fluidThermo::destroyTimeConstructorTables()'
/home/vasu/OpenFOAM/vasu-2.3.1/platforms/linux64GccDPOpt/lib/libpdfFGMbasicThermophysicalModels.so: undefined reference to `Foam::basicThermo::constructTimeConstructorTables()'
/home/vasu/OpenFOAM/vasu-2.3.1/platforms/linux64GccDPOpt/lib/libpdfFGMbasicThermophysicalModels.so: undefined reference to `Foam::basicThermo::destroyTimeConstructorTables()'
/home/vasu/OpenFOAM/vasu-2.3.1/platforms/linux64GccDPOpt/lib/libpdfFGMbasicThermophysicalModels.so: undefined reference to `Foam::fluidThermo::fluidThermo(Foam::Time const&, Foam::word const&)'
/home/vasu/OpenFOAM/vasu-2.3.1/platforms/linux64GccDPOpt/lib/libpdfFGMbasicThermophysicalModels.so: undefined reference to `Foam::fluidThermo::constructTimeConstructorTables()'
/home/vasu/OpenFOAM/vasu-2.3.1/platforms/linux64GccDPOpt/lib/libpdfFGMbasicThermophysicalModels.so: undefined reference to `Foam::basicThermo::TimeConstructorTablePtr_'
/home/vasu/OpenFOAM/vasu-2.3.1/platforms/linux64GccDPOpt/lib/libpdfFGMbasicThermophysicalModels.so: undefined reference to `Foam::fluidThermo::TimeConstructorTablePtr_'
collect2: error: ld returned 1 exit status
/home/vasu/OpenFOAM/OpenFOAM-2.3.1/wmake/Makefile:149: recipe for target '
/home/vasu/OpenFOAM/vasu-2.3.1/platforms/linux64GccDPOpt/bin/pasrChem1dToFoam_m' failed
make: *** [/home/vasu/OpenFOAM/vasu-2.3.1/platforms/linux64GccDPOpt/bin/pasrChem1dToFoam_m] Error 1