diff options
| author | Jakub Beránek <berykubik@gmail.com> | 2025-09-11 18:35:15 +0200 |
|---|---|---|
| committer | Jakub Beránek <berykubik@gmail.com> | 2025-09-11 18:46:14 +0200 |
| commit | 256aa0d9414f52664dd6e9e97d90fe485a203630 (patch) | |
| tree | a7e96fff750a31df2b9f9241da1f40202ab03db1 /src | |
| parent | 5e33838ccad070f1536ed82336dd0133e2681233 (diff) | |
| download | rust-256aa0d9414f52664dd6e9e97d90fe485a203630.tar.gz rust-256aa0d9414f52664dd6e9e97d90fe485a203630.zip | |
Fix `libgccjit` symlink when we build GCC locally
Diffstat (limited to 'src')
| -rw-r--r-- | src/bootstrap/src/core/build_steps/gcc.rs | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/bootstrap/src/core/build_steps/gcc.rs b/src/bootstrap/src/core/build_steps/gcc.rs index 77c9622a9bf..717dea37e9e 100644 --- a/src/bootstrap/src/core/build_steps/gcc.rs +++ b/src/bootstrap/src/core/build_steps/gcc.rs @@ -32,6 +32,10 @@ pub struct GccOutput { impl GccOutput { /// Install the required libgccjit library file(s) to the specified `path`. pub fn install_to(&self, builder: &Builder<'_>, directory: &Path) { + if builder.config.dry_run() { + return; + } + // At build time, cg_gcc has to link to libgccjit.so (the unversioned symbol). // However, at runtime, it will by default look for libgccjit.so.0. // So when we install the built libgccjit.so file to the target `directory`, we add it there @@ -39,8 +43,16 @@ impl GccOutput { let mut target_filename = self.libgccjit.file_name().unwrap().to_str().unwrap().to_string(); target_filename.push_str(".0"); + // If we build libgccjit ourselves, then `self.libgccjit` can actually be a symlink. + // In that case, we have to resolve it first, otherwise we'd create a symlink to a symlink, + // which wouldn't work. + let actual_libgccjit_path = t!( + self.libgccjit.canonicalize(), + format!("Cannot find libgccjit at {}", self.libgccjit.display()) + ); + let dst = directory.join(target_filename); - builder.copy_link(&self.libgccjit, &dst, FileType::NativeLibrary); + builder.copy_link(&actual_libgccjit_path, &dst, FileType::NativeLibrary); } } |
