Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of #98513 - ehuss:rebuild-llvm-download, r=Mark-Simulacrum
Fix LLVM rebuild with download-ci-llvm. This fixes an issue where updating a local checkout that includes a change in `src/version` causes a linking failure. The cause is that the `rustc_llvm` build script uses `rerun-if-changed` of `llvm-config` to know if it needs to rerun. Cargo only compares the timestamp of the last time the build script to the file. However, extracting the tar files retains the timestamps in the tarball which may be some time in the past. Since `src/version` is included in the LLVM `.so` filename, `rustc` attempts to load the wrong shared library since the `rustc_llvm` build script doesn't rerun. rust-lang/cargo#10791 contains a more detailed explanation. The solution here is a hack which updates the timestamp of `llvm-config` to the current time when it is extracted. This is a bit of a hack, but seems to be the best solution I can think of until rust-lang/cargo#10791 is fixed. There are likely several other situations where this is a problem (such as using system LLVM), and this isn't really a complete fix. Note that apple platforms are not directly affected by this problem because they don't have a version in the dylib filename. How to test this: 1. On a linux host, enable download-ci-llvm 2. Check out 7036449 (the commit just before the last version bump) 3. `./x.py build library/std` 4. Check out 5f015a2 (the commit that bumped the version) 5. `./x.py build library/std` Fixes #98495
- Loading branch information