-
Notifications
You must be signed in to change notification settings - Fork 13k
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
llvm rebuilt 2 or more times if using src tarballs #61206
Comments
Closes: https://bugs.gentoo.org/686656 X-Upstream-Issue: rust-lang/rust#61206 Package-Manager: Portage-2.3.66, Repoman-2.3.12 Signed-off-by: Georgy Yakovlev <[email protected]>
#59303 (comment) says that only a no-op build should be performed in that case, looks like that isn't correct? |
second lld build is a no-op indeed. there is another bug here, probably related. after second rebuild, llvm install prefix somehow gets set to current build directory.
^ I can see this so probably something mutates some cmake knob and CMAKE_INSTALL_PREFIX, triggering full rebuild and setting wrong installation prefix as a side-effect. |
We had the same problem on FreeBSD during the 1.35.0 update. We've skipped the LLVM rebuild with this hack: https://svnweb.freebsd.org/ports/head/lang/rust/files/patch-src_bootstrap_native.rs?view=markup&pathrev=502416 |
This causes a tarball build, which normally takes about 11000 seconds for Suse's SLE, to take over 30000 seconds. |
Do you have any details how you're configuring the build, or how to reproduce this? I just tried the 1.37.0 tarball with the default config, and it only built LLVM once. I ran the build again and it tried LLVM again, but that was indeed a no-op build, only 6 seconds total. I also tried with |
@cuviper still patching 1.37, but I'll check it without patches and will attach my toml file. |
[llvm]
optimize = true
release-debuginfo = false
assertions = false
targets = "AMDGPU;PowerPC"
experimental-targets = ""
link-shared = false
[build]
build = "powerpc64le-unknown-linux-gnu"
host = ["powerpc64le-unknown-linux-gnu"]
target = ["powerpc64le-unknown-linux-gnu"]
cargo = "/var/tmp/portage/dev-lang/rust-1.37.0/work/rust-stage0/bin/cargo"
rustc = "/var/tmp/portage/dev-lang/rust-1.37.0/work/rust-stage0/bin/rustc"
docs = false
submodules = false
python = "python3.6"
locked-deps = true
vendor = true
extended = true
tools = ["rustfmt","rls","analysis","src","clippy","cargo",]
verbose = 2
[install]
prefix = "/usr"
libdir = "lib64/rust-1.37.0"
docdir = "share/doc/rust-1.37.0"
mandir = "share/rust-1.37.0/man"
[rust]
optimize = true
debug = false
debug-assertions = false
default-linker = "powerpc64le-unknown-linux-gnu-gcc"
channel = "stable"
rpath = false
lld = false
[target.powerpc64le-unknown-linux-gnu]
cc = "powerpc64le-unknown-linux-gnu-gcc"
cxx = "powerpc64le-unknown-linux-gnu-g++"
linker = "powerpc64le-unknown-linux-gnu-gcc"
ar = "powerpc64le-unknown-linux-gnu-ar" powerpc example, but it also happens on x86_64 looks like the second build happens on installation. the build is run using
contents of config.env: CFLAGS_powerpc64le-unknown-linux-gnu=-m64 and the installation command is
and the second rebuild actually happend while running x.py install I think it does not like full build logs attached. it's huge, some key points line 1416 - first llvm build
line 18006 - second llvm build triggered |
Yes, I do Red Hat packaging, so I'm familiar with how While it's annoying that the "internal" LLVM install ends up re-copied under
vs.
So I guess it's the difference of having your That said, I think we could just use an empty stamp file for non-git builds (from source tarball). This means we would never rebuild LLVM automatically, but it's probably fair to say that folks aren't doing LLVM development in such environments. We could still have a warning to explain that this is happening -- maybe print the path to the stamp file for manually removal to force it anew. |
AFAIK multiple rebuilds happen only for cross builds and I'm convinced cross compiling LLVM is screwed up in rustbuild. Running I'll open new issue for it when I find time to obtain logs, just wanted to make you aware of related bug. |
See #64156 for this. |
I can confirm that this helps on Solaris. Tested with Rust 1.35.0. Thank you! |
Assume non-git LLVM is fresh if the stamp file exists Rustbuild usually writes the LLVM submodule commit in a stamp file, so we can avoid rebuilding it unnecessarily. However, for builds from a source tarball (non-git), we were assuming a rebuild is always needed. This can cause a lot of extra work if any environment like `CFLAGS` changed between steps like build and install, which are often separate in distro builds. Now we also write an empty stamp file if the git commit is unknown, and its presence is trusted to indicate that no rebuild is needed. An info message reports that this is happening, along with the stamp file path that can be deleted to force a rebuild anyway. Fixes rust-lang#61206.
Assume non-git LLVM is fresh if the stamp file exists Rustbuild usually writes the LLVM submodule commit in a stamp file, so we can avoid rebuilding it unnecessarily. However, for builds from a source tarball (non-git), we were assuming a rebuild is always needed. This can cause a lot of extra work if any environment like `CFLAGS` changed between steps like build and install, which are often separate in distro builds. Now we also write an empty stamp file if the git commit is unknown, and its presence is trusted to indicate that no rebuild is needed. An info message reports that this is happening, along with the stamp file path that can be deleted to force a rebuild anyway. Fixes rust-lang#61206.
Assume non-git LLVM is fresh if the stamp file exists Rustbuild usually writes the LLVM submodule commit in a stamp file, so we can avoid rebuilding it unnecessarily. However, for builds from a source tarball (non-git), we were assuming a rebuild is always needed. This can cause a lot of extra work if any environment like `CFLAGS` changed between steps like build and install, which are often separate in distro builds. Now we also write an empty stamp file if the git commit is unknown, and its presence is trusted to indicate that no rebuild is needed. An info message reports that this is happening, along with the stamp file path that can be deleted to force a rebuild anyway. Fixes rust-lang#61206.
starting with 1.35.0 bootstrap always rebuilds llvm,
git could not determine the LLVM submodule commit hash. Assuming that an LLVM build is necessary.
so for downstream distributions and gentoo users (they build from tarballs) internal llvm copy is compiled at least twice per bootstrap, same for lld if it's enabled.
I believe this commit below is the reason:
#59303
The text was updated successfully, but these errors were encountered: