Failed to build root on OpenBSD, rootcling erred missing dynamic libraries and allDict.cxx.pch

This is a continuation of this thread.

[1/921] Generating G__MathCore.cxx, ../../lib/libMathCore_rdict.pcm, ../../lib/libMathCore.rootmap
FAILED: math/mathcore/G__MathCore.cxx lib/libMathCore_rdict.pcm lib/libMathCore.rootmap
cd /home/tuanhtrng/build/root-6.18/math/mathcore && /usr/local/bin/cmake -E env LD_LIBRARY_PATH=/home/tuanhtrng/build/root-6.18/lib: ROOTIGNOREPREFIX=1 /home/tuanhtrng/build/root-6.18/bin/rootcling -rootbuild -v2 -f G__MathCore.cxx -s /home/tuanhtrng/build/root-6.18/lib/libMathCore.so -m libCore_rdict.pcm -excludePath /home/tuanhtrng/src/root -excludePath /home/tuanhtrng/build/root-6.18 -rml libMathCore.so -rmf /home/tuanhtrng/build/root-6.18/lib/libMathCore.rootmap -I/home/tuanhtrng/src/root -I/home/tuanhtrng/build/root-6.18/etc/cling/ -I/home/tuanhtrng/build/root-6.18/include -I/home/tuanhtrng/src/root/math/mathcore/v7/inc -I/home/tuanhtrng/src/root/math/mathcore/inc -I/home/tuanhtrng/src/root/math/mathcore -I/usr/include -I/home/tuanhtrng/src/root/core/base/inc -I/home/tuanhtrng/src/root/core/clib/inc -I/home/tuanhtrng/src/root/core/cont/inc -I/home/tuanhtrng/src/root/core/foundation/inc -I/home/tuanhtrng/src/root/core/macosx/inc -I/home/tuanhtrng/src/root/core/unix/inc -I/home/tuanhtrng/src/root/core/winnt/inc -I/home/tuanhtrng/src/root/core/clingutils/inc -I/home/tuanhtrng/src/root/core/meta/inc -I/home/tuanhtrng/src/root/core/textinput/inc -writeEmptyRootPCM Fit/BasicFCN.h Fit/BinData.h Fit/Chi2FCN.h Fit/DataOptions.h Fit/DataRange.h Fit/FcnAdapter.h Fit/FitConfig.h Fit/FitData.h Fit/FitExecutionPolicy.h Fit/FitResult.h Fit/FitUtil.h Fit/Fitter.h Fit/LogLikelihoodFCN.h Fit/ParameterSettings.h Fit/PoissonLikelihoodFCN.h Fit/SparseData.h Fit/UnBinData.h Math/AdaptiveIntegratorMultiDim.h Math/AllIntegrationTypes.h Math/BasicMinimizer.h Math/BrentMethods.h Math/BrentMinimizer1D.h Math/BrentRootFinder.h Math/ChebyshevPol.h Math/Delaunay2D.h Math/DistFuncMathCore.h Math/DistSampler.h Math/DistSamplerOptions.h Math/Error.h Math/Factory.h Math/FitMethodFunction.h Math/Functor.h Math/GaussIntegrator.h Math/GaussLegendreIntegrator.h Math/GenAlgoOptions.h Math/GoFTest.h Math/IFunction.h Math/IFunctionfwd.h Math/IMinimizer1D.h Math/IOptions.h Math/IParamFunction.h Math/IParamFunctionfwd.h Math/IRootFinderMethod.h Math/Integrator.h Math/IntegratorMultiDim.h Math/IntegratorOptions.h Math/KDTree.h Math/LCGEngine.h Math/Math.h Math/MersenneTwisterEngine.h Math/MinimTransformFunction.h Math/MinimTransformVariable.h Math/Minimizer.h Math/MinimizerOptions.h Math/MinimizerVariableTransformation.h Math/MixMaxEngine.h Math/MultiDimParamFunctionAdapter.h Math/OneDimFunctionAdapter.h Math/ParamFunctor.h Math/PdfFunc.h Math/PdfFuncMathCore.h Math/ProbFunc.h Math/ProbFuncMathCore.h Math/QuantFunc.h Math/QuantFuncMathCore.h Math/Random.h Math/RandomFunctions.h Math/RichardsonDerivator.h Math/RootFinder.h Math/SpecFuncMathCore.h Math/StdEngine.h Math/TDataPoint.h Math/TDataPointN.h Math/TRandomEngine.h Math/Types.h Math/Util.h Math/VirtualIntegrator.h Math/WrappedFunction.h Math/WrappedParamFunction.h TComplex.h TKDTree.h TKDTreeBinning.h TMath.h TRandom.h TRandom1.h TRandom2.h TRandom3.h TRandomGen.h TStatistic.h VectorizedTMath.h /home/tuanhtrng/src/root/math/mathcore/inc/LinkDef.h
Error in <UnknownClass::FindDynamicLibrary>: /home/tuanhtrng/build/root-6.18/math/mathcore/libRIO[.so | .dll | .dylib | .sl | .dl | .a] does not exist in /home/tuanhtrng/build/root-6.18/lib:.:/home/tuanhtrng/build/root-6.18/lib
Error in <UnknownClass::FindDynamicLibrary>: /home/tuanhtrng/build/root-6.18/math/mathcore/libCling[.so | .dll | .dylib | .sl | .dl | .a] does not exist in /home/tuanhtrng/build/root-6.18/lib:.:/home/tuanhtrng/build/root-6.18/lib
error: unable to read PCH file /home/tuanhtrng/build/root-6.18/etc/allDict.cxx.pch: 'No such file or directory'
fatal error: PCH file '/home/tuanhtrng/build/root-6.18/etc/allDict.cxx.pch' not found: module file not found

