rust-lang / rust-lang/rust-bindgen
Cross-compiled crate appears to include host header files after 0.30
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 5.3k
- Forks
- 829
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 15
Description
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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the failure with the ChibiOS-rust checkout, the thumbv7m-none-eabi target, and bindgen 0.31 using the xargo command shown. Start at the Builder::generate call and compare bindgen 0.30 and 0.31 handling of compiler arguments and included headers. Done means the cross-compiled crate no longer parses incompatible host headers and generates the CMSIS bindings successfully.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100