Coder Social home page Coder Social logo

Comments (4)

anta5010 avatar anta5010 commented on August 17, 2024 1

Discussion on oe-core@:
https://lists.openembedded.org/g/openembedded-core/topic/94539875

a bug to follow the discussion:
https://bugzilla.yoctoproject.org/show_bug.cgi?id=14947

from parsec.

anta5010 avatar anta5010 commented on August 17, 2024

the problem is with compiling mbedcrypto. something defines conflict compiler parameters:

2022-10-21 13:51:24 - INFO     - |   -- Build files have been written to: /home/gitlab-runner/builds/CAxQb6fJ/0/akuster/meta-security/build/tmp/work/cortexa15t2hf-neon-poky-linux-gnueabi/parsec-service/1.1.0-r0/build/target/armv7-poky-linux-gnueabihf/release/build/psa-crypto-sys-27138bbd20e170af/out/build
2022-10-21 13:51:24 - INFO     - |   running: "cmake" "--build" "." "--target" "install" "--config" "Release" "--"
2022-10-21 13:51:24 - INFO     - |   [  1%] Building C object library/CMakeFiles/mbedcrypto.dir/aesni.c.o
2022-10-21 13:51:24 - INFO     - |   [  3%] Building C object library/CMakeFiles/mbedcrypto.dir/asn1write.c.o
2022-10-21 13:51:24 - INFO     - |   [  3%] Building C object library/CMakeFiles/mbedcrypto.dir/aria.c.o
2022-10-21 13:51:24 - INFO     - |   [  5%] Building C object library/CMakeFiles/mbedcrypto.dir/base64.c.o
2022-10-21 13:51:24 - INFO     - |   [  5%] Building C object library/CMakeFiles/mbedcrypto.dir/aes.c.o
2022-10-21 13:51:24 - INFO     - |   [  6%] Building C object library/CMakeFiles/mbedcrypto.dir/bignum.c.o
2022-10-21 13:51:24 - INFO     - |   [  7%] Building C object library/CMakeFiles/mbedcrypto.dir/asn1parse.c.o
2022-10-21 13:51:24 - INFO     - |   [  8%] Building C object library/CMakeFiles/mbedcrypto.dir/ccm.c.o
2022-10-21 13:51:24 - INFO     - |   [ 10%] Building C object library/CMakeFiles/mbedcrypto.dir/camellia.c.o
2022-10-21 13:51:24 - INFO     - |
2022-10-21 13:51:24 - INFO     - |   --- stderr
2022-10-21 13:51:24 - INFO     - |   CMake Warning:
2022-10-21 13:51:24 - INFO     - |     Manually-specified variables were not used by the project:
2022-10-21 13:51:24 - INFO     - |
2022-10-21 13:51:24 - INFO     - |       CMAKE_ASM_COMPILER
2022-10-21 13:51:24 - INFO     - |       CMAKE_ASM_FLAGS
2022-10-21 13:51:24 - INFO     - |       CMAKE_CXX_COMPILER
2022-10-21 13:51:24 - INFO     - |       CMAKE_CXX_FLAGS
2022-10-21 13:51:24 - INFO     - |
2022-10-21 13:51:24 - INFO     - |
2022-10-21 13:51:24 - INFO     - |   cc1: error: switch '-mcpu=cortex-a15' conflicts with switch '-march=armv7-a+fp' [-Werror]
2022-10-21 13:51:24 - INFO     - |   cc1: error: switch '-mcpu=cortex-a15' conflicts with switch '-march=armv7-a+fp' [-Werror]
2022-10-21 13:51:24 - INFO     - |   cc1: error: switch '-mcpu=cortex-a15' conflicts with switch '-march=armv7-a+fp' [-Werror]
2022-10-21 13:51:24 - INFO     - |   cc1: error: switch '-mcpu=cortex-a15' conflicts with switch '-march=armv7-a+fp' [-Werror]
2022-10-21 13:51:24 - INFO     - |   cc1: error: switch '-mcpu=cortex-a15' conflicts with switch '-march=armv7-a+fp' [-Werror]
2022-10-21 13:51:24 - INFO     - |   cc1: error: switch '-mcpu=cortex-a15' conflicts with switch '-march=armv7-a+fp' [-Werror]
2022-10-21 13:51:24 - INFO     - |   cc1: error: switch '-mcpu=cortex-a15' conflicts with switch '-march=armv7-a+fp' [-Werror]
2022-10-21 13:51:24 - INFO     - |   cc1: error: switch '-mcpu=cortex-a15' conflicts with switch '-march=armv7-a+fp' [-Werror]
2022-10-21 13:51:24 - INFO     - |   cc1: error: switch '-mcpu=cortex-a15' conflicts with switch '-march=armv7-a+fp' [-Werror]
2022-10-21 13:51:24 - INFO     - |   cc1: all warnings being treated as errors
2022-10-21 13:51:24 - INFO     - |   make[2]: *** [library/CMakeFiles/mbedcrypto.dir/build.make:90: library/CMakeFiles/mbedcrypto.dir/aesni.c.o] Error 1
2022-10-21 13:51:24 - INFO     - |   make[2]: *** Waiting for unfinished jobs....
2022-10-21 13:51:24 - INFO     - |   cc1: all warnings being treated as errors
2022-10-21 13:51:24 - INFO     - |   make[2]: *** [library/CMakeFiles/mbedcrypto.dir/build.make:118: library/CMakeFiles/mbedcrypto.dir/asn1parse.c.o] Error 1
2022-10-21 13:51:24 - INFO     - |   cc1: all warnings being treated as errors
2022-10-21 13:51:24 - INFO     - |   cc1: all warnings being treated as errors
2022-10-21 13:51:24 - INFO     - |   make[2]: *** [library/CMakeFiles/mbedcrypto.dir/build.make:146: library/CMakeFiles/mbedcrypto.dir/base64.c.o] Error 1
2022-10-21 13:51:24 - INFO     - |   make[2]: *** [library/CMakeFiles/mbedcrypto.dir/build.make:132: library/CMakeFiles/mbedcrypto.dir/asn1write.c.o] Error 1
2022-10-21 13:51:24 - INFO     - |   cc1: all warnings being treated as errors
2022-10-21 13:51:24 - INFO     - |   make[2]: *** [library/CMakeFiles/mbedcrypto.dir/build.make:188: library/CMakeFiles/mbedcrypto.dir/ccm.c.o] Error 1
2022-10-21 13:51:24 - INFO     - |   cc1: all warnings being treated as errors
2022-10-21 13:51:24 - INFO     - |   make[2]: *** [library/CMakeFiles/mbedcrypto.dir/build.make:104: library/CMakeFiles/mbedcrypto.dir/aria.c.o] Error 1
2022-10-21 13:51:24 - INFO     - |   cc1: all warnings being treated as errors
2022-10-21 13:51:24 - INFO     - |   make[2]: *** [library/CMakeFiles/mbedcrypto.dir/build.make:174: library/CMakeFiles/mbedcrypto.dir/camellia.c.o] Error 1
2022-10-21 13:51:24 - INFO     - |   cc1: all warnings being treated as errors
2022-10-21 13:51:24 - INFO     - |   make[2]: *** [library/CMakeFiles/mbedcrypto.dir/build.make:76: library/CMakeFiles/mbedcrypto.dir/aes.c.o] Error 1
2022-10-21 13:51:24 - INFO     - |   cc1: all warnings being treated as errors
2022-10-21 13:51:24 - INFO     - |   make[2]: *** [library/CMakeFiles/mbedcrypto.dir/build.make:160: library/CMakeFiles/mbedcrypto.dir/bignum.c.o] Error 1
2022-10-21 13:51:24 - INFO     - |   make[1]: *** [CMakeFiles/Makefile2:166: library/CMakeFiles/mbedcrypto.dir/all] Error 2
2022-10-21 13:51:24 - INFO     - |   make: *** [Makefile:136: all] Error 2
2022-10-21 13:51:24 - INFO     - |   thread 'main' panicked at '
2022-10-21 13:51:24 - INFO     - |   command did not execute successfully, got: exit status: 2

from parsec.

anta5010 avatar anta5010 commented on August 17, 2024

After this change (using RUST_HOST_SYS instead of HOST_SYS): yoctoproject/poky@5c45b73 builds of parsec-service recipe for qemuarm machine started to fail.

This is the cargo build command before the change:

cargo build -v --target arm-poky-linux-gnueabi 

and this is after:

cargo build -v --target armv7-poky-linux-gnueabihf

The problem is that some Rust crates build dependency C libraries using "cc-rs" crate.
This crate adds some compiler parameters depending on target “arch” and for “armv7" these parameters conflicts with compiler parameter defined by Yocto via TUNE_CCARGS:
https://github.com/rust-lang/cc-rs/blob/53fb72c87e5769a299f1886ead831901b9c775d6/src/lib.rs#L1700

We noticed it with qemuarm, but there might be other conflicts as well. (If -Werror is used then builds would fail, otherwise it would be just a warning which is easy to miss)

To fix the issue in our parsec-service recipe we can define “CRATE_CC_NO_DEFAULTS” env variable which disables adding compiler flags in "cc-rs":
https://github.com/rust-lang/cc-rs#external-configuration-via-environment-variables

diff --git a/meta-parsec/recipes-parsec/parsec-service/parsec-service_1.1.0.bb b/meta-parsec/recipes-parsec/parsec-service/parsec-service_1.1.0.bb
index 218b776..c046906 100644
--- a/meta-parsec/recipes-parsec/parsec-service/parsec-service_1.1.0.bb
+++ b/meta-parsec/recipes-parsec/parsec-service/parsec-service_1.1.0.bb
@@ -25,6 +25,14 @@ PACKAGECONFIG[TS] = "trusted-service-provider,,libts,libts"
 PARSEC_FEATURES = "${@d.getVar('PACKAGECONFIG_CONFARGS',True).strip().replace(' ', ',')}"
 CARGO_BUILD_FLAGS += " --features ${PARSEC_FEATURES}"

+# OE passes the right options via compiler cmdline via TUNE_CCARGS.
+# There might be conflicts between Yocto settings and complier settings
+# defined in cc-rs rust crate used for compiling C libraries.
+# Lets depend on Yocto settings instead of setting it explicitly in cc-rs.
+
+CRATE_CC_NO_DEFAULTS ?= "true"
+export CRATE_CC_NO_DEFAULTS
+
 export BINDGEN_EXTRA_CLANG_ARGS
 target = "${@d.getVar('TARGET_SYS',True).replace('-', ' ')}"
 BINDGEN_EXTRA_CLANG_ARGS = "${@bb.utils.contains('target', 'arm', \

But, before updating parsec-service recipes I opened a discussion with OE-Core maintainers if this setting should be automatically applied to all rust Yocto recipes. If they agree then we don't need to update our recipe.

from parsec.

anta5010 avatar anta5010 commented on August 17, 2024

The bug fix has been merged into OE core. Closing the issue.

from parsec.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.