View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0003931 | OpenFOAM | Bug | public | 2022-11-11 22:05 | 2022-11-22 02:00 |
Reporter | ningli | Assigned To | |||
Priority | normal | Severity | minor | Reproducibility | always |
Status | new | Resolution | open | ||
Platform | GNU/Linux | OS | RHEL/CentOS/Rocky Linux | OS Version | 8.x 9.x |
Product Version | 10 | ||||
Summary | 0003931: OpenFOAM-10 undefined symbols while compiling with Clang/AOCC | ||||
Description | We experienced link time errors while building OpenFOAM-10 with the Clang compiler or the AOCC compiler which is based upon Clang. This applies to both vanilla Clang (version 13/14 assessed) and AOCC 3.2/4.0. A typical error looks like: make[1]: Leaving directory '/home/ningli12/apps/OpenFOAM/org-10/AOCC+OpenMPI/OpenFOAM-10/applications/solvers/basic' wmake combustion make[1]: Entering directory '/home/ningli12/apps/OpenFOAM/org-10/AOCC+OpenMPI/OpenFOAM-10/applications/solvers/combustion' wmake chemFoam make[2]: Entering directory '/home/ningli12/apps/OpenFOAM/org-10/AOCC+OpenMPI/OpenFOAM-10/applications/solvers/combustion/chemFoam' clang++ -std=c++14 -m64 -pthread -Dlinux64 -DWM_ARCH_OPTION=64 -DWM_DP -DWM_LABEL_SIZE=64 -Wall -Wextra -Wold-style-cast -Wnon-virtual-dtor -Wno-unused-parameter -Wno-invalid-offsetof -Wno-undefined-var-template -O3 -march=znver3 -DNoRepository -ftemplate-depth-100 -I/home/ningli12/apps/OpenFOAM/org-10/AOCC+OpenMPI/OpenFOAM-10/src/physicalProperties/lnInclude -I/home/ningli12/apps/OpenFOAM/org-10/AOCC+OpenMPI/OpenFOAM-10/src/thermophysicalModels/specie/lnInclude -I/home/ningli12/apps/OpenFOAM/org-10/AOCC+OpenMPI/OpenFOAM-10/src/thermophysicalModels/reactionThermo/lnInclude -I/home/ningli12/apps/OpenFOAM/org-10/AOCC+OpenMPI/OpenFOAM-10/src/thermophysicalModels/basic/lnInclude -I/home/ningli12/apps/OpenFOAM/org-10/AOCC+OpenMPI/OpenFOAM-10/src/ODE/lnInclude -I/home/ningli12/apps/OpenFOAM/org-10/AOCC+OpenMPI/OpenFOAM-10/src/thermophysicalModels/chemistryModel/lnInclude -I/home/ningli12/apps/OpenFOAM/org-10/AOCC+OpenMPI/OpenFOAM-10/src/finiteVolume/lnInclude -I/home/ningli12/apps/OpenFOAM/org-10/AOCC+OpenMPI/OpenFOAM-10/src/meshTools/lnInclude -IlnInclude -I. -I/home/ningli12/apps/OpenFOAM/org-10/AOCC+OpenMPI/OpenFOAM-10/src/OpenFOAM/lnInclude -I/home/ningli12/apps/OpenFOAM/org-10/AOCC+OpenMPI/OpenFOAM-10/src/OSspecific/POSIX/lnInclude -fPIC -L/home/ningli12/apps/OpenFOAM/org-10/AOCC+OpenMPI/OpenFOAM-10/platforms/linux64ClangDPInt64Opt/lib/dummy -lPstream /home/ningli12/apps/OpenFOAM/org-10/AOCC+OpenMPI/OpenFOAM-10/platforms/linux64ClangDPInt64Opt/applications/solvers/combustion/chemFoam/chemFoam.o -L/home/ningli12/apps/OpenFOAM/org-10/AOCC+OpenMPI/OpenFOAM-10/platforms/linux64ClangDPInt64Opt/lib \ -lchemistryModel -lfiniteVolume -lmeshTools -lOpenFOAM -ldl \ -lm -o /home/ningli12/apps/OpenFOAM/org-10/AOCC+OpenMPI/OpenFOAM-10/platforms/linux64ClangDPInt64Opt/bin/chemFoam ld.lld: error: undefined symbol: Foam::fluidReactionThermo::New(Foam::fvMesh const&, Foam::word const&) >>> referenced by chemFoam.C The key problem here is that the LLVM 'lld' linker do not handle indirect shared library dependencies. A workaround is to use the GNU system linker by specifying '-Xlinker --add-needed -fuse-ld=ld' in 'LINKEXE' as '--add-needed' (also the equivalent '--copy-dt-needed-entries' flag) has the effect of recursively searching those indirect referenced shared libraries. However, this only works if 'ld.bfd' is the system linker. 'ld.gold' and 'lld' do not support this function. Alternatively I would have to patch the Make/options files of about 25 solvers/utilities with additional -l flags to get them linked properly with 'ld.gold' or 'lld'. I am aware of the decade old discussions in https://bugs.openfoam.org/view.php?id=685 on a similar subject. Do you have new opinions on how this should be dealt with after all these years? | ||||
Steps To Reproduce | Following the standard build procedure and using the rules defined in OpenFOAM-10/wmake/rules/linux64Clang/ is just fine. I had to add -L\$(FOAM_LIBBIN)\/dummy -lPstream to the LINKEXE flag too to avoid problems building some solvers. | ||||
Tags | No tags attached. | ||||
Date Modified | Username | Field | Change |
---|---|---|---|
2022-11-11 22:05 | ningli | New Issue |