Message ID | 20220805131252.3706794-12-richard.purdie@linuxfoundation.org |
---|---|
State | Accepted, archived |
Commit | f355e55c1fcef57f288279ffb47ebeb52a72b689 |
Headers | show |
Series | [01/29] nativesdk: Clear TUNE_FEATURES | expand |
On Fri, Aug 5, 2022 at 6:13 AM Richard Purdie <richard.purdie@linuxfoundation.org> wrote: > > We need llvm-config for the target but the cross compiled target binary is > no good. We can copy the native one into the target location where it will > then return the target values though. > > Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> > --- > meta/recipes-devtools/rust/rust.inc | 18 ++++++++++++++---- > 1 file changed, 14 insertions(+), 4 deletions(-) > > diff --git a/meta/recipes-devtools/rust/rust.inc b/meta/recipes-devtools/rust/rust.inc > index 30f2b71fe8c..47b76e725de 100644 > --- a/meta/recipes-devtools/rust/rust.inc > +++ b/meta/recipes-devtools/rust/rust.inc > @@ -18,7 +18,8 @@ export RUST_TARGET_PATH="${WORKDIR}/targets/" > export FORCE_CRATE_HASH="${BB_TASKHASH}" > > RUST_ALTERNATE_EXE_PATH ?= "${STAGING_LIBDIR}/llvm-rust/bin/llvm-config" > -export YOCTO_ALTERNATE_EXE_PATH = "${RUST_ALTERNATE_EXE_PATH}" > +RUST_ALTERNATE_EXE_PATH_NATIVE = "${STAGING_LIBDIR_NATIVE}/llvm-rust/bin/llvm-config" > + > export YOCTO_ALTERNATE_MULTILIB_NAME = "/${BASELIB}" > > # We don't want to use bitbakes vendoring because the rust sources do their > @@ -82,8 +83,9 @@ python do_configure() { > host_section = "target.{}".format(d.getVar('RUST_TARGET_SYS', True)) > config.add_section(host_section) > > - llvm_config = d.expand("${YOCTO_ALTERNATE_EXE_PATH}") > - config.set(host_section, "llvm-config", e(llvm_config)) > + llvm_config_target = d.expand("${RUST_ALTERNATE_EXE_PATH}") > + llvm_config_build = d.expand("${RUST_ALTERNATE_EXE_PATH_NATIVE}") > + config.set(host_section, "llvm-config", e(llvm_config_target)) > > config.set(host_section, "cxx", e(d.expand("${RUST_TARGET_CXX}"))) > config.set(host_section, "cc", e(d.expand("${RUST_TARGET_CC}"))) > @@ -93,7 +95,7 @@ python do_configure() { > build_section = "target.{}".format(d.getVar('SNAPSHOT_BUILD_SYS', True)) > config.add_section(build_section) > > - config.set(build_section, "llvm-config", e(llvm_config)) > + config.set(build_section, "llvm-config", e(llvm_config_build)) > > config.set(build_section, "cxx", e(d.expand("${RUST_BUILD_CXX}"))) > config.set(build_section, "cc", e(d.expand("${RUST_BUILD_CC}"))) > @@ -169,6 +171,14 @@ rust_runx () { > unset CXXFLAGS > unset CPPFLAGS > > + # Copy the natively built llvm-config into the target so we can run it. Horrible, > + # but works! > + if [ ${RUST_ALTERNATE_EXE_PATH_NATIVE} != ${RUST_ALTERNATE_EXE_PATH} ]; then > + mkdir -p `dirname ${RUST_ALTERNATE_EXE_PATH}` > + cp ${RUST_ALTERNATE_EXE_PATH_NATIVE} ${RUST_ALTERNATE_EXE_PATH} > + chrpath -d ${RUST_ALTERNATE_EXE_PATH} > + fi > + this is interesting. In meta-clang we have a different solution which uses wrapper for llvm-config but this seems interesting at the same time hacky but if it works. I will take a deeper look from clang's pov too. > oe_cargo_fix_env > > python3 src/bootstrap/bootstrap.py ${@oe.utils.parallel_make_argument(d, '-j %d')} "$@" --verbose > -- > 2.34.1 > > > -=-=-=-=-=-=-=-=-=-=-=- > Links: You receive all messages sent to this group. > View/Reply Online (#168946): https://lists.openembedded.org/g/openembedded-core/message/168946 > Mute This Topic: https://lists.openembedded.org/mt/92834390/1997914 > Group Owner: openembedded-core+owner@lists.openembedded.org > Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [raj.khem@gmail.com] > -=-=-=-=-=-=-=-=-=-=-=- >
diff --git a/meta/recipes-devtools/rust/rust.inc b/meta/recipes-devtools/rust/rust.inc index 30f2b71fe8c..47b76e725de 100644 --- a/meta/recipes-devtools/rust/rust.inc +++ b/meta/recipes-devtools/rust/rust.inc @@ -18,7 +18,8 @@ export RUST_TARGET_PATH="${WORKDIR}/targets/" export FORCE_CRATE_HASH="${BB_TASKHASH}" RUST_ALTERNATE_EXE_PATH ?= "${STAGING_LIBDIR}/llvm-rust/bin/llvm-config" -export YOCTO_ALTERNATE_EXE_PATH = "${RUST_ALTERNATE_EXE_PATH}" +RUST_ALTERNATE_EXE_PATH_NATIVE = "${STAGING_LIBDIR_NATIVE}/llvm-rust/bin/llvm-config" + export YOCTO_ALTERNATE_MULTILIB_NAME = "/${BASELIB}" # We don't want to use bitbakes vendoring because the rust sources do their @@ -82,8 +83,9 @@ python do_configure() { host_section = "target.{}".format(d.getVar('RUST_TARGET_SYS', True)) config.add_section(host_section) - llvm_config = d.expand("${YOCTO_ALTERNATE_EXE_PATH}") - config.set(host_section, "llvm-config", e(llvm_config)) + llvm_config_target = d.expand("${RUST_ALTERNATE_EXE_PATH}") + llvm_config_build = d.expand("${RUST_ALTERNATE_EXE_PATH_NATIVE}") + config.set(host_section, "llvm-config", e(llvm_config_target)) config.set(host_section, "cxx", e(d.expand("${RUST_TARGET_CXX}"))) config.set(host_section, "cc", e(d.expand("${RUST_TARGET_CC}"))) @@ -93,7 +95,7 @@ python do_configure() { build_section = "target.{}".format(d.getVar('SNAPSHOT_BUILD_SYS', True)) config.add_section(build_section) - config.set(build_section, "llvm-config", e(llvm_config)) + config.set(build_section, "llvm-config", e(llvm_config_build)) config.set(build_section, "cxx", e(d.expand("${RUST_BUILD_CXX}"))) config.set(build_section, "cc", e(d.expand("${RUST_BUILD_CC}"))) @@ -169,6 +171,14 @@ rust_runx () { unset CXXFLAGS unset CPPFLAGS + # Copy the natively built llvm-config into the target so we can run it. Horrible, + # but works! + if [ ${RUST_ALTERNATE_EXE_PATH_NATIVE} != ${RUST_ALTERNATE_EXE_PATH} ]; then + mkdir -p `dirname ${RUST_ALTERNATE_EXE_PATH}` + cp ${RUST_ALTERNATE_EXE_PATH_NATIVE} ${RUST_ALTERNATE_EXE_PATH} + chrpath -d ${RUST_ALTERNATE_EXE_PATH} + fi + oe_cargo_fix_env python3 src/bootstrap/bootstrap.py ${@oe.utils.parallel_make_argument(d, '-j %d')} "$@" --verbose
We need llvm-config for the target but the cross compiled target binary is no good. We can copy the native one into the target location where it will then return the target values though. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> --- meta/recipes-devtools/rust/rust.inc | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-)