Skip to content

[mlir] -DLLVM_DISTRIBUTION_COMPONENTS=mlir_c_runner_utils seems to unnecessarily require installing MLIRSparseTensorRuntime #120902

@mgorny

Description

@mgorny

I'm finally working on packaging MLIR for Gentoo. The current main seems to work really great, for standalone builds and dylib installation both. However, there's one thing that seems wrong.

I'm using -DLLVM_DISTRIBUTION_COMPONENTS to skip installing the static libraries. However, if I include mlir_c_runner_utils shared library in them, CMake fails:

-- Configuring done (5.1s)
CMake Error: install(EXPORT "MLIRTargets" ...) includes target "mlir_c_runner_utils" which requires target "MLIRSparseTensorEnums" that is not in any export set.
CMake Error: install(EXPORT "MLIRTargets" ...) includes target "mlir_c_runner_utils" which requires target "MLIRSparseTensorRuntime" that is not in any export set.
-- Generating done (3.4s)
CMake Generate step failed.  Build files cannot be regenerated correctly.

Please correct me if I'm wrong, but if I understand correctly, MLIRSparseTensorRuntime is only used as an implementation detail of mlir_c_runner_utils and isn't used otherwise. So I don't think it should be necessary to install the static library at all, and something is going wrong within the build system dependencies.

My current (work-in-progress) CMake invocation is the following:

cmake -C /tmp/portage/llvm-core/mlir-20.0.0_pre20241221/work/mlir_build/gentoo_common_config.cmake -G Ninja -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_INSTALL_PREFIX=/usr/lib/llvm/20 -DLLVM_ROOT=/usr/lib/llvm/20 -DBUILD_SHARED_LIBS=OFF -DLLVM_BUILD_LLVM_DYLIB=ON -DMLIR_BUILD_MLIR_C_DYLIB=OFF -DMLIR_LINK_MLIR_DYLIB=ON -DMLIR_INCLUDE_TESTS=no -DLLVM_DISTRIBUTION_COMPONENTS=mlir-cmake-exports;mlir-headers;MLIR;mlir_arm_runner_utils;mlir_arm_sme_abi_stubs;mlir_async_runtime;mlir_c_runner_utils;mlir_float16_utils;mlir_runner_utils;mlir-cpu-runner;mlir-linalg-ods-yaml-gen;mlir-lsp-server;mlir-opt;mlir-pdll;mlir-pdll-lsp-server;mlir-query;mlir-reduce;mlir-rewrite;mlir-tblgen;mlir-translate;tblgen-lsp-server;tblgen-to-irdl; -DLLVM_BUILD_UTILS=ON -DPython3_EXECUTABLE=/usr/bin/python3.13 -DLLVM_BUILD_TOOLS=ON -DMLIR_ENABLE_CUDA_RUNNER=OFF -DMLIR_ENABLE_ROCM_RUNNER=OFF -DMLIR_ENABLE_SYCL_RUNNER=OFF -DMLIR_ENABLE_SPIRV_CPU_RUNNER=OFF -DMLIR_ENABLE_VULKAN_RUNNER=OFF -DMLIR_ENABLE_BINDINGS_PYTHON=OFF -DMLIR_INSTALL_AGGREGATE_OBJECTS=OFF -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_TOOLCHAIN_FILE=/tmp/portage/llvm-core/mlir-20.0.0_pre20241221/work/mlir_build/gentoo_toolchain.cmake /tmp/portage/llvm-core/mlir-20.0.0_pre20241221/work/mlir

Metadata

Metadata

Assignees

No one assigned

    Labels

    cmakeBuild system in general and CMake in particularmlir

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions