我对构建过程没有太多控制权,但是当我的下一段代码尝试与先前编译的共享库链接时,我得到一个未定义的符号引用错误。[虽然上述符号在so中]
这是来自感兴趣的共享库的符号片段(libmycode.so 下面给出了完整的真实姓名),我想删除这个片段的最后两行并测试删除这些是否对我的情况有帮助。
U _ZN4Foam5token21transferCompoundTokenERKNS_7IstreamE
U _ZN4Foam5token8compound10isCompoundERKNS_4wordE
U _ZN4Foam5tokenC1ERNS_7IstreamE
U _ZN4Foam6fvMeshC1ERKNS_8IOobjectE
U _ZN4Foam6fvMeshD1Ev
我再说一遍,我不能只使用 g++ -unresolved-symbols -fdata-sections -ffunction-sections 来编译它们。
还
objcopy -N 'Foam::fvMesh()' libmycode.so
没用
此外,我还有另一个 libmycode2.so 与我的代码链接得很好,这两个对象之间的区别是我在片段中提到的另外两行。
可执行文件的选项和文件
chem1dReader.C
chem1dToFoam.C
EXE = $(FOAM_USER_APPBIN)/pasrChem1dToFoam_m
现在选项
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
当我尝试编译 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