From: "Yann E. MORIN" <yann.morin.1998@free.fr>
To: Antoine Coutant <antoine.coutant@smile.fr>
Cc: sebastian.weyer@smile.fr, bernd@kuhls.net, romain.naour@smile.fr,
buildroot@buildroot.org
Subject: Re: [Buildroot] [PATCH v4 2/7] package/pkg-meson.mk: add rust cross-compiler support
Date: Wed, 7 Feb 2024 16:13:20 +0100 [thread overview]
Message-ID: <ZcOeEMfwX4XlRXO7@landeda> (raw)
In-Reply-To: <20240202093625.1409559-3-antoine.coutant@smile.fr>
Antoine, All,
On 2024-02-02 10:36 +0100, Antoine Coutant spake thusly:
> From: Romain Naour <romain.naour@smile.fr>
>
> This change is needed to be able to build target packages requiring
> rust. If a package has rust in its project or in an add_language()
> call in their meson.build file, meson will try to find a suitable
> compiler for this language[1]. If the language is classified as
> required but not found, it will abort the build.
>
> It is necessary to specify rust and rust_ld separately in
> support/misc/cross-compilation.conf.in. If you specify it in one line
> just as "rust", it will generate the following warning:
> WARNING: Please do not put -C linker= in your compiler command,
> set rust_ld=command in your cross file or use the RUST_LD environment
> variable, otherwise meson will override your selection.
>
> [1] https://mesonbuild.com/Reference-manual_functions.html#add_languages
>
> Signed-off-by: Romain Naour <romain.naour@smile.fr>
> Signed-off-by: Sebastian Weyer <sebastian.weyer@smile.fr>
> Signed-off-by: Antoine Coutant <antoine.coutant@smile.fr>
> ---
> package/pkg-meson.mk | 13 +++++++++++++
> support/misc/cross-compilation.conf.in | 2 ++
> 2 files changed, 15 insertions(+)
>
> diff --git a/package/pkg-meson.mk b/package/pkg-meson.mk
> index 65cabf23ba..25dd4f0d7f 100644
> --- a/package/pkg-meson.mk
> +++ b/package/pkg-meson.mk
> @@ -82,6 +82,16 @@ else
> PKG_MESON_TARGET_FC = /bin/false
> endif
>
> +ifeq ($(BR2_PACKAGE_HOST_RUSTC),y)
> +PKG_MESON_TARGET_RUSTC = $(HOST_DIR)/bin/rustc
> +PKG_MESON_TARGET_RUSTC_LINKER = $(notdir $(TARGET_CROSS))gcc
Why can't PKG_MESON_TARGET_RUSTC_LINKER be an absolute path, when
PKG_MESON_TARGET_RUSTC is one, and [...]
> +PKG_MESON_TARGET_RUSTC_TARGET_NAME = $(RUSTC_TARGET_NAME)
> +else
> +PKG_MESON_TARGET_RUSTC = /bin/false
> +PKG_MESON_TARGET_RUSTC_LINKER = /bin/false
[...] especially since here PKG_MESON_TARGET_RUSTC_LINKER is an absolute
path?
Regards,
Yann E. MORIN.
> +PKG_MESON_TARGET_RUSTC_TARGET_NAME =
> +endif
> +
> # Generates sed patterns for patching the cross-compilation.conf template,
> # since Flags might contain commas the arguments are passed indirectly by
> # variable name (stripped to deal with whitespaces).
> @@ -91,6 +101,7 @@ define PKG_MESON_CROSSCONFIG_SED
> -e "s%@TARGET_CXX@%$(PKG_MESON_TARGET_CXX)%g" \
> -e "s%@TARGET_AR@%$(TARGET_AR)%g" \
> -e "s%@TARGET_FC@%$(PKG_MESON_TARGET_FC)%g" \
> + -e "s%@TARGET_RUSTC@%$(PKG_MESON_TARGET_RUSTC)%g" \
> -e "s%@TARGET_STRIP@%$(TARGET_STRIP)%g" \
> -e "s%@TARGET_ARCH@%$(PKG_MESON_TARGET_CPU_FAMILY)%g" \
> -e "s%@TARGET_CPU@%$(GCC_TARGET_CPU)%g" \
> @@ -99,6 +110,8 @@ define PKG_MESON_CROSSCONFIG_SED
> -e "s%@TARGET_CFLAGS@%$(call make-sq-comma-list,$($(strip $(1))))%g" \
> -e "s%@TARGET_LDFLAGS@%$(call make-sq-comma-list,$($(strip $(3))))%g" \
> -e "s%@TARGET_CXXFLAGS@%$(call make-sq-comma-list,$($(strip $(2))))%g" \
> + -e "s%@TARGET_RUSTC_LINKER@%$(PKG_MESON_TARGET_RUSTC_LINKER)%g" \
> + -e "s%@RUSTC_TARGET_NAME@%$(PKG_MESON_TARGET_RUSTC_TARGET_NAME)%g" \
> -e "s%@BR2_CMAKE@%$(BR2_CMAKE)%g" \
> -e "s%@PKGCONF_HOST_BINARY@%$(HOST_DIR)/bin/pkgconf%g" \
> -e "s%@HOST_DIR@%$(HOST_DIR)%g" \
> diff --git a/support/misc/cross-compilation.conf.in b/support/misc/cross-compilation.conf.in
> index a58ab553d0..21cec10b82 100644
> --- a/support/misc/cross-compilation.conf.in
> +++ b/support/misc/cross-compilation.conf.in
> @@ -13,6 +13,8 @@ fortran = '@TARGET_FC@'
> pkg-config = '@PKGCONF_HOST_BINARY@'
> g-ir-compiler = '@STAGING_DIR@/usr/bin/g-ir-compiler'
> g-ir-scanner = '@STAGING_DIR@/usr/bin/g-ir-scanner'
> +rust = ['@TARGET_RUSTC@', '--target', '@RUSTC_TARGET_NAME@' ]
> +rust_ld = '@TARGET_RUSTC_LINKER@'
>
> [built-in options]
> c_args = [@TARGET_CFLAGS@]
> --
> 2.25.1
>
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot
--
.-----------------.--------------------.------------------.--------------------.
| Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ |
| +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
next prev parent reply other threads:[~2024-02-07 15:13 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-02 9:36 [Buildroot] [PATCH v4 0/7] Adding RustiCL Antoine Coutant
2024-02-02 9:36 ` [Buildroot] [PATCH v4 1/7] package/meson: bump version to 1.3.1 Antoine Coutant
2024-02-07 15:23 ` Yann E. MORIN
2024-02-07 15:30 ` Yann E. MORIN
2024-02-02 9:36 ` [Buildroot] [PATCH v4 2/7] package/pkg-meson.mk: add rust cross-compiler support Antoine Coutant
2024-02-07 15:13 ` Yann E. MORIN [this message]
2024-02-08 10:25 ` Antoine Coutant
2024-02-02 9:36 ` [Buildroot] [PATCH v4 3/7] package/spirv-llvm-translator: add target variant to provide LLVMSPIRVLib Antoine Coutant
2024-02-07 15:08 ` Yann E. MORIN
2024-02-07 15:15 ` Arnout Vandecappelle via buildroot
2024-02-02 9:36 ` [Buildroot] [PATCH v4 4/7] package/opencl-headers: new package Antoine Coutant
2024-02-07 15:58 ` Yann E. MORIN
2024-02-12 13:44 ` Antoine Coutant
2024-02-21 13:26 ` Antoine Coutant
2024-02-21 16:55 ` Antoine Coutant
2024-02-02 9:36 ` [Buildroot] [PATCH v4 5/7] package/opencl-icd-loader: " Antoine Coutant
2024-02-07 16:01 ` Yann E. MORIN
2024-02-12 14:19 ` Antoine Coutant
2024-02-02 9:36 ` [Buildroot] [PATCH v4 6/7] package/llvm-project: add opencl-c-base.h on target Antoine Coutant
2024-02-07 19:07 ` Yann E. MORIN
2024-02-12 14:54 ` Antoine Coutant
2024-02-02 9:36 ` [Buildroot] [PATCH v4 7/7] package/mesa3d: add RustiCL support Antoine Coutant
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZcOeEMfwX4XlRXO7@landeda \
--to=yann.morin.1998@free.fr \
--cc=antoine.coutant@smile.fr \
--cc=bernd@kuhls.net \
--cc=buildroot@buildroot.org \
--cc=romain.naour@smile.fr \
--cc=sebastian.weyer@smile.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox