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

CMake: Do not specify LLVMSupport in LINK_LIBS. #2575

Merged
merged 2 commits into from
Oct 3, 2024

Conversation

bjacob
Copy link
Contributor

@bjacob bjacob commented Oct 3, 2024

This is a new take on #2573.

There, I was trying to fix CMake errors in the external build, with the error message saying that LINK_COMPONENTS should be used instead of LINK_LIBS for LLVM libraries. That change fixed my external build, but broke the standalone build on CI.

Reading the AddMLIR.cmake code generating the error, I came across this line:
https://github.com/llvm/llvm-project/blob/ee4dd147baff8f971f3ec5aad5a216ca9837a732/mlir/cmake/modules/AddMLIR.cmake#L287-L288

  # MLIR libraries uniformly depend on LLVMSupport.  Just specify it once here.
  list(APPEND ARG_LINK_COMPONENTS Support)

This looks like hardcoding always depending on LLVMSupport (though I wasn't quite sure about the nuance between Support and LLVMSupport). If that's correct, then we never needed specifying LLVMSupport in the first place. So I tried just omitting it, and that seems to work. WDYT?

Signed-off-by: Benoit Jacob <jacob.benoit.1@gmail.com>
@bjacob bjacob marked this pull request as ready for review October 3, 2024 14:33
@bjacob
Copy link
Contributor Author

bjacob commented Oct 3, 2024

@sdasgup3, @GleasonK : this supersedes #2573.

@GleasonK
Copy link
Member

GleasonK commented Oct 3, 2024

I think I added LLVMSupport for bazel build dep parity as opposed to actually needing to specify it, so yes looks like we don't need it. LGTM!

Signed-off-by: Benoit Jacob <jacob.benoit.1@gmail.com>
@bjacob
Copy link
Contributor Author

bjacob commented Oct 3, 2024

@GleasonK , please merge :-)

@GleasonK GleasonK merged commit 5f3c287 into openxla:main Oct 3, 2024
10 checks passed
bjacob added a commit to iree-org/iree that referenced this pull request Oct 3, 2024
No cherry-picks anymore, our PRs are in:
openxla/stablehlo#2576
openxla/stablehlo#2575
openxla/stablehlo#2572

Signed-off-by: Benoit Jacob <jacob.benoit.1@gmail.com>
GleasonK pushed a commit that referenced this pull request Oct 16, 2024
This fixes downstream build errors tracked at
iree-org/iree#18785.

Sample error message when building on Windows with MSVC:
```
FAILED: llvm-external-projects/stablehlo/stablehlo/dialect/CMakeFiles/obj.VhloOps.dir/VhloOps.cpp.obj
C:\ProgramData\Chocolatey\bin\ccache C:\PROGRA~1\MICROS~2\2022\ENTERP~1\VC\Tools\MSVC\1441~1.341\bin\Hostx64\x64\cl.exe  /nologo /TP -DGTEST_HAS_RTTI=0 -D_HAS_EXCEPTIONS=0 -D_USE_MATH_DEFINES -ID:\a\iree\iree\third_party\llvm-project\llvm\include -ID:\a\iree\iree\build-windows\llvm-project\include -ID:\a\iree\iree\third_party\llvm-project\mlir\include -ID:\a\iree\iree\third_party\stablehlo -ID:\a\iree\iree\build-windows\llvm-external-projects\stablehlo -ID:\a\iree\iree\third_party\llvm-project\lld\include -ID:\a\iree\iree\build-windows\llvm-project\tools\lld\include -external:I\..\mlir\include -external:ID:\a\iree\iree\build-windows\llvm-project\tools\mlir\include -external:W0 /DWIN32 /D_WINDOWS /EHsc /Z7 /O2 /Ob1  -std:c++17 -MD  /EHs-c- /GR- /showIncludes /Follvm-external-projects\stablehlo\stablehlo\dialect\CMakeFiles\obj.VhloOps.dir\VhloOps.cpp.obj /Fdllvm-external-projects\stablehlo\stablehlo\dialect\CMakeFiles\obj.VhloOps.dir\ /FS -c D:\a\iree\iree\third_party\stablehlo\stablehlo\dialect\VhloOps.cpp
cl : Command line warning D9025 : overriding '/EHs' with '/EHs-'
cl : Command line warning D9025 : overriding '/EHc' with '/EHc-'
D:\a\iree\iree\third_party\stablehlo\stablehlo\dialect\VhloOps.cpp : fatal error C1128: number of sections exceeded object file format limit: compile with /bigobj
```

I think our downstream Windows builds worked with
#2573 but they do not work with
#2575, without this change.
Hooray for compiler options whack-a-mole.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants