[OpenFOAM-6 adapter] Error during build: undefined symbols of dependencies

I tried this suggestion and built OpenFOAM and preCICE in a spack environment:

git clone -b develop https://github.com/spack/spack.git
source /gpfs/home/nkumar001/tools/spack/share/spack/setup-env.sh
spack env create foamPrecice
spack env activate -p foamPrecice
spack install openfoam-org@6 > log.install.openfoam6 2>&1
spack install precice ^boost@1.74.0 > log.install.precice 2>&1

Proceeding with building the adapter, I am seeing more undefined symbol errors in the ldd.log file:

undefined symbol: _ZN7precice15SolverInterfaceC1ERKSsS2_ii      (/gpfs/home/nkumar001/OpenFOAM/nkumar001-6/platforms/linux64GccDPInt32-spack/lib/libpreciceAdapterFunctionObject.so)
undefined symbol: _ZN7precice9constants22actionWriteInitialDataEv       (/gpfs/home/nkumar001/OpenFOAM/nkumar001-6/platforms/linux64GccDPInt32-spack/lib/libpreciceAdapterFunctionObject.so)
undefined symbol: _ZN7precice9constants29actionReadIterationCheckpointEv        (/gpfs/home/nkumar001/OpenFOAM/nkumar001-6/platforms/linux64GccDPInt32-spack/lib/libpreciceAdapterFunctionObject.so)
undefined symbol: _ZNK7precice15SolverInterface9getMeshIDERKSs  (/gpfs/home/nkumar001/OpenFOAM/nkumar001-6/platforms/linux64GccDPInt32-spack/lib/libpreciceAdapterFunctionObject.so)
undefined symbol: _ZN7precice9constants30actionWriteIterationCheckpointEv       (/gpfs/home/nkumar001/OpenFOAM/nkumar001-6/platforms/linux64GccDPInt32-spack/lib/libpreciceAdapterFunctionObject.so)
undefined symbol: _ZNK7precice15SolverInterface16isActionRequiredERKSs  (/gpfs/home/nkumar001/OpenFOAM/nkumar001-6/platforms/linux64GccDPInt32-spack/lib/libpreciceAdapterFunctionObject.so)
undefined symbol: _ZN7precice15SolverInterface19markActionFulfilledERKSs        (/gpfs/home/nkumar001/OpenFOAM/nkumar001-6/platforms/linux64GccDPInt32-spack/lib/libpreciceAdapterFunctionObject.so)
undefined symbol: _ZN4FoamlsERNS_7OstreamERKSs  (/gpfs/home/nkumar001/OpenFOAM/nkumar001-6/platforms/linux64GccDPInt32-spack/lib/libpreciceAdapterFunctionObject.so)
undefined symbol: _ZNK7precice15SolverInterface9getDataIDERKSsi (/gpfs/home/nkumar001/OpenFOAM/nkumar001-6/platforms/linux64GccDPInt32-spack/lib/libpreciceAdapterFunctionObject.so)

Here is the symbol table:

