Skip to content

Cross-compiled crate appears to include host header files after 0.30 #1229

@thenewwazoo

Description

@thenewwazoo

When building bindings for an embedded OS, updating the dependency from 0.30 to 0.31 causes an error when Builder::generate is called. To repro (this assumes you've got arm-none-eabi tools installed):

$ git clone --recursive git@github.com:thenewwazoo/ChibiOS-rust.git && cd ChibiOS-rust
$ rustup override set nightly
$ cp -R os_ports/* ChibiOS/
$ xargo build --target thumbv7m-none-eabi --features stm32f407xg

The crate will build successfully.

Updating bindgen to 0.31 results in the following output:

<successful output snipped>
--- stderr
/usr/include/sys/cdefs.h:761:2: error: Unsupported architecture
/usr/include/machine/_types.h:34:2: error: architecture not supported
/usr/include/sys/_types.h:55:9: error: unknown type name '__int64_t'
/usr/include/sys/_types.h:56:9: error: unknown type name '__int32_t'
/usr/include/sys/_types.h:57:9: error: unknown type name '__int32_t'
/usr/include/sys/_types.h:60:9: error: unknown type name '__uint32_t'
/usr/include/sys/_types.h:61:9: error: unknown type name '__uint32_t'
/usr/include/sys/_types.h:62:9: error: unknown type name '__uint64_t'
/usr/include/sys/_types.h:68:9: error: unknown type name '__darwin_natural_t'
/usr/include/sys/_types.h:70:9: error: unknown type name '__uint16_t'
/usr/include/sys/_types.h:71:9: error: unknown type name '__int64_t'
/usr/include/sys/_types.h:72:9: error: unknown type name '__int32_t'
/usr/include/sys/_types.h:73:9: error: unknown type name '__uint32_t'
/usr/include/sys/_types.h:74:9: error: unknown type name '__int32_t'
/usr/include/sys/_types.h:75:9: error: unknown type name '__uint32_t'
/usr/include/sys/_types.h:76:9: error: unknown type name '__uint32_t'
/usr/include/machine/types.h:37:2: error: architecture not supported
/usr/include/sys/_types/_intptr_t.h:32:9: error: unknown type name '__darwin_intptr_t'
/usr/include/sys/cdefs.h:761:2: error: Unsupported architecture, err: true
/usr/include/machine/_types.h:34:2: error: architecture not supported, err: true
/usr/include/sys/_types.h:55:9: error: unknown type name '__int64_t', err: true
/usr/include/sys/_types.h:56:9: error: unknown type name '__int32_t', err: true
/usr/include/sys/_types.h:57:9: error: unknown type name '__int32_t', err: true
/usr/include/sys/_types.h:60:9: error: unknown type name '__uint32_t', err: true
/usr/include/sys/_types.h:61:9: error: unknown type name '__uint32_t', err: true
/usr/include/sys/_types.h:62:9: error: unknown type name '__uint64_t', err: true
/usr/include/sys/_types.h:68:9: error: unknown type name '__darwin_natural_t', err: true
/usr/include/sys/_types.h:70:9: error: unknown type name '__uint16_t', err: true
/usr/include/sys/_types.h:71:9: error: unknown type name '__int64_t', err: true
/usr/include/sys/_types.h:72:9: error: unknown type name '__int32_t', err: true
/usr/include/sys/_types.h:73:9: error: unknown type name '__uint32_t', err: true
/usr/include/sys/_types.h:74:9: error: unknown type name '__int32_t', err: true
/usr/include/sys/_types.h:75:9: error: unknown type name '__uint32_t', err: true
/usr/include/sys/_types.h:76:9: error: unknown type name '__uint32_t', err: true
/usr/include/machine/types.h:37:2: error: architecture not supported, err: true
/usr/include/sys/_types/_intptr_t.h:32:9: error: unknown type name '__darwin_intptr_t', err: true
thread 'main' panicked at 'unable to generate cmsis bindings: ()', libcore/result.rs:916:5
note: Run with `RUST_BACKTRACE=1` for a backtrace.

(looking at the backtrace points to where I expect the generate call)

Relevant host information:

Darwin hartwell.local 17.3.0 Darwin Kernel Version 17.3.0: Thu Nov  9 18:09:22 PST 2017; root:xnu-4570.31.3~1/RELEASE_X86_64 x86_64
arm-none-eabi-gcc (GNU Tools for ARM Embedded Processors) 5.2.1 20151202 (release) [ARM/embedded-5-branch revision 231848]
Apple LLVM version 9.0.0 (clang-900.0.39.2)
rustc 1.25.0-nightly (e6072a7b3 2018-01-13)

You can find the __bindgen.i file here

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions