Uh oh!
There was an error while loading. Please reload this page.
Allow macOS to build LLVM as shared library - #98418
Conversation
rust-highfive
commented
Jun 23, 2022
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @Mark-Simulacrum (or someone else) soon. Please see the contribution instructions for more information. |
jyn514
left a comment
There was a problem hiding this comment.
How likely is this to break? Has homebrew ever had to change the way they do this?
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
topjohnwu
commented
Jun 23, 2022
IMO, the workaround should be pretty stable. I'll be tracking closely whether LLVM has any upstream fixes as I'm building rustc regularly for the ONDK Project |
Mark-Simulacrum
commented
Jun 23, 2022
Has this been reported upstream to LLVM? Is there a reason to fix this in our code, vs. in LLVM? |
topjohnwu
commented
Jun 23, 2022
Yup, you can check out this comment. There is no response in upstream LLVM, which is why Homebrew decided to workaround the issue instead. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
jyn514
left a comment
There was a problem hiding this comment.
r=me with the dry_run check added
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
This comment has been minimized.
This comment has been minimized.
Create symlinks to workaround file missing error in llvm-config
jyn514
commented
Jun 24, 2022
@bors r+ |
bors
commented
Jun 24, 2022
📌 Commit b6e28b5 has been approved by |
Allow macOS to build LLVM as shared library Inspired by how [homebrew](https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/llvm.rb) builds and distributes llvm, here we manually create a symlink with a versioned dylib path to make `llvm-config` work properly. Note, the resulting `rustc` executable and `librustc_driver-<hash>.dylib` still links to the un-versioned `libLLVM.dylib` as expected when distributed in the final output. I have confirmed this by checking `otool -L` on both binaries. After the change, enabling `llvm.link-shared` and `llvm.thin-lto` will be possible on macOS.
…laumeGomez Rollup of 5 pull requests Successful merges: - rust-lang#97249 (`<details>`/`<summary>` UI fixes) - rust-lang#98418 (Allow macOS to build LLVM as shared library) - rust-lang#98460 (Use CSS variables to handle theming) - rust-lang#98497 (Improve some inference diagnostics) - rust-lang#98708 (rustdoc: fix 98690 Panic if invalid path for -Z persist-doctests) Failed merges: - rust-lang#98761 (more `need_type_info` improvements) r? `@ghost` `@rustbot` modify labels: rollup
Proper macOS libLLVM symlink when cross compiling Follow up of rust-lang#98418 When cross compiling on macOS with `llvm.link-shared` enabled, the symlink creation will fail after compiling LLVM for the target architecture, because it will attempt to create the symlink in the host LLVM directory, which was already created when being built. This commit changes the symlink path to the actual LLVM output. r? `@jyn514`
Inspired by how homebrew builds and distributes llvm, here we manually create a symlink with a versioned dylib path to make
llvm-configwork properly. Note, the resultingrustcexecutable andlibrustc_driver-<hash>.dylibstill links to the un-versionedlibLLVM.dylibas expected when distributed in the final output. I have confirmed this by checkingotool -Lon both binaries.After the change, enabling
llvm.link-sharedandllvm.thin-ltowill be possible on macOS.