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

Building libffi-rs fails during ./configure stage - issue with cc wrappers

Open
#179 0 comments 1 reaction 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

I'm trying to build libffi-rs which provide raw rust bindings for libffi. The crate tries to build libffi and fails during the ./configure stage. Apparently it uses cc-native-wrapper.sh as the C compiler, which then fails because of missing compiler features (host machine is Ubuntu 22.04). Why is meta-rust-bin using the host compiler? We'd like to have this build deterministic and reproducible, so we'd like to use the yocto provided C compiler.

Error message

|   checking for a race-free mkdir -p... /home/ubuntu/poky/build/tmp/hosttools/mkdir -p
|   checking for gawk... gawk
|   checking whether make sets $(MAKE)... yes
|   checking whether make supports nested variables... yes
|   checking for gcc... /home/ubuntu/poky/build/tmp/work/x86-64-v3-poky-linux/libffi-bin/dev/wrappers/cc-native-wrapper.sh
|   checking whether the C compiler works... no
| 
|   --- stderr
|   configure: error: in `/home/ubuntu/poky/build/tmp/work/x86-64-v3-poky-linux/libffi-bin/dev/target/x86_64-unknown-linux-gnu/release/build/libffi-sys-fde062a7b8ecd5b5/out/libffi-build/x86_64-unknown-linux-gnu':
|   configure: error: C compiler cannot create executables
|   See `config.log' for more details
|   thread 'main' panicked at libffi-sys-rs/build/common.rs:8:5:
|   Configuring libffi
|   stack backtrace:
|      0: rust_begin_unwind
|                at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/panicking.rs:645:5
|      1: core::panicking::panic_fmt
|                at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/core/src/panicking.rs:72:14
|      2: core::panicking::panic_display
|                at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/core/src/panicking.rs:197:5
|      3: build_script_build::common::run_command
|                at ./build/common.rs:8:5
|      4: build_script_build::not_msvc::configure_libffi
|                at ./build/not_msvc.rs:135:5
|      5: build_script_build::not_msvc::build_and_link
|                at ./build/not_msvc.rs:38:5
|      6: build_script_build::main
|                at ./build/build.rs:16:9
|      7: core::ops::function::FnOnce::call_once
|                at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/core/src/ops/function.rs:250:5
|   note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
| WARNING: exit code 101 from a shell command.

Section from config.log

configure:4544: /home/ubuntu/poky/build/tmp/work/x86-64-v3-poky-linux/libffi-bin/dev/wrappers/cc-native-wrapper.sh -qversion >&5
gcc: error: unrecognized command-line option '-qversion'; did you mean '--version'?
gcc: fatal error: no input files
compilation terminated.
configure:4555: $? = 1
configure:4544: /home/ubuntu/poky/build/tmp/work/x86-64-v3-poky-linux/libffi-bin/dev/wrappers/cc-native-wrapper.sh -version >&5
gcc: error: unrecognized command-line option '-version'
gcc: fatal error: no input files
compilation terminated.
configure:4555: $? = 1
configure:4575: checking whether the C compiler works
configure:4597: /home/ubuntu/poky/build/tmp/work/x86-64-v3-poky-linux/libffi-bin/dev/wrappers/cc-native-wrapper.sh -O3 -ffunction-sections -fdata-sections -fPIC -gdwarf-4 -fno-omit-frame-pointer -m64 -Wno-implicit-function-declaration  -Os -pipe -g -feliminate-unused-debug-types -fcanon-prefix-map  -fmacro-prefix-map=/home/ubuntu/poky/build/tmp/work/x86-64-v3-poky-linux/libffi-bin/dev/git=/usr/src/debug/libffi-bin/dev  -fdebug-prefix-map=/home/ubuntu/poky/build/tmp/work/x86-64-v3-poky-linux/libffi-bin/dev/git=/usr/src/debug/libffi-bin/dev  -fmacro-prefix-map=/home/ubuntu/poky/build/tmp/work/x86-64-v3-poky-linux/libffi-bin/dev/target=/usr/src/debug/libffi-bin/dev  -fdebug-prefix-map=/home/ubuntu/poky/build/tmp/work/x86-64-v3-poky-linux/libffi-bin/dev/target=/usr/src/debug/libffi-bin/dev  -fdebug-prefix-map=/home/ubuntu/poky/build/tmp/work/x86-64-v3-poky-linux/libffi-bin/dev/recipe-sysroot=  -fmacro-prefix map=/home/ubuntu/poky/build/tmp/work/x86-64-v3-poky-linux/libffi-bin/dev/recipe-sysroot=  -fdebug-prefix-map=/home/ubuntu/poky/build/tmp/work/x86-64-v3-poky-linux/libffi-bin/dev/recipe-sysroot-native=  -ffunction-sections -fdata-sections   conftest.c  >&5
gcc: error: unrecognized command-line option '-fcanon-prefix-map'; did you mean '-fmacro-prefix-map='?
configure:4601: $? = 1
configure:4641: result: no
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "libffi"
| #define PACKAGE_TARNAME "libffi"
| #define PACKAGE_VERSION "3.4.4"
| #define PACKAGE_STRING "libffi 3.4.4"
| #define PACKAGE_BUGREPORT "http://github.com/libffi/libffi/issues"
| #define PACKAGE_URL ""
| #define PACKAGE "libffi"
| #define VERSION "3.4.4"
| /* end confdefs.h.  */
| 
| int
| main (void)
| {
| 
|   ;
|   return 0;
| }
configure:4646: error: in `/home/ubuntu/poky/build/tmp/work/x86-64-v3-poky-linux/libffi-bin/dev/target/x86_64-unknown-linux-gnu/release/build/libffi-s
ys-fde062a7b8ecd5b5/out/libffi-build/x86_64-unknown-linux-gnu':
configure:4648: error: C compiler cannot create executables
See `config.log' for more details

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 libffi-sys-rs/build/build.rs, build/not_msvc.rs, and build/common.rs, then inspect the generated config.log and cc-native-wrapper.sh invocation. Trace how the ./configure stage selects its compiler and identify what must change for the Yocto-provided compiler to be used. Done means libffi-rs configures and builds reproducibly without the reported compiler-option failure.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.