diff options
author | Anton Antonov <anton.antonov@arm.com> | 2023-01-03 14:36:39 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-01-12 23:08:58 +0000 |
commit | 755ee95a45a4a5e3f880b6143e755ec699194416 (patch) | |
tree | 15ba3c7e2986eadd1c5957e310b6ced97bf470d8 /meta/classes-recipe/rust-target-config.bbclass | |
parent | d5668a7fd4d33d0d1670baeef58385c3acf4becd (diff) | |
download | poky-755ee95a45a4a5e3f880b6143e755ec699194416.tar.gz |
rust: Do not use default compiler flags defined in CC crate
Rust crates build dependecy C libraries using "CC" crate.
This crate adds some default compiler parameters depending on target arch.
For some targets 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
(From OE-Core rev: 0c07089bdf7e0d7d8f37552db0bcd75f860979d9)
Signed-off-by: Anton Antonov <Anton.Antonov@arm.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes-recipe/rust-target-config.bbclass')
-rw-r--r-- | meta/classes-recipe/rust-target-config.bbclass | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/meta/classes-recipe/rust-target-config.bbclass b/meta/classes-recipe/rust-target-config.bbclass index 7fd7128bcf..939dd13d2f 100644 --- a/meta/classes-recipe/rust-target-config.bbclass +++ b/meta/classes-recipe/rust-target-config.bbclass | |||
@@ -404,3 +404,19 @@ python do_rust_gen_targets () { | |||
404 | addtask rust_gen_targets after do_patch before do_compile | 404 | addtask rust_gen_targets after do_patch before do_compile |
405 | do_rust_gen_targets[dirs] += "${RUST_TARGETS_DIR}" | 405 | do_rust_gen_targets[dirs] += "${RUST_TARGETS_DIR}" |
406 | 406 | ||
407 | # For building target C dependecies use only compiler parameters defined in OE | ||
408 | # and ignore the CC crate defaults which conflicts with OE ones in some cases. | ||
409 | # https://github.com/rust-lang/cc-rs#external-configuration-via-environment-variables | ||
410 | # Some CC crate compiler flags are still required. | ||
411 | # We apply them conditionally in rust wrappers. | ||
412 | |||
413 | CRATE_CC_FLAGS:class-native = "" | ||
414 | CRATE_CC_FLAGS:class-nativesdk = "" | ||
415 | CRATE_CC_FLAGS:class-target = " -ffunction-sections -fdata-sections -fPIC" | ||
416 | |||
417 | do_compile:prepend:class-target() { | ||
418 | export CRATE_CC_NO_DEFAULTS=1 | ||
419 | } | ||
420 | do_install:prepend:class-target() { | ||
421 | export CRATE_CC_NO_DEFAULTS=1 | ||
422 | } | ||