On Mon, 2024-11-04 at 03:21 -0800, Hemraj, Deepthi via
lists.openembedded.org wrote:
> From: Deepthi Hemraj <[email protected]>
>
> [YOCTO #15061]
> Rust multilib sdks broken because of the conflicts between attempted
> installs of rust-cross-canadian for arm and aarch64.
>
> Arm and aarch64 target architectures are trying to install cargo.sh
> and rust.sh in the same path which resulted in the issue
>
> The modification installs the scripts in different folders based on
> the target acrhitecture and hence prevents the conflicts.
>
> Signed-off-by: Deepthi Hemraj <[email protected]>
> ---
> meta/recipes-devtools/rust/rust-cross-canadian.inc | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/meta/recipes-devtools/rust/rust-cross-canadian.inc
> b/meta/recipes-devtools/rust/rust-cross-canadian.inc
> index c34b839d15..81d46a45e0 100644
> --- a/meta/recipes-devtools/rust/rust-cross-canadian.inc
> +++ b/meta/recipes-devtools/rust/rust-cross-canadian.inc
> @@ -52,8 +52,8 @@ do_install () {
> chmod +x "$outfile"
> create_sdk_wrapper "${SYS_BINDIR}/target-rust-ccld-wrapper" "CC"
>
> - ENV_SETUP_DIR=${D}${base_prefix}/environment-setup.d
> - mkdir "${ENV_SETUP_DIR}"
> + ENV_SETUP_DIR=${D}${base_prefix}/environment-
> setup.d/${TRANSLATED_TARGET_ARCH}
> + mkdir -p "${ENV_SETUP_DIR}"
> RUST_ENV_SETUP_SH="${ENV_SETUP_DIR}/rust.sh"
>
> RUST_TARGET_TRIPLE=`echo ${RUST_TARGET_SYS} | tr '[:lower:]'
> '[:upper:]' | sed 's/-/_/g'`
> @@ -89,5 +89,5 @@ do_install () {
> EOF
> }
>
> -FILES:${PN} += "${base_prefix}/environment-setup.d"
> +FILES:${PN} += "${base_prefix}/environment-
> setup.d/${TRANSLATED_TARGET_ARCH}"
I was asked for more information about how to solve this problem. It
isn't something I can easily just answer, I need to go and look at
exactly what is going on.
In a qemux86-64 multilib build, looking at:
rust-cross-canadian-i686/1.79.0/image/usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-pokysdk-linux/environment-setup.d/cargo.sh
we have:
"""
export CARGO_HOME="$OECORE_TARGET_SYSROOT/home/cargo"
mkdir -p "$CARGO_HOME"
# Init the default target once, it might be otherwise user modified.
if [ ! -f "$CARGO_HOME/config" ]; then
touch "$CARGO_HOME/config"
echo "[build]" >> "$CARGO_HOME/config"
echo 'target = "'i686-pokymllib32-linux-gnu'"' >> "$CARGO_HOME/config"
echo '# TARGET_SYS' >> "$CARGO_HOME/config"
echo '[target.'i686-pokymllib32-linux-gnu']' >> "$CARGO_HOME/config"
echo 'linker = "target-rust-ccld"' >> "$CARGO_HOME/config"
fi
# Keep the below off as long as HTTP/2 is disabled.
export CARGO_HTTP_MULTIPLEXING=false
export
CARGO_HTTP_CAINFO="$OECORE_NATIVE_SYSROOT/etc/ssl/certs/ca-certificates.crt"
"""
and then at:
rust-cross-canadian-x86-64/1.79.0/image/usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-pokysdk-linux/environment-setup.d/cargo.sh
we have:
"""
export CARGO_HOME="$OECORE_TARGET_SYSROOT/home/cargo"
mkdir -p "$CARGO_HOME"
# Init the default target once, it might be otherwise user modified.
if [ ! -f "$CARGO_HOME/config" ]; then
touch "$CARGO_HOME/config"
echo "[build]" >> "$CARGO_HOME/config"
echo 'target = "'x86_64-poky-linux-gnu'"' >> "$CARGO_HOME/config"
echo '# TARGET_SYS' >> "$CARGO_HOME/config"
echo '[target.'x86_64-poky-linux-gnu']' >> "$CARGO_HOME/config"
echo 'linker = "target-rust-ccld"' >> "$CARGO_HOME/config"
fi
# Keep the below off as long as HTTP/2 is disabled.
export CARGO_HTTP_MULTIPLEXING=false
export
CARGO_HTTP_CAINFO="$OECORE_NATIVE_SYSROOT/etc/ssl/certs/ca-certificates.crt"
"""
I think I'd argue here that several bits of this are not target
specific (CARGO_HTTP_MULTIPLEXING, CARGO_HTTP_CAINFO) so these should
be being written out by nativesdk-cargo and not by a cross canadian
recipe. The build section of the cargo config file is also not target
specific so that could be handled there too.
The hard part is going to be to collect up the target specific pieces.
These are specific to the cross canadian variant so these do belong in
rust-cross-canadian. The target pieces don't contain paths or change at
runtime so I'd suggest they get written into files with
${RUST_TARGET_SYS} in their name so they don't clash. The script in
nativesdk-cargo can then collect up the entries from the multiple files
if it generates the CARGO_HOME/config file.
The rust.sh issue is similar:
$ cat
rust-cross-canadian-x86-64/1.79.0/image/usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-pokysdk-linux/environment-setup.d/rust.sh
export
CARGO_TARGET_X86_64_POKY_LINUX_GNU_RUSTFLAGS="--sysroot=$OECORE_TARGET_SYSROOT/usr
-C link-arg=--sysroot=$OECORE_TARGET_SYSROOT"
export
CARGO_TARGET_X86_64_POKYSDK_LINUX_GNU_RUNNER="$OECORE_NATIVE_SYSROOT/lib/ld-linux-x86-64.so.2"
export
RUST_TARGET_PATH="$OECORE_NATIVE_SYSROOT/usr/lib/x86_64-poky-linux/rustlib"
$ cat
rust-cross-canadian-i686/1.79.0/image/usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-pokysdk-linux/environment-setup.d/rust.sh
export
CARGO_TARGET_I686_POKYMLLIB32_LINUX_GNU_RUSTFLAGS="--sysroot=$OECORE_TARGET_SYSROOT/usr
-C link-arg=--sysroot=$OECORE_TARGET_SYSROOT"
export
CARGO_TARGET_X86_64_POKYSDK_LINUX_GNU_RUNNER="$OECORE_NATIVE_SYSROOT/lib/ld-linux-x86-64.so.2"
export
RUST_TARGET_PATH="$OECORE_NATIVE_SYSROOT/usr/lib/i686-pokymllib32-linux/rustlib"
One variable is the same in both cases so that could move to nativesdk-
rust. One has a different name so can easily handled by two different
filenames like your original patch here since those values don't
overlap. The problem is likely then RUST_TARGET_PATH. I'm not sure if
something like:
export
RUST_TARGET_PATH="${RUST_TARGET_PATH}:$OECORE_NATIVE_SYSROOT/usr/lib/i686-pokymllib32-linux/rustlib"
works and makes sense or whether these do need to be set depending upon
which SDK environment is being selected.
I'd also probably suggesting just having rust.sh and dropping cargo.sh
since having both doesn't really make much sense.
Hopefully that gives a better idea of how this should be fixed.
Cheers,
Richard
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#206797):
https://lists.openembedded.org/g/openembedded-core/message/206797
Mute This Topic: https://lists.openembedded.org/mt/109382983/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-