I'm trying to generate bindings for a largish C++ library while having no C++ experience. I've been hitting constant walls and I don't know how to proceed further, so I'm hoping someone could see the error stacktrace and might know what I'm doing wrong.
When I generate bindings, these are the 6 errors I get:
error[E0428]: the name `std__Tree_iterator` is defined multiple times
--> C:\Users\natha\Documents\rust\libsumo\target\debug\build\libsumo-bf3a174577086181\out/bindings.rs:4398:1
|
4259 | pub struct std__Tree_iterator {
| ----------------------------- previous definition of the type `std__Tree_iterator` here
...
4398 | pub type std__Tree_iterator = std_conditional_t;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `std__Tree_iterator` redefined here
|
= note: `std__Tree_iterator` must be defined only once in the type namespace of this module
error[E0412]: cannot find type `_Base` in this scope
--> C:\Users\natha\Documents\rust\libsumo\target\debug\build\libsumo-bf3a174577086181\out/bindings.rs:4237:51
|
4236 | pub struct std__Tree_unchecked_iterator {
| - help: you might be missing a type parameter: `<_Base>`
4237 | pub _base: std__Tree_unchecked_const_iterator<_Base>,
| ^^^^^ not found in this scope
error[E0412]: cannot find type `_Base` in this scope
--> C:\Users\natha\Documents\rust\libsumo\target\debug\build\libsumo-bf3a174577086181\out/bindings.rs:4239:84
|
4239 | pub type std__Tree_unchecked_iterator__Mybase = std__Tree_unchecked_const_iterator<_Base>;
| - ^^^^^ not found in this scope
| |
| help: you might be missing a type parameter: `<_Base>`
error[E0412]: cannot find type `_Value_type` in this scope
--> C:\Users\natha\Documents\rust\libsumo\target\debug\build\libsumo-bf3a174577086181\out/bindings.rs:4302:56
|
4302 | pub type std__Tree_simple_types__Node = std__Tree_node<_Value_type>;
| - ^^^^^^^^^^^ not found in this scope
| |
| help: you might be missing a type parameter: `<_Value_type>`
error[E0412]: cannot find type `_Base` in this scope
--> C:\Users\natha\Documents\rust\libsumo\target\debug\build\libsumo-bf3a174577086181\out/bindings.rs:4342:87
|
4342 | pub type std__Tree_val__Unchecked_const_iterator = std__Tree_unchecked_const_iterator<_Base>;
| - ^^^^^ not found in this scope
| |
| help: you might be missing a type parameter: `<_Base>`
error[E0412]: cannot find type `_Base` in this scope
--> C:\Users\natha\Documents\rust\libsumo\target\debug\build\libsumo-bf3a174577086181\out/bindings.rs:4400:83
|
4400 | pub type std__Tree__Unchecked_const_iterator = std__Tree_unchecked_const_iterator<_Base>;
| - ^^^^^ not found in this scope
| |
| help: you might be missing a type parameter: `<_Base>`
Some errors have detailed explanations: E0412, E0428.
For more information about an error, try `rustc --explain E0412`.
error: could not compile `libsumo` due to 6 previous errors
I'm hoping that the E0412 errors (which are 5/6 errors) I can fix by just manually adding the generics, and I hope that's ok? I'm unsure why bindgen would generate something like this... is this some artifact of my setup being wrong?
For the one E0428 error... I have no idea what to do. It looks like bindgen is making these as a wrapper around something in the C++ standard library, but I have no experience with C++ so I could be wrong... but if it is, why would it wrap the same thing twice?
Any suggestions would be appreciated. I've never done any FFI before, and I have no C++ experience... so I appreciate the help!
I've also tried running this on Ubuntu, and I get different specific errors, but of the same types (E0412 and E0428). If it's not possible to bind this C++ library, I'll just have to abandon Rust for this project.