Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mlir: emit libMLIR.so for not-static host platforms #390756

Merged
merged 1 commit into from
Mar 21, 2025

Conversation

picostove
Copy link
Contributor

mlir piggybacks onto LLVM_BUILD_LLVM_DYLIB for determining if a shared libMLIR.so is emitted. This also fixes build failures in MLIR 20+ where tablegen'd files aren't generated.

In file included from /build/mlir-src-21.0.0-unstable-2025-03-09/mlir/include/mlir/IR/UseDefLists.h:16,
                 from /build/mlir-src-21.0.0-unstable-2025-03-09/mlir/include/mlir/IR/Value.h:17,
                 from /build/mlir-src-21.0.0-unstable-2025-03-09/mlir/include/mlir/IR/BlockSupport.h:16,
                 from /build/mlir-src-21.0.0-unstable-2025-03-09/mlir/include/mlir/IR/OperationSupport.h:18,
                 from /build/mlir-src-21.0.0-unstable-2025-03-09/mlir/include/mlir/IR/Dialect.h:17,
                 from /build/mlir-src-21.0.0-unstable-2025-03-09/mlir/tools/mlir-lsp-server/mlir-lsp-server.cpp:9:
/build/mlir-src-21.0.0-unstable-2025-03-09/mlir/include/mlir/IR/Location.h:145:10: fatal error: mlir/IR/BuiltinLocationAttributes.h.inc: No such file or directory
  145 | #include "mlir/IR/BuiltinLocationAttributes.h.inc"
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 25.05 Release Notes (or backporting 24.11 and 25.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

@RossComputerGuy
Copy link
Member

nixpkgs-review result

Generated using nixpkgs-review.

Command: nixpkgs-review pr 390756


aarch64-linux

✅ 10 packages built:
  • llvmPackages.mlir (llvmPackages_19.mlir)
  • llvmPackages.mlir.dev (llvmPackages_19.mlir.dev)
  • mlir_16 (llvmPackages_16.mlir)
  • mlir_16.dev (llvmPackages_16.mlir.dev)
  • mlir_17 (llvmPackages_17.mlir)
  • mlir_17.dev (llvmPackages_17.mlir.dev)
  • llvmPackages_18.mlir
  • llvmPackages_18.mlir.dev
  • llvmPackages_20.mlir
  • llvmPackages_20.mlir.dev

Copy link
Member

@RossComputerGuy RossComputerGuy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Builds on aarch64-linux, LGTM.

@jopejoe1
Copy link
Member

This looks like it would fix #389430

@jopejoe1 jopejoe1 linked an issue Mar 18, 2025 that may be closed by this pull request
3 tasks
@wegank wegank added 12.approvals: 1 This PR was reviewed and approved by one reputable person 12.approved-by: package-maintainer This PR was reviewed and approved by a maintainer listed in the package labels Mar 19, 2025
@@ -61,6 +61,8 @@ stdenv.mkDerivation rec {
"-DLLVM_ENABLE_DUMP=ON"
"-DLLVM_TABLEGEN_EXE=${buildLlvmTools.tblgen}/bin/llvm-tblgen"
"-DMLIR_TABLEGEN_EXE=${buildLlvmTools.tblgen}/bin/mlir-tblgen"
] ++ lib.optionals (!stdenv.hostPlatform.isStatic) [
"-DLLVM_BUILD_LLVM_DYLIB=ON"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Usually it's better to add these unconditionally using lib.cmakeBool unless we want to leave it to the default in other cases for some reason. In this case, I think we'd always want the dylib on non-static platforms, and never want it on static.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ack, made this unconditional with lib.cmakeBool

mlir piggybacks onto LLVM_BUILD_LLVM_DYLIB for determining if a
shared libMLIR.so is emitted. This also fixes build failures
in MLIR 20+ where tablegen'd files aren't generated.

In file included from /build/mlir-src-21.0.0-unstable-2025-03-09/mlir/include/mlir/IR/UseDefLists.h:16,
                 from /build/mlir-src-21.0.0-unstable-2025-03-09/mlir/include/mlir/IR/Value.h:17,
                 from /build/mlir-src-21.0.0-unstable-2025-03-09/mlir/include/mlir/IR/BlockSupport.h:16,
                 from /build/mlir-src-21.0.0-unstable-2025-03-09/mlir/include/mlir/IR/OperationSupport.h:18,
                 from /build/mlir-src-21.0.0-unstable-2025-03-09/mlir/include/mlir/IR/Dialect.h:17,
                 from /build/mlir-src-21.0.0-unstable-2025-03-09/mlir/tools/mlir-lsp-server/mlir-lsp-server.cpp:9:
/build/mlir-src-21.0.0-unstable-2025-03-09/mlir/include/mlir/IR/Location.h:145:10: fatal error: mlir/IR/BuiltinLocationAttributes.h.inc: No such file or directory
  145 | #include "mlir/IR/BuiltinLocationAttributes.h.inc"
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
@wegank wegank added 12.approvals: 2 This PR was reviewed and approved by two reputable people and removed 12.approvals: 1 This PR was reviewed and approved by one reputable person labels Mar 21, 2025
@RossComputerGuy
Copy link
Member

I think we're good to merge here, I'll merge it

@RossComputerGuy RossComputerGuy merged commit 5a72bdd into NixOS:master Mar 21, 2025
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.topic: llvm/clang Issues related to llvmPackages, clangStdenv and related 10.rebuild-darwin: 1-10 10.rebuild-linux: 1-10 12.approvals: 2 This PR was reviewed and approved by two reputable people 12.approved-by: package-maintainer This PR was reviewed and approved by a maintainer listed in the package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

mlir: missing libMLIR.so
5 participants