Skip to content

[flang] Fix finding system install of LLVM/Clang/MLIR in standalone builds #120914

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

Merged
merged 1 commit into from
Jan 9, 2025

Conversation

mgorny
Copy link
Member

@mgorny mgorny commented Dec 22, 2024

The changes in #87822 introduced a regression where Flang could no longer be built standalone without explicitly specifying all of LLVM_DIR, CLANG_DIR and MLIR_DIR. Restore the earlier logic that used these paths as hints, and supported finding system-wide LLVM install via default paths. Instead, make paths absolute after locating the packages, using the paths CMake determined.


@vzakhari, could you confirm that this doesn't break your use case?

…uilds

The changes in llvm#87822 introduced a regression where Flang could no
longer be built standalone without explicitly specifying all of
LLVM_DIR, CLANG_DIR and MLIR_DIR.  Restore the earlier logic that used
these paths as hints, and supported finding system-wide LLVM install
via default paths.  Instead, make paths absolute after locating
the packages, using the paths CMake determined.
@llvmbot llvmbot added the flang Flang issues not falling into any other category label Dec 22, 2024
Copy link
Contributor

@vzakhari vzakhari left a comment

Choose a reason for hiding this comment

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

Makes sense to me. Thanks!

@mgorny
Copy link
Member Author

mgorny commented Jan 9, 2025

Thanks!

@mgorny mgorny merged commit 8e12037 into llvm:main Jan 9, 2025
10 checks passed
@mgorny mgorny deleted the flang-standalone-cmake branch January 9, 2025 18:37
@luporl
Copy link
Contributor

luporl commented Jan 10, 2025

This broke flang-aarch64-out-of-tree: https://lab.llvm.org/buildbot/#/builders/53/builds/10501.

For some reason the commit doesn't appear in the changes tab, but I reproduced it locally and was to build flang standalone again when reverting this change.

@DavidSpickett
Copy link
Collaborator

For some reason the commit doesn't appear in the changes tab

This is a known issue with that bot, I never did figure out why it does that. Perhaps it triggers on changes to anything other than Flang, so it only lists those.

@mgorny
Copy link
Member Author

mgorny commented Jan 10, 2025

Now I'm confused. https://lab.llvm.org/buildbot/#/builders/53/builds/10577 seems to be building, yet I don't see any relevant changes?

@luporl
Copy link
Contributor

luporl commented Jan 10, 2025

Now I'm confused. https://lab.llvm.org/buildbot/#/builders/53/builds/10577 seems to be building

The failure happens in step 6. It first builds llvm, clang and mlir, and then the standalone flang.

mgorny added a commit that referenced this pull request Jan 10, 2025
…dalone builds (#120914)"

This reverts commit 8e12037.

It broke the flang-aarch64-out-of-tree buildbot.
@mgorny
Copy link
Member Author

mgorny commented Jan 10, 2025

Ah, sorry. Reverted now.

@mgorny mgorny restored the flang-standalone-cmake branch January 10, 2025 18:05
@vzakhari
Copy link
Contributor

Ah, sorry. Reverted now.

This change should be related: llvm/llvm-zorg#170
The relative paths have to be weird (i.e. relative to the src dir), so that find_package can work with them.

Sorry, it was long time ago, so I forgot about it.

@mgorny
Copy link
Member Author

mgorny commented Jan 10, 2025

I don't really want to break anyone's use cases, so I'm going to prepare a less intrusive patch tomorrow.

BaiXilin pushed a commit to BaiXilin/llvm-fix-vnni-instr-types that referenced this pull request Jan 12, 2025
…uilds (llvm#120914)

The changes in llvm#87822 introduced a regression where Flang could no
longer be built standalone without explicitly specifying all of
LLVM_DIR, CLANG_DIR and MLIR_DIR. Restore the earlier logic that used
these paths as hints, and supported finding system-wide LLVM install via
default paths. Instead, make paths absolute after locating the packages,
using the paths CMake determined.

-----

@vzakhari, could you confirm that this doesn't break your use case?
BaiXilin pushed a commit to BaiXilin/llvm-fix-vnni-instr-types that referenced this pull request Jan 12, 2025
…dalone builds (llvm#120914)"

This reverts commit 8e12037.

It broke the flang-aarch64-out-of-tree buildbot.
@mgorny mgorny deleted the flang-standalone-cmake branch January 12, 2025 14:07
mgorny added a commit to mgorny/llvm-project that referenced this pull request Jan 12, 2025
Support discovering LLVM, Clang and MLIR via the standard CMake logic
in addition to explicitly specified `LLVM_DIR`, etc.  To prevent
breaking anyone's workflow the way llvm#120914 did, this change explicitly
introduces two possible code paths based on variables provided:

1. If `LLVM_DIR`, etc. are defined, the current logic is used as-is.

2. If they are not defined, `find_package()` is called normally to
   discover the packages using the standard CMake logic,
   and the discovered paths are added
mgorny added a commit that referenced this pull request Jan 13, 2025
…122639)

Support discovering LLVM, Clang and MLIR via the standard CMake logic in
addition to explicitly specified `LLVM_DIR`, etc. To prevent breaking
anyone's workflow the way #120914 did, this change explicitly introduces
two possible code paths based on variables provided:

1. If `LLVM_DIR`, etc. are defined, the current logic is used as-is.

2. If they are not defined, `find_package()` is called normally to
discover the packages using the standard CMake logic, and the discovered
paths are added

---------

Co-authored-by: Slava Zakharin <[email protected]>
kazutakahirata pushed a commit to kazutakahirata/llvm-project that referenced this pull request Jan 13, 2025
…lvm#122639)

Support discovering LLVM, Clang and MLIR via the standard CMake logic in
addition to explicitly specified `LLVM_DIR`, etc. To prevent breaking
anyone's workflow the way llvm#120914 did, this change explicitly introduces
two possible code paths based on variables provided:

1. If `LLVM_DIR`, etc. are defined, the current logic is used as-is.

2. If they are not defined, `find_package()` is called normally to
discover the packages using the standard CMake logic, and the discovered
paths are added

---------

Co-authored-by: Slava Zakharin <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
flang Flang issues not falling into any other category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants