| Issue |
184209
|
| Summary |
LLVM 22.1.0 breaks projects that use `find_package(Clang CONFIG REQUIRED)` in their CMake files
|
| Labels |
clang
|
| Assignees |
|
| Reporter |
berolinux
|
Trying to build projects that use cmake and try to link to clang libraries doing `find_package(Clang CONFIG REQUIRED)` fail with LLVM 22.1.0 even if all libraries are installed:
```
CMake Error at CMakeLists.txt:77 (find_package):
Found package configuration file:
/usr/lib64/cmake/clang/ClangConfig.cmake
but it set Clang_FOUND to FALSE so package "Clang" is considered to be NOT
FOUND. Reason given by package:
The following imported targets are referenced, but are missing: MLIRIR
MLIRPass MLIRDLTIDialect MLIRDataLayoutInterfaces MLIRFuncDialect
MLIRLoopLikeInterface MLIROpenACCDialect MLIRLLVMDialect MLIRAnalysis
MLIRTransformUtils MLIRAffineAnalysis MLIRAffineDialect
MLIRAffineTransforms MLIRAffineTransformOps MLIRAffineUtils
MLIRAMDGPUDialect MLIRAMDGPUTransforms MLIRAMDGPUUtils MLIRAMXDialect
MLIRAMXTransforms MLIRArithDialect MLIRArithValueBoundsOpInterfaceImpl
MLIRArithTransforms MLIRArithUtils MLIRArmNeonDialect MLIRArmNeonTransforms
MLIRArmNeonVectorTransformOps MLIRArmSMEDialect MLIRArmSMETransforms
MLIRArmSVEDialect MLIRArmSVETransforms MLIRArmSVEVectorTransformOps
MLIRAsyncDialect MLIRAsyncTransforms MLIRBufferizationDialect
MLIRBufferizationPipelines MLIRBufferizationTransformOps
MLIRBufferizationTransforms MLIRComplexDialect MLIRControlFlowDialect
MLIRControlFlowTransforms MLIRDLTITransformOps MLIREmitCDialect
MLIREmitCTransforms MLIRFuncTransforms MLIRFuncTransformOps MLIRFuncUtils
MLIRGPUDialect MLIRGPUTransforms MLIRGPUTransformOps MLIRGPUPipelines
MLIRGPUUtils MLIRIndexDialect MLIRIRDL MLIRLinalgDialect
MLIRLinalgTransformOps MLIRLinalgTransforms MLIRLinalgUtils
MLIRLLVMIRTransforms MLIRNVVMDialect MLIRROCDLDialect MLIRVCIXDialect
MLIRXeVMDialect MLIRMathDialect MLIRMathTransforms MLIRMemRefDialect
MLIRMemRefTransformOps MLIRMemRefTransforms MLIRMemRefUtils
MLIRShardDialect MLIRShardTransforms MLIRMLProgramDialect
MLIRMLProgramTransforms MLIRMPIDialect MLIRNVGPUDialect MLIRNVGPUUtils
MLIRNVGPUTransformOps MLIRNVGPUTransforms MLIROpenACCAnalysis
MLIROpenACCUtils MLIROpenACCTransforms MLIROpenMPTransforms
MLIROpenMPDialect MLIRPDLDialect MLIRPDLInterpDialect
MLIRPtrMemorySpaceInterfaces MLIRPtrDialect MLIRQuantDialect
MLIRQuantTransforms MLIRQuantUtils MLIRSCFDialect MLIRSCFTransformOps
MLIRSCFTransforms MLIRSCFUtils MLIRShapeDialect MLIRShapeOpsTransforms
MLIRSMT MLIRSparseTensorDialect MLIRSparseTensorPipelines
MLIRSparseTensorTransformOps MLIRSparseTensorTransforms
MLIRSparseTensorUtils MLIRSPIRVDialect MLIRSPIRVModuleCombiner
MLIRSPIRVConversion MLIRSPIRVTransforms MLIRSPIRVUtils MLIRTensorDialect
MLIRTensorInferTypeOpInterfaceImpl MLIRTensorTilingInterfaceImpl
MLIRTensorTransforms MLIRTensorTransformOps MLIRTensorUtils MLIRTosaDialect
MLIRTosaShardingInterfaceImpl MLIRTosaTransforms
MLIRTransformDebugExtension MLIRTransformDialect
MLIRTransformDialectIRDLExtension MLIRTransformLoopExtension
MLIRTransformPDLExtension MLIRTransformSMTExtension
MLIRTransformDialectTransforms MLIRTransformTuneExtension
MLIRTransformDialectUtils MLIRUBDialect MLIRVectorDialect
MLIRVectorTransforms MLIRVectorTransformOps MLIRVectorUtils
MLIRWasmSSADialect MLIRX86VectorDialect MLIRX86VectorTransforms
MLIRX86VectorTransformOps MLIRX86VectorUtils MLIRXeGPUDialect
MLIRXeGPUTransforms MLIRXeGPUUtils MLIRXeGPUTransformOps MLIRSPIRVTarget
MLIRTargetLLVMIRTransforms MLIRNVVMTarget MLIRROCDLTarget MLIRXeVMTarget
MLIRTargetLLVMIRImport MLIRSupport MLIRTransforms
MLIRBuiltinToLLVMIRTranslation MLIRLLVMToLLVMIRTranslation
-- Configuring incomplete, errors occurred!
```
The problem is, that, even though all the MLIR libraries are installed, the CMake targets aren't found because the MLIR CMake files haven't been imported.
One possible fix is to just add `find_package(MLIR CONFIG REQUIRED)`, but I don't think external projects should have to care about Clang's dependencies.
This breaks, for example, doxygen, pyside6 and kdevelop.
I've solved this in OpenMandriva packaging with
https://github.com/OpenMandrivaAssociation/llvm/blob/master/clang-find-MLIR-deps.patch
but I'm not sure that's the 100% fix (does it need to be conditionalized? Can clang still be built without MLIR these days?), so I'm reporting it as a bug instead of a pull request. Obviously feel free to use the patch anyway.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs