rust-embedded / rust-embedded/meta-rust-bin

Error building dependencies with a custom `build.rs` script

Open
#219 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
BitBake
Stars
124
Forks
92
Avg merge
6h 54m
Merged PRs (30d)
2

Description

Hi, I'm trying to build a Cargo workspace which depends on the ring crate. This crate has a custom build.rs script, and my Yocto build fails with the following output:

|   CC = Some(/home/builder/cybeesat/build/tmp/work/cortexa5t2hf-neon-vfpv4-poky-linux-gnueabi/cybeesat-flight-software/git/wrappers/cc-wrapper.sh)                                     [7/1944]
|   RUSTC_WRAPPER = None
|   cargo:rerun-if-env-changed=CC_ENABLE_DEBUG_OUTPUT
|   cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
|   CRATE_CC_NO_DEFAULTS = None
|   DEBUG = Some(true)
|   CARGO_CFG_TARGET_FEATURE = Some(fxsr,sse,sse2)
|   cargo:rerun-if-env-changed=CFLAGS
|   CFLAGS = Some( -O2 -pipe -g -feliminate-unused-debug-types -fcanon-prefix-map  -fmacro-prefix-map=/home/builder/cybeesat/build/tmp/work/cortexa5t2hf-neon-vfpv4-poky-linux-gnueabi/cybeesat-
flight-software/git/git=/usr/src/debug/cybeesat-flight-software/git  -fdebug-prefix-map=/home/builder/cybeesat/build/tmp/work/cortexa5t2hf-neon-vfpv4-poky-linux-gnueabi/cybeesat-flight-softwar
e/git/git=/usr/src/debug/cybeesat-flight-software/git  -fmacro-prefix-map=/home/builder/cybeesat/build/tmp/work/cortexa5t2hf-neon-vfpv4-poky-linux-gnueabi/cybeesat-flight-software/git/target=/
usr/src/debug/cybeesat-flight-software/git  -fdebug-prefix-map=/home/builder/cybeesat/build/tmp/work/cortexa5t2hf-neon-vfpv4-poky-linux-gnueabi/cybeesat-flight-software/git/target=/usr/src/deb
ug/cybeesat-flight-software/git  -fdebug-prefix-map=/home/builder/cybeesat/build/tmp/work/cortexa5t2hf-neon-vfpv4-poky-linux-gnueabi/cybeesat-flight-software/git/recipe-sysroot=  -fmacro-prefi
x-map=/home/builder/cybeesat/build/tmp/work/cortexa5t2hf-neon-vfpv4-poky-linux-gnueabi/cybeesat-flight-software/git/recipe-sysroot=  -fdebug-prefix-map=/home/builder/cybeesat/build/tmp/work/co
rtexa5t2hf-neon-vfpv4-poky-linux-gnueabi/cybeesat-flight-software/git/recipe-sysroot-native= )
|   cargo:rerun-if-env-changed=CC_SHELL_ESCAPED_FLAGS
|   CC_SHELL_ESCAPED_FLAGS = None
|   cargo:rerun-if-env-changed=HOST_CFLAGS
|   HOST_CFLAGS = Some()
|   cargo:rerun-if-env-changed=CFLAGS_x86_64_unknown_linux_gnu
|   CFLAGS_x86_64_unknown_linux_gnu = None
|   cargo:rerun-if-env-changed=CFLAGS_x86_64-unknown-linux-gnu
|   CFLAGS_x86_64-unknown-linux-gnu = None
|   CARGO_ENCODED_RUSTFLAGS = Some()
|   cargo:warning=arm-poky-linux-gnueabi-gcc: error: unrecognized command-line option '-m64'
|
|   --- stderr
|
|
|   error occurred in cc-rs: command did not execute successfully (status code exit status: 1): LC_ALL="C" "/home/builder/cybeesat/build/tmp/work/cortexa5t2hf-neon-vfpv4-poky-linux-gnueabi/cyb
eesat-flight-software/git/wrappers/cc-wrapper.sh" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-4" "-fno-omit-frame-pointer" "-m64" "-I" "/home/builder/cybeesat/build/tmp/work
/cortexa5t2hf-neon-vfpv4-poky-linux-gnueabi/cybeesat-flight-software/git/cargo_home/registry/src/index.crates.io-1949cf8c6b5b557f/ring-0.17.14/include" "-I" "/home/builder/cybeesat/build/tmp/w
ork/cortexa5t2hf-neon-vfpv4-poky-linux-gnueabi/cybeesat-flight-software/git/cargo_home/registry/src/index.crates.io-1949cf8c6b5b557f/ring-0.17.14/pregenerated" "-fvisibility=hidden" "-std=c1x"
 "-Wall" "-Wbad-function-cast" "-Wcast-align" "-Wcast-qual" "-Wconversion" "-Wmissing-field-initializers" "-Wmissing-include-dirs" "-Wnested-externs" "-Wredundant-decls" "-Wshadow" "-Wsign-com
pare" "-Wsign-conversion" "-Wstrict-prototypes" "-Wundef" "-Wuninitialized" "-g3" "-DNDEBUG" "-O2" "-pipe" "-g" "-feliminate-unused-debug-types" "-fcanon-prefix-map" "-fmacro-prefix-map=/home/
builder/cybeesat/build/tmp/work/cortexa5t2hf-neon-vfpv4-poky-linux-gnueabi/cybeesat-flight-software/git/git=/usr/src/debug/cybeesat-flight-software/git" "-fdebug-prefix-map=/home/builder/cybee
sat/build/tmp/work/cortexa5t2hf-neon-vfpv4-poky-linux-gnueabi/cybeesat-flight-software/git/git=/usr/src/debug/cybeesat-flight-software/git" "-fmacro-prefix-map=/home/builder/cybeesat/build/tmp
/work/cortexa5t2hf-neon-vfpv4-poky-linux-gnueabi/cybeesat-flight-software/git/target=/usr/src/debug/cybeesat-flight-software/git" "-fdebug-prefix-map=/home/builder/cybeesat/build/tmp/work/cort
exa5t2hf-neon-vfpv4-poky-linux-gnueabi/cybeesat-flight-software/git/target=/usr/src/debug/cybeesat-flight-software/git" "-fdebug-prefix-map=/home/builder/cybeesat/build/tmp/work/cortexa5t2hf-n
eon-vfpv4-poky-linux-gnueabi/cybeesat-flight-software/git/recipe-sysroot=" "-fmacro-prefix-map=/home/builder/cybeesat/build/tmp/work/cortexa5t2hf-neon-vfpv4-poky-linux-gnueabi/cybeesat-flight-
software/git/recipe-sysroot=" "-fdebug-prefix-map=/home/builder/cybeesat/build/tmp/work/cortexa5t2hf-neon-vfpv4-poky-linux-gnueabi/cybeesat-flight-software/git/recipe-sysroot-native=" "-o" "/h
ome/builder/cybeesat/build/tmp/work/cortexa5t2hf-neon-vfpv4-poky-linux-gnueabi/cybeesat-flight-software/git/target/release/build/ring-b223ecc4d5a766a0/out/25ac62e5b3c53843-curve25519.o" "-c" "
/home/builder/cybeesat/build/tmp/work/cortexa5t2hf-neon-vfpv4-poky-linux-gnueabi/cybeesat-flight-software/git/cargo_home/registry/src/index.crates.io-1949cf8c6b5b557f/ring-0.17.14/crypto/curve
25519/curve25519.c"

My recipe is very simple:

SUMMARY = "CyBEEsat Flight Software"
HOMEPAGE = "https://gitlab.com/rccn/missions/cybeesat/"
LICENSE = "GPL"

inherit cargo_bin

# Enable network for the compile task allowing cargo to download dependencies
do_compile[network] = "1"

SRC_URI = "gitsm://gitlab.com/rccn/missions/cybeesat.git;protocol=https;branch=main"
SRCREV="3db10d6228be6452fad99c0cd8c336d2e42331ee"
S = "${WORKDIR}/git"
LIC_FILES_CHKSUM = "file://LICENSE;md5=79409ca9a2f1e5e21d07bb10c0f5c7b7"

I'm not sure if this is a general problem when building build scripts (which are compiled for the host architecture), something specific to my setup, or something else entirely. Any help would be greatly appreciated. Thanks!

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the provided Yocto recipe and the ring crate's build.rs, then inspect the Cargo build invocation around cc-rs and the target settings. Reproduce the failure for the stated ARM target; done means the workspace builds successfully without the compiler receiving an incompatible -m64 option.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
build-system, embedded-iot
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.