Skip to content

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

Open
@fnerdman

Description

@fnerdman

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions