katyo / oboe-rs

Rust bindings for Oboe high-performance audio IO Android library
64 stars 22 forks source link

Unable to generate bingings when build from git #4

Closed inferrna closed 4 years ago

inferrna commented 4 years ago

Config:

oboe = { git = "https://github.com/katyo/oboe-rs.git", features = ["generate-bindings"] }

Output:

error: failed to run custom build command for `oboe-sys v0.1.0 (https://github.com/katyo/oboe-rs.git#8bf93ee7)`

Caused by:
  process didn't exit successfully: `/home/inferno/dev/rust_swig/android-example/target/debug/build/oboe-sys-2e892fd5990273ab/build-script-build` (exit code: 101)
--- stdout
cargo:rustc-link-search=native=/home/inferno/dev/rust_swig/android-example/target/debug/liboboe-ext/armv7
cargo:rustc-link-lib=oboe-ext

--- stderr
/home/inferno/dev/rust_swig/android-example/target/oboe-src/include/oboe/Definitions.h:21:10: fatal error: 'cstdint' file not found
/home/inferno/dev/rust_swig/android-example/target/oboe-src/include/oboe/Definitions.h:21:10: fatal error: 'cstdint' file not found, err: true
thread 'main' panicked at 'Unable to generate bindings: ()', /home/inferno/.cargo/git/checkouts/oboe-rs-d5611afad1477cfd/8bf93ee/oboe-sys/build.rs:223:20
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Clang version:

Android (5220042 based on r346389c) clang version 8.0.7 (https://android.googlesource.com/toolchain/clang b55f2d4ebfd35bf643d27dbca1bb228957008617) (https://android.googlesource.com/toolchain/llvm 3c393fe7a7e13b0fba4ac75a01aa683d7a5b11cd) (based on LLVM 8.0.7svn)
Target: armv7a-unknown-linux-android24
katyo commented 4 years ago

This is one of a lot bindgen issues related to libclang and particularly cross compiler config.

You can try either of the following:

In any case I recommend use pre-generated bindings.

inferrna commented 4 years ago

Add path to llvm-config in your android ndk toolchain to PATH

was helpful, thank you.

chengchangwu commented 3 years ago

I can not solve this issue with above methods. I set BINDGEN_EXTRA_CLANG_ARGS=-I/path/to/folder/containing/cstdint to solve the issue.

katyo commented 3 years ago

@chengchangwu Thanks. Can we create PR to add this workaround to readme and docs?

chengchangwu commented 3 years ago

OK, I will create a PR.