Those dynamic libraries are available.

/home/tuanhtrng/build/root-6.18/lib/libCling.so
/home/tuanhtrng/build/root-6.18/lib/libRIO.so

Does FindDynamicLibrary fail to find the files?

Also, the missing PCH is puzzling. The top-level CMakeLists.txt indicates etc/allDict.cxx.pch depends on headers, linkdefs, and cppflags which cmake is trying to build.

What do you guys think?

Do you have a more specific error message for this? Try with a verbose build, please.

The verbose ninja build.

[1/921] cd /home/tuanhtrng/build/root-6.18/net/net && /usr/local/bin/cmake -E env LD_LIBRARY_PATH=/home/tuanhtrng/build/root-6.18/lib: ROOTIGNOREPREFIX=1 /home/tuanhtrng/build/root-6.18/bin/rootcling -rootbuild -v2 -f G__Net.cxx -s /home/tuanhtrng/build/root-6.18/lib/libNet.so -m libRIO_rdict.pcm -excludePath /home/tuanhtrng/src/root -excludePath /home/tuanhtrng/build/root-6.18 -rml libNet.so -rmf /home/tuanhtrng/build/root-6.18/lib/libNet.rootmap -I/home/tuanhtrng/src/root -I/home/tuanhtrng/build/root-6.18/etc/cling/ -I/home/tuanhtrng/build/root-6.18/include -I/home/tuanhtrng/src/root/net/net/inc -I/home/tuanhtrng/src/root/net/net -I/home/tuanhtrng/src/root/io/io/inc -I/home/tuanhtrng/src/root/core/clib/res -I/home/tuanhtrng/src/root/io/io/res -writeEmptyRootPCM -I NetErrors.h RRemoteProtocol.h TApplicationRemote.h TApplicationServer.h TFileStager.h TFTP.h TGrid.h TGridCollection.h TGridJDL.h TGridJob.h TGridJobStatus.h TGridJobStatusList.h TGridResult.h TMessage.h TMonitor.h TNetFile.h TNetFileStager.h TParallelMergingFile.h TPServerSocket.h TPSocket.h TSecContext.h TServerSocket.h TSocket.h TSQLColumnInfo.h TSQLMonitoring.h TSQLResult.h TSQLRow.h TSQLServer.h TSQLStatement.h TSQLTableInfo.h TUDPSocket.h TWebFile.h /home/tuanhtrng/src/root/net/net/inc/LinkDef.h
FAILED: net/net/G__Net.cxx lib/libNet_rdict.pcm lib/libNet.rootmap
cd /home/tuanhtrng/build/root-6.18/net/net && /usr/local/bin/cmake -E env LD_LIBRARY_PATH=/home/tuanhtrng/build/root-6.18/lib: ROOTIGNOREPREFIX=1 /home/tuanhtrng/build/root-6.18/bin/rootcling -rootbuild -v2 -f G__Net.cxx -s /home/tuanhtrng/build/root-6.18/lib/libNet.so -m libRIO_rdict.pcm -excludePath /home/tuanhtrng/src/root -excludePath /home/tuanhtrng/build/root-6.18 -rml libNet.so -rmf /home/tuanhtrng/build/root-6.18/lib/libNet.rootmap -I/home/tuanhtrng/src/root -I/home/tuanhtrng/build/root-6.18/etc/cling/ -I/home/tuanhtrng/build/root-6.18/include -I/home/tuanhtrng/src/root/net/net/inc -I/home/tuanhtrng/src/root/net/net -I/home/tuanhtrng/src/root/io/io/inc -I/home/tuanhtrng/src/root/core/clib/res -I/home/tuanhtrng/src/root/io/io/res -writeEmptyRootPCM -I NetErrors.h RRemoteProtocol.h TApplicationRemote.h TApplicationServer.h TFileStager.h TFTP.h TGrid.h TGridCollection.h TGridJDL.h TGridJob.h TGridJobStatus.h TGridJobStatusList.h TGridResult.h TMessage.h TMonitor.h TNetFile.h TNetFileStager.h TParallelMergingFile.h TPServerSocket.h TPSocket.h TSecContext.h TServerSocket.h TSocket.h TSQLColumnInfo.h TSQLMonitoring.h TSQLResult.h TSQLRow.h TSQLServer.h TSQLStatement.h TSQLTableInfo.h TUDPSocket.h TWebFile.h /home/tuanhtrng/src/root/net/net/inc/LinkDef.h
Error in <UnknownClass::FindDynamicLibrary>: /home/tuanhtrng/build/root-6.18/net/net/libRIO[.so | .dll | .dylib | .sl | .dl | .a] does not exist in /home/tuanhtrng/build/root-6.18/lib:.:/home/tuanhtrng/build/root-6.18/lib
Error in <UnknownClass::FindDynamicLibrary>: /home/tuanhtrng/build/root-6.18/net/net/libCling[.so | .dll | .dylib | .sl | .dl | .a] does not exist in /home/tuanhtrng/build/root-6.18/lib:.:/home/tuanhtrng/build/root-6.18/lib
error: unable to read PCH file /home/tuanhtrng/build/root-6.18/etc/allDict.cxx.pch: 'No such file or directory'
fatal error: PCH file '/home/tuanhtrng/build/root-6.18/etc/allDict.cxx.pch' not found: module file not found

 *** Break *** segmentation violation

The core dump.

#0  0x00000a2a3bb19fd9 in clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&) () from /home/tuanhtrng/build/root-6.18/lib/libCling.so

There is no clear error message, so it’s difficult to guess what’s wrong. Most likely rootcling is crashing due to unexpected code paths since you are building on OpenBSD. Please provide more details about how you configured ROOT, what options you passed to CMake, for example, and try to use -DCMAKE_BUILD_TYPE=Debug so we can see what is causing rootcling to fail.