package/rust: install rustc and rust-std built by Buildroot
The test TestRust is currently broken with ripgrep package with the following error: error[E0514]: found crate `core` compiled by an incompatible version of rustc | = help: please recompile that crate using this compiler (rustc 1.58.1) (consider running `cargo clean` first) = note: the following crate versions were found: crate `core` compiled by rustc 1.58.1 (db9d1b20b 2022-01-20): TestRust/host/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-6cfcec236d576603.rlib error[E0514]: found crate `std` compiled by an incompatible version of rustc The problem is not really a cross-compilation issue (we are building for an armv7 target on x86_64 host) but a problem with rust-std libraries (rlib). We can notice that "rustc 1.58.1 (db9d1b20b 2022-01-20)" is the same version as the prebuilt rustc used to bootstrap the build: TestRust/host/bin/rustc --version rustc 1.58.1 TestRustBin/host/bin/rustc --version rustc 1.58.1 (db9d1b20b 2022-01-20) Indeed we are using host-rust-bin to bootstrap the host-rust compiler package built by Buildroot. The problem is that the libcore-6cfcec236d576603.rlib file come from host-rust-bin (rust-std) and is not removed before installing host-rust built by Buildroot. We actually spent a lot of time to build host-rust with rust-std and forget to install this important library HOST_DIR. Looking at the host-rust build directory we can notice two installer script "install.sh" (the same scripts used to install host-rust-bin): TestRust/build/host-rust-1.58.1/build/tmp/tarball/rust/x86_64-unknown-linux-gnu/rust-1.58.1-x86_64-unknown-linux-gnu/install.sh TestRust/build/host-rust-1.58.1/build/tmp/tarball/rust-std/armv7-unknown-linux-gnueabihf/rust-std-1.58.1-armv7-unknown-linux-gnueabihf/install.sh The "tarball" directory is generated by the "python x.py dist" during the install step, we have to keep it. Replace "python x.py install" by theses two install scripts. Installing rust-std with the install.sh script replace the rust-std libraries installed by host-rust-bin. Fixes: https://gitlab.com/buildroot.org/buildroot/-/jobs/2116202544 Signed-off-by: Romain Naour <romain.naour@gmail.com> Cc: Eric Le Bihan <eric.le.bihan.dev@free.fr> [Arnout: remove redundant parenthesis; only use a variable for the common install opts] Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
This commit is contained in:
parent
f0d1f21195
commit
1568249391
@ -67,9 +67,26 @@ define HOST_RUST_BUILD_CMDS
|
||||
cd $(@D); $(HOST_MAKE_ENV) $(HOST_DIR)/bin/python$(PYTHON3_VERSION_MAJOR) x.py build
|
||||
endef
|
||||
|
||||
HOST_RUST_INSTALL_OPTS = \
|
||||
--prefix=$(HOST_DIR) \
|
||||
--disable-ldconfig
|
||||
|
||||
define HOST_RUST_INSTALL_RUSTC
|
||||
cd $(@D)/build/tmp/tarball/rust/$(RUSTC_HOST_NAME)/rust-$(RUST_VERSION)-$(RUSTC_HOST_NAME); \
|
||||
./install.sh $(HOST_RUST_INSTALL_OPTS) --components=rustc,cargo,rust-std-$(RUSTC_HOST_NAME)
|
||||
endef
|
||||
|
||||
ifeq ($(BR2_PACKAGE_HOST_RUSTC_TARGET_ARCH_SUPPORTS),y)
|
||||
define HOST_RUST_INSTALL_LIBSTD_TARGET
|
||||
cd $(@D)/build/tmp/tarball/rust-std/$(RUSTC_TARGET_NAME)/rust-std-$(RUST_VERSION)-$(RUSTC_TARGET_NAME); \
|
||||
./install.sh $(HOST_RUST_INSTALL_OPTS)
|
||||
endef
|
||||
endif
|
||||
|
||||
define HOST_RUST_INSTALL_CMDS
|
||||
cd $(@D); $(HOST_MAKE_ENV) $(HOST_DIR)/bin/python$(PYTHON3_VERSION_MAJOR) x.py dist
|
||||
cd $(@D); $(HOST_MAKE_ENV) $(HOST_DIR)/bin/python$(PYTHON3_VERSION_MAJOR) x.py install
|
||||
$(HOST_RUST_INSTALL_RUSTC)
|
||||
$(HOST_RUST_INSTALL_LIBSTD_TARGET)
|
||||
endef
|
||||
|
||||
$(eval $(host-generic-package))
|
||||
|
Loading…
Reference in New Issue
Block a user