rust-lang / rust-lang/rust-bindgen
bindgen does not emit functions for wasm32-unknown-emscripten
Open
Nobody has claimed this yet.
A-libclang
bug
- Dominant language
- Rust
- Stars
- 5.3k
- Forks
- 829
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 15
Description
Input C/C++ Header
struct Test {
int test;
};
void test(struct Test *test);
Bindgen Invocation
$ bindgen input.h -o bindings.rs -- --target=wasm32-unknown-emscripten
Actual Results
/* automatically generated by rust-bindgen 0.56.0 */
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct Test {
pub test: ::std::os::raw::c_int,
}
#[test]
fn bindgen_test_layout_Test() {
assert_eq!(
::std::mem::size_of::<Test>(),
4usize,
concat!("Size of: ", stringify!(Test))
);
assert_eq!(
::std::mem::align_of::<Test>(),
4usize,
concat!("Alignment of ", stringify!(Test))
);
assert_eq!(
unsafe { &(*(::std::ptr::null::<Test>())).test as *const _ as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(Test),
"::",
stringify!(test)
)
);
}
Expected Results
Functions getting emitted
By the way, asmjs-unknown-emscripten target doesn't work at all:
thread 'main' panicked at 'libclang error; possible causes include:
- Invalid flag syntax
- Unrecognized flags
- Invalid flag arguments
- File I/O errors
- Host vs. target architecture mismatch
If you encounter an error missing from this list, please file an issue or a PR!
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
Start by reproducing the bindgen invocation with the shown input.h and the wasm32-unknown-emscripten target, then trace target-specific function generation. Done means the generated bindings include the declared test function; separately verify whether the asmjs-unknown-emscripten failure is in scope.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, rust, wasm
- Domain
- compilers, devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100