Skip to content
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 version is wrong / gathering historical LLVM version #127531

Open
simonLeary42 opened this issue Jul 9, 2024 · 1 comment
Open

LLVM version is wrong / gathering historical LLVM version #127531

simonLeary42 opened this issue Jul 9, 2024 · 1 comment
Labels
A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. C-discussion Category: Discussion or questions that doesn't represent real issues. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@simonLeary42
Copy link
Contributor

simonLeary42 commented Jul 9, 2024

I'm trying to build rust with the Spack package manager, but it seems that Spack's recipe is out of date. It says that the minimum Cmake version required is 3.13.4, but then the build fails because actually version 3.20.0 is required. INSTALL.md says that it's 3.13.4, but the rustc-dev-guide says that the minimum version is 3.4.3.

cd "/tmp/build/x86_64-unknown-linux-gnu/llvm/build" && \
CMAKE_PREFIX_PATH="/opt/rust-bootstrap-1.78.0:/opt/python-3.11.7:/opt/pkgconf-2.2.0:/opt/ninja-1.11.1:/opt/libgit2-1.7.2:/opt/pcre-8.45:/opt/libssh2-1.11.0:/opt/xz-5.4.6:/opt/openssl-3.3.0:/opt/zlib-ng-2.1.6:/opt/gcc-runtime-9.4.0" \
DESTDIR="" \
"cmake" \
"/tmp/src/llvm-project/llvm" \
"-G" \
"Ninja" \
"-DLLVM_ENABLE_ASSERTIONS=OFF" \
"-DLLVM_UNREACHABLE_OPTIMIZE=OFF" \
"-DLLVM_ENABLE_PLUGINS=OFF" \
"-DLLVM_TARGETS_TO_BUILD=AArch64;ARM;BPF;Hexagon;LoongArch;MSP430;Mips;NVPTX;PowerPC;RISCV;Sparc;SystemZ;WebAssembly;X86" \
"-DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=AVR;M68k;CSKY" \
"-DLLVM_INCLUDE_EXAMPLES=OFF" \
"-DLLVM_INCLUDE_DOCS=OFF" \
"-DLLVM_INCLUDE_BENCHMARKS=OFF" \
"-DLLVM_INCLUDE_TESTS=OFF" \
"-DLLVM_ENABLE_TERMINFO=OFF" \
"-DLLVM_ENABLE_LIBEDIT=OFF" \
"-DLLVM_ENABLE_BINDINGS=OFF" \
"-DLLVM_ENABLE_Z3_SOLVER=OFF" \
"-DLLVM_PARALLEL_COMPILE_JOBS=4" \
"-DLLVM_TARGET_ARCH=x86_64" \
"-DLLVM_DEFAULT_TARGET_TRIPLE=x86_64-unknown-linux-gnu" \
"-DLLVM_ENABLE_WARNINGS=OFF" \
"-DLLVM_INSTALL_UTILS=ON" \
"-DLLVM_ENABLE_ZSTD=OFF" \
"-DLLVM_ENABLE_ZLIB=ON" \
"-DLLVM_ENABLE_LIBXML2=OFF" \
"-DLLVM_VERSION_SUFFIX=-rust-1.78.0-nightly" \
"-DCMAKE_INSTALL_MESSAGE=LAZY" \
"-DCMAKE_C_COMPILER=/modules/spack/0.22/lib/spack/env/gcc/gcc" \
"-DCMAKE_CXX_COMPILER=/modules/spack/0.22/lib/spack/env/gcc/g++" \
"-DCMAKE_ASM_COMPILER=/modules/spack/0.22/lib/spack/env/gcc/gcc" \
"-DCMAKE_C_FLAGS=-ffunction-sections -fdata-sections -fPIC -m64" \
"-DCMAKE_CXX_FLAGS=-ffunction-sections -fdata-sections -fPIC -m64" \
"-DCMAKE_AR=/usr/bin/ar" \
"-DCMAKE_SHARED_LINKER_FLAGS=" \
"-DCMAKE_MODULE_LINKER_FLAGS=" \
"-DCMAKE_EXE_LINKER_FLAGS=" \
"-DCMAKE_INSTALL_PREFIX=/tmp/build/x86_64-unknown-linux-gnu/llvm" \
"-DCMAKE_ASM_FLAGS=-ffunction-sections -fdata-sections -fPIC -m64" \
"-DCMAKE_BUILD_TYPE=Release"

CMake Error at CMakeLists.txt:3 (cmake_minimum_required):
  CMake 3.20.0 or higher is required.  You are running version 3.16.3

I'm not very familiar with the rust bootstrap process. Spack downloads a rustc binary with a url similar to https://static.rust-lang.org/dist/rust-1.65.0-aarch64-apple-darwin.tar.gz, and then it runs x.py.

It seems that this Cmake requirement actually comes from LLVM. To fix the Spack recipe, I want to find out exactly which versions of rust require which versions of LLVM. I'm not sure when exactly LLVM is required at all, and I'm not sure if different LLVM versions are used depending on architecture/OS/ bootstrap toolchain. After quickly searching the source code, I wasn't able to find a very official looking definition of the LLVM version. I was able to find something in src/ci/docker/host-x86_64/dist-x86_64-linux/build-clang.sh, but just based on the file name I can't be so sure that the version number is used everywhere, or if it's even relevant to my Spack recipe.

Can someone point me to the location of the "canonical" LLVM version? From there I can use git blame to find which commit sets which version number, and github can tell me which release versions have which commits.

@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Jul 9, 2024
@Noratrieb
Copy link
Member

The "canonical" LLVM version is the one present in the src/llvm-project submodule that's used for (see the git-commit-hash file for the rustc hash to find that), or, more easily accessible, the one output by rustc -vV (which is LLVM 15.0.0 for 1.65.0) (the distributed LLVM in the tarball will be exactly the one from the submodule) (I don't know if spack wants to build the in-tree rustc LLVM version or whether it prefers taking its own global LLVM if that exists, I don't know how spack works). But we generally support up to 1 version back. So on master right now, rustc supports being compiled against LLVM 17 and LLVM 18 (see #122649 for the last bump).

As for the documented cmake version, yeah, those are not gonna be accurate. Feel free to PR fixes removing it from the dev guide and updating it in INSTALL.md.

@Noratrieb Noratrieb added A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) C-discussion Category: Discussion or questions that doesn't represent real issues. and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Jul 9, 2024
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Jul 9, 2024
documentation: update cmake version

Previously discussed here: rust-lang#127531
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Jul 9, 2024
documentation: update cmake version

Previously discussed here: rust-lang#127531
jhpratt added a commit to jhpratt/rust that referenced this issue Jul 10, 2024
documentation: update cmake version

Previously discussed here: rust-lang#127531
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Jul 10, 2024
documentation: update cmake version

Previously discussed here: rust-lang#127531
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Jul 10, 2024
Rollup merge of rust-lang#127532 - simonLeary42:patch-1, r=Nilstrieb

documentation: update cmake version

Previously discussed here: rust-lang#127531
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. C-discussion Category: Discussion or questions that doesn't represent real issues. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

3 participants