Comments (9)
Could be easier and may "just" need to check the manifest_path
from cbindgen.
We have disabled parsing for dependencies but the flag is not considered either (it would be fine for us if it took it into account)
what happens in this case? what flag isn't considered?
from cbindgen.
We set parse_deps to false, but as the bug is happening in the way candidate crates are derived from the cargo metadata I believe it has no discernable effect
from cbindgen.
that sounds like a bug. Couldn't we fix this behavior? The dependency should get excluded if parse_deps: false
or if it's listed in excluded
from cbindgen.
Well the actual bug is parsing metadata without checking the version IMO, but as indicated on the PR, I don’t know what the course of action should be on cbindgen side to determine the version of the crate to properly select it in the cargo metadata.
I was thinking about canonicalizing paths but it introduces potential panics and would likely break with complex and networked build systems
from cbindgen.
To be more precise, if a project has a dependency with the same name, cbindgen gets confused with the path to use, cargo metadata has two entries with the same name but normally different path and versions, as it’s a hashmap we randomly pick the right crate.
One possibility is the manial version filter I proposed (as automating it with cbindgen looks non trivial), the other is based on path but introduces potential issues.
from cbindgen.
Basically cbindgen does not even realize it's parsing a dependency as it's relying on the name to know if it's the main project
from cbindgen.
The cbindgen expand config could be modified to optionally accept a version number to match in addition to the package name. I’ve encountered this same issue on one of my own projects as well.
from cbindgen.
Yep tried that as first version the patch and I think that’s what we ended up shipping (or some path based thing to validate the manifest) in a fork for our use case
from cbindgen.
Related Issues (20)
- Modules inside cfg_if! macros aren't read / expanded (was: The C header file cannot be generated correctly.) HOT 2
- Incorrect (outdated?) `fetch_all_dependencies` config suggestion HOT 3
- derive-{eq,neq} doesn't account for #[cfg()]d fields.
- [Feature Request] GObject support HOT 2
- cbindgen emits constants in spite of no-export and/or ignore annotations HOT 6
- WARN: Skip unsupported call expression HOT 1
- Generate C packed struct HOT 2
- `defines` is not applied for impl const HOT 1
- How do I mark a struct variable volatile? HOT 1
- Feature request: transparent/erased typedefs HOT 1
- How to do Vec<String>?
- Macro generated functions are ignored in header generation HOT 2
- Linking to multiple ffi crates fails HOT 2
- incorrect typedef order with circular dependency
- Function parameter annotations
- New cbindgen release? HOT 3
- Add support for std::mem::offset_of HOT 1
- Incorrect equality operator generated with `derive_eq=true` HOT 3
- Can't build Firefox with cbindgen-0.27.0 HOT 4
- Panic when parsing a generic type with empty tuple as default type parameter
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cbindgen.