-
Notifications
You must be signed in to change notification settings - Fork 13.3k
rustbuild: allow dynamically linking LLVM #37822
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
Conversation
The makefiles and `mklldeps.py` called `llvm-config --shared-mode` to find out if LLVM defaulted to shared or static libraries, and just went with that. But under rustbuild, `librustc_llvm/build.rs` was assuming that LLVM should be static, and even forcing `--link-static` for 3.9+. Now that build script also uses `--shared-mode` to learn the default, which should work better for pre-3.9 configured for dynamic linking, as it wasn't possible back then to choose differently via `llvm-config`. Further, the configure script now has a new `--enable-llvm-link-shared` option, which allows one to manually override `--link-shared` on 3.9+ instead of forcing static.
r? @eddyb (rust_highfive has picked a reviewer for you, use r? to override) |
Looks good to me! It appears though that |
Ah, I hadn't noticed that |
Ah ok, either's fine by me! |
There are now four static/shared scenarios that can happen for the supported LLVM versions: - 3.9+: By default use `llvm-config --link-static` - 3.9+ and `--enable-llvm-link-shared`: Use `--link-shared` instead. - 3.8: Use `llvm-config --shared-mode` and go with its answer. - 3.7: Just assume static, maintaining the status quo.
OK, that push will hopefully help 3.7, and I updated the PR summary with the four linking scenarios. |
Hmm, those latest travis jobs don't look like they actually tried anything... |
@bors: r+ Thanks! |
📌 Commit f324037 has been approved by |
⌛ Testing commit f324037 with merge b1da18f... |
rustbuild: allow dynamically linking LLVM The makefiles and `mklldeps.py` called `llvm-config --shared-mode` to find out if LLVM defaulted to shared or static libraries, and just went with that. But under rustbuild, `librustc_llvm/build.rs` was assuming that LLVM should be static, and even forcing `--link-static` for 3.9+. Now that build script also uses `--shared-mode` to learn the default, which should work better for pre-3.9 configured for dynamic linking, as it wasn't possible back then to choose differently via `llvm-config`. Further, the configure script now has a new `--enable-llvm-link-shared` option, which allows one to manually override `--link-shared` on 3.9+ instead of forcing static. Update: There are now four static/shared scenarios that can happen for the supported LLVM versions: - 3.9+: By default use `llvm-config --link-static` - 3.9+ and `--enable-llvm-link-shared`: Use `--link-shared` instead. - 3.8: Use `llvm-config --shared-mode` and go with its answer. - 3.7: Just assume static, maintaining the status quo.
The makefiles and
mklldeps.py
calledllvm-config --shared-mode
tofind out if LLVM defaulted to shared or static libraries, and just went
with that. But under rustbuild,
librustc_llvm/build.rs
was assumingthat LLVM should be static, and even forcing
--link-static
for 3.9+.Now that build script also uses
--shared-mode
to learn the default,which should work better for pre-3.9 configured for dynamic linking, as
it wasn't possible back then to choose differently via
llvm-config
.Further, the configure script now has a new
--enable-llvm-link-shared
option, which allows one to manually override
--link-shared
on 3.9+instead of forcing static.
Update: There are now four static/shared scenarios that can happen
for the supported LLVM versions:
llvm-config --link-static
--enable-llvm-link-shared
: Use--link-shared
instead.llvm-config --shared-mode
and go with its answer.