* [langdale][master][PATCH v3] rust: Do not use default compiler flags defined in CC crate
@ 2022-12-20 11:24 Anton Antonov
2022-12-20 15:20 ` [OE-core] " Alexandre Belloni
0 siblings, 1 reply; 3+ messages in thread
From: Anton Antonov @ 2022-12-20 11:24 UTC (permalink / raw)
To: openembedded-core; +Cc: Anton.Antonov
Rust crates build dependecy C libraries using "CC" crate.
This crate adds some default compiler parameters depending on target arch.
For some target archs these parameters conflict with the parameters defined by OE.
Warnings/errors like this can be seen in the case:
cc1: error: switch '-mcpu=cortex-a15' conflicts with switch '-march=armv7-a+fp' [-Werror]
Lets use only the OE parameters by exporting CRATE_CC_NO_DEFAULTS.
https://github.com/rust-lang/cc-rs#external-configuration-via-environment-variables
This patch fixes https://bugzilla.yoctoproject.org/show_bug.cgi?id=14947
Signed-off-by: Anton Antonov <Anton.Antonov@arm.com>
---
meta/classes-recipe/rust-target-config.bbclass | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/meta/classes-recipe/rust-target-config.bbclass b/meta/classes-recipe/rust-target-config.bbclass
index 2710b4325d..5685897462 100644
--- a/meta/classes-recipe/rust-target-config.bbclass
+++ b/meta/classes-recipe/rust-target-config.bbclass
@@ -401,3 +401,16 @@ python do_rust_gen_targets () {
addtask rust_gen_targets after do_patch before do_compile
do_rust_gen_targets[dirs] += "${RUST_TARGETS_DIR}"
+# For building C dependecies use only compiler parameters defined in OE-core
+# and ignore the default parameters defined in the CC crate.
+# https://github.com/rust-lang/cc-rs#external-configuration-via-environment-variables
+
+# The CC crate checks for CRATE_CC_NO_DEFAULTS existence not value.
+# Even empty CRATE_CC_NO_DEFAULTS will be taken into account.
+# For rust native recipes we still rely on the CC crate parameters.
+# Currently it's not possible to export a variable conditionally,
+# so, let's export it for class-target only
+
+do_compile:prepend:class-target() {
+ export CRATE_CC_NO_DEFAULTS=1
+}
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [OE-core] [langdale][master][PATCH v3] rust: Do not use default compiler flags defined in CC crate
2022-12-20 11:24 [langdale][master][PATCH v3] rust: Do not use default compiler flags defined in CC crate Anton Antonov
@ 2022-12-20 15:20 ` Alexandre Belloni
2022-12-20 18:13 ` Anton Antonov
0 siblings, 1 reply; 3+ messages in thread
From: Alexandre Belloni @ 2022-12-20 15:20 UTC (permalink / raw)
To: Anton Antonov; +Cc: openembedded-core
Hello,
this fails on the autobuilders:
https://autobuilder.yoctoproject.org/typhoon/#/builders/64/builds/6362/steps/11/logs/stdio
https://autobuilder.yoctoproject.org/typhoon/#/builders/52/builds/6274/steps/12/logs/stdio
On 20/12/2022 11:24:59+0000, Anton Antonov wrote:
> Rust crates build dependecy C libraries using "CC" crate.
> This crate adds some default compiler parameters depending on target arch.
> For some target archs these parameters conflict with the parameters defined by OE.
>
> Warnings/errors like this can be seen in the case:
>
> cc1: error: switch '-mcpu=cortex-a15' conflicts with switch '-march=armv7-a+fp' [-Werror]
>
> Lets use only the OE parameters by exporting CRATE_CC_NO_DEFAULTS.
> https://github.com/rust-lang/cc-rs#external-configuration-via-environment-variables
>
> This patch fixes https://bugzilla.yoctoproject.org/show_bug.cgi?id=14947
>
> Signed-off-by: Anton Antonov <Anton.Antonov@arm.com>
> ---
> meta/classes-recipe/rust-target-config.bbclass | 13 +++++++++++++
> 1 file changed, 13 insertions(+)
>
> diff --git a/meta/classes-recipe/rust-target-config.bbclass b/meta/classes-recipe/rust-target-config.bbclass
> index 2710b4325d..5685897462 100644
> --- a/meta/classes-recipe/rust-target-config.bbclass
> +++ b/meta/classes-recipe/rust-target-config.bbclass
> @@ -401,3 +401,16 @@ python do_rust_gen_targets () {
> addtask rust_gen_targets after do_patch before do_compile
> do_rust_gen_targets[dirs] += "${RUST_TARGETS_DIR}"
>
> +# For building C dependecies use only compiler parameters defined in OE-core
> +# and ignore the default parameters defined in the CC crate.
> +# https://github.com/rust-lang/cc-rs#external-configuration-via-environment-variables
> +
> +# The CC crate checks for CRATE_CC_NO_DEFAULTS existence not value.
> +# Even empty CRATE_CC_NO_DEFAULTS will be taken into account.
> +# For rust native recipes we still rely on the CC crate parameters.
> +# Currently it's not possible to export a variable conditionally,
> +# so, let's export it for class-target only
> +
> +do_compile:prepend:class-target() {
> + export CRATE_CC_NO_DEFAULTS=1
> +}
> --
> 2.25.1
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#174846): https://lists.openembedded.org/g/openembedded-core/message/174846
> Mute This Topic: https://lists.openembedded.org/mt/95783763/3617179
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [alexandre.belloni@bootlin.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
--
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [langdale][master][PATCH v3] rust: Do not use default compiler flags defined in CC crate
2022-12-20 15:20 ` [OE-core] " Alexandre Belloni
@ 2022-12-20 18:13 ` Anton Antonov
0 siblings, 0 replies; 3+ messages in thread
From: Anton Antonov @ 2022-12-20 18:13 UTC (permalink / raw)
To: openembedded-core
[-- Attachment #1: Type: text/plain, Size: 219 bytes --]
Hi Alexandre,
It looks like in rust classes we don't define compiler parameter not only for native recipes, but for x86 targets also. I need to think about a different approach to fix the issue.
Cheers,
Anton
[-- Attachment #2: Type: text/html, Size: 266 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-12-20 18:13 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-12-20 11:24 [langdale][master][PATCH v3] rust: Do not use default compiler flags defined in CC crate Anton Antonov
2022-12-20 15:20 ` [OE-core] " Alexandre Belloni
2022-12-20 18:13 ` Anton Antonov
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.