$ nm -D /gpfs/home/nkumar001/tools/spack/opt/spack/linux-centos7-skylake_avx512/gcc-7.3.0/precice-2.4.0-q6j6kdt5anho7gmelrzhjs3mjppmlibu/lib64/libprecice.so | grep precice15SolverInterface
00000000002e5440 T _ZN7precice15SolverInterface10initializeEv
00000000002e55e0 T _ZN7precice15SolverInterface11setMeshEdgeEiii
00000000002e5610 T _ZN7precice15SolverInterface11setMeshQuadEiiiii
00000000002e5630 T _ZN7precice15SolverInterface13mapReadDataToEi
00000000002e5590 T _ZN7precice15SolverInterface13setMeshVertexEiPKd
00000000002e5450 T _ZN7precice15SolverInterface14initializeDataEv
00000000002e55f0 T _ZN7precice15SolverInterface15setMeshTriangleEiiii
00000000002e55b0 T _ZN7precice15SolverInterface15setMeshVerticesEiiPKdPi
00000000002e56b0 T _ZN7precice15SolverInterface15writeScalarDataEiid
00000000002e5670 T _ZN7precice15SolverInterface15writeVectorDataEiiPKd
00000000002e5640 T _ZN7precice15SolverInterface16mapWriteDataFromEi
00000000002e54e0 T _ZN7precice15SolverInterface19markActionFulfilledERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
00000000002e5620 T _ZN7precice15SolverInterface20setMeshQuadWithEdgesEiiiii
00000000002e5690 T _ZN7precice15SolverInterface20writeBlockScalarDataEiiPKiPKd
00000000002e5650 T _ZN7precice15SolverInterface20writeBlockVectorDataEiiPKiPKd
00000000002e56c0 T _ZN7precice15SolverInterface23writeScalarGradientDataEiiPKd
00000000002e5680 T _ZN7precice15SolverInterface23writeVectorGradientDataEiiPKdb
00000000002e5600 T _ZN7precice15SolverInterface24setMeshTriangleWithEdgesEiiii
00000000002e56a0 T _ZN7precice15SolverInterface28writeBlockScalarGradientDataEiiPKiPKd
00000000002e5660 T _ZN7precice15SolverInterface28writeBlockVectorGradientDataEiiPKiPKdb
00000000002e5460 T _ZN7precice15SolverInterface7advanceEd
00000000002e5470 T _ZN7precice15SolverInterface8finalizeEv
00000000002e5280 T _ZN7precice15SolverInterfaceC1ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_ii
00000000002e5340 T _ZN7precice15SolverInterfaceC1ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_iiPv
00000000002e5280 T _ZN7precice15SolverInterfaceC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_ii
00000000002e5340 T _ZN7precice15SolverInterfaceC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_iiPv
00000000002e5410 T _ZN7precice15SolverInterfaceD1Ev
00000000002e5410 T _ZN7precice15SolverInterfaceD2Ev
00000000002e5510 T _ZNK7precice15SolverInterface10getMeshIDsEv
00000000002e5480 T _ZNK7precice15SolverInterface13getDimensionsEv
00000000002e5740 T _ZNK7precice15SolverInterface14readScalarDataEiidRd
00000000002e5730 T _ZNK7precice15SolverInterface14readScalarDataEiiRd
00000000002e5700 T _ZNK7precice15SolverInterface14readVectorDataEiidPd
00000000002e56f0 T _ZNK7precice15SolverInterface14readVectorDataEiiPd
00000000002e55c0 T _ZNK7precice15SolverInterface15getMeshVerticesEiiPKiPd
00000000002e54d0 T _ZNK7precice15SolverInterface16isActionRequiredERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
00000000002e55a0 T _ZNK7precice15SolverInterface17getMeshVertexSizeEi
00000000002e5490 T _ZNK7precice15SolverInterface17isCouplingOngoingEv
00000000002e54a0 T _ZNK7precice15SolverInterface19isReadDataAvailableEv
00000000002e54b0 T _ZNK7precice15SolverInterface19isWriteDataRequiredEd
00000000002e5720 T _ZNK7precice15SolverInterface19readBlockScalarDataEiiPKidPd
00000000002e5710 T _ZNK7precice15SolverInterface19readBlockScalarDataEiiPKiPd
00000000002e56e0 T _ZNK7precice15SolverInterface19readBlockVectorDataEiiPKidPd
00000000002e56d0 T _ZNK7precice15SolverInterface19readBlockVectorDataEiiPKiPd
00000000002e5750 T _ZNK7precice15SolverInterface19setMeshAccessRegionEiPKd
00000000002e54c0 T _ZNK7precice15SolverInterface20isTimeWindowCompleteEv
00000000002e5760 T _ZNK7precice15SolverInterface21getMeshVerticesAndIDsEiiPiPd
00000000002e5580 T _ZNK7precice15SolverInterface22hasToEvaluateFineModelEv
00000000002e5540 T _ZNK7precice15SolverInterface22isGradientDataRequiredEi
00000000002e5530 T _ZNK7precice15SolverInterface26isMeshConnectivityRequiredEi
00000000002e5570 T _ZNK7precice15SolverInterface27hasToEvaluateSurrogateModelEv
00000000002e55d0 T _ZNK7precice15SolverInterface29getMeshVertexIDsFromPositionsEiiPKdPi
00000000002e5550 T _ZNK7precice15SolverInterface7hasDataERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEi
00000000002e54f0 T _ZNK7precice15SolverInterface7hasMeshERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
00000000002e5560 T _ZNK7precice15SolverInterface9getDataIDERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEi
00000000002e5500 T _ZNK7precice15SolverInterface9getMeshIDERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
0000000000373250 W _ZNSt10unique_ptrIN7precice15SolverInterfaceESt14default_deleteIS1_EED1Ev
0000000000373250 W _ZNSt10unique_ptrIN7precice15SolverInterfaceESt14default_deleteIS1_EED2Ev

The GCC version for both OpenFOAM-6 and preCICE-2.4.0 is the same:
(OpenFOAM)

$ objdump -s --section .comment /gpfs/home/nkumar001/tools/spack/opt/spack/linux-centos7-skylake_avx512/gcc-7.3.0/openfoam-org-6-ssbibujof7mzwyo2gsjdlsoskflx5axr/platforms/linux64GccDPInt32-spack/lib/libfiniteVolume.so

/gpfs/home/nkumar001/tools/spack/opt/spack/linux-centos7-skylake_avx512/gcc-7.3.0/openfoam-org-6-ssbibujof7mzwyo2gsjdlsoskflx5axr/platforms/linux64GccDPInt32-spack/lib/libfiniteVolume.so:     file format elf64-x86-64

Contents of section .comment:
 0000 4743433a 2028474e 55292037 2e332e30  GCC: (GNU) 7.3.0
 0010 00

(preCICE)

$ objdump -s --section .comment /gpfs/home/nkumar001/tools/spack/opt/spack/linux-centos7-skylake_avx512/gcc-7.3.0/precice-2.4.0-q6j6kdt5anho7gmelrzhjs3mjppmlibu/lib64/libprecice.so

/gpfs/home/nkumar001/tools/spack/opt/spack/linux-centos7-skylake_avx512/gcc-7.3.0/precice-2.4.0-q6j6kdt5anho7gmelrzhjs3mjppmlibu/lib64/libprecice.so:     file format elf64-x86-64

Contents of section .comment:
 0000 4743433a 2028474e 55292037 2e332e30  GCC: (GNU) 7.3.0
 0010 00

Is there something else I can check and try to fix this error?

ldd.log (14.0 KB)
wmake.log (74.9 KB)