Updated the Rust build to depend on Clang instead.
*Summary of discussion with the rust upstream about using latest LLVM instead of Rust maintained LLVM fork.
https://internals.rust-lang.org/t/can-we-use-proper-clang-instead-of-llvm-fork-what-rust-uses/23489
*Upstream LLVM is generally compatible:
- Rust does support building with upstream (vanilla) LLVM, especially the latest
major release and the one or two preceding ones.
https://rustc-dev-guide.rust-lang.org/backend/updating-llvm.html#updating-llvm
*Impact on Yocto Rust upgrades:
- Rust upgrades shall always check for updates on rust forked llvm and backport
the relevant patches to clang's llvm.
*Regarding the rust forked llvm local patches:
- There are no local patches on rust forked llvm other than the backported fixes
from llvm master.
*We now add these flags "-Clink-arg=-lz -Clink-arg=-lzstd" because of this following
diff otherwise we will get errors during link time.
Setup in rust-llvm
-DLLVM_ENABLE_ZLIB=OFF \
-DLLVM_ENABLE_ZSTD=OFF \
-DLLVM_ENABLE_FFI=OFF \
Setup in clang
-DLLVM_ENABLE_FFI=ON \
-DLLVM_ENABLE_ZSTD=ON \
*When multilibs enabled:
llvm-config expects static libraries to be located in the lib directory rather than
lib64. However, since LLVM is built as a non-multilib component, the lib directory
doesn't contain any library files. To accommodate this without breaking multilib
behavior, we copy the required library files appropriately.
Previously, when we depended on rust-llvm, this worked because we specified:
-DCMAKE_INSTALL_PREFIX:PATH=${libdir}/llvm-rust
With this setup, llvm-config was installed inside ${libdir}/llvm-rust, which included
its own bin and lib directories. Thus, llvm-config located in bin would correctly find
the libraries in the adjacent lib directory.
Even when multilib was enabled or not, llvm-config would still look for libraries under
lib in this structure, so everything functioned as expected.
*Changes needs to be done when llvm splits from clang:
In rust recipe:
Update the dependency from:
DEPENDS += "ninja-native clang" to DEPENDS += "ninja-native llvm"
In llvm recipe:
Apply the same changes that were made in the Clang recipe, as those
configurations have now been moved to the LLVM recipe after the split.