Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update changes, readme #120

Merged
merged 6 commits into from
Dec 18, 2020
Merged

update changes, readme #120

merged 6 commits into from
Dec 18, 2020

Conversation

jdroenner
Copy link
Member

No description provided.

@jdroenner jdroenner merged commit 1ee19ed into master Dec 18, 2020
@jdroenner jdroenner deleted the prepare_07 branch December 18, 2020 20:47
@@ -11,6 +11,6 @@ edition = "2018"
libc = "0.2"

[build-dependencies]
bindgen = { version = "0.54", optional = true }
bindgen = { version = "0.56", optional = true }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We recently hit some surprising behavior with a bindgen update

georust/proj#53

Note sure if this affects you, or maybe you've already dealt with it, but bindgen recently changed how size_t gets translated to rust.

It used to map size_t to usize. In rust, the byte size of usize changes depending on your platform to match the pointer size. On all "first class" rust platforms the size of usize in rust is equal to sizeof size_t in C.

But there's nothing in the c standard that says size_t needs to equal pointer width. So in theory, technically, they could be different.

...so the (controversial) decision was made to output a concretely sized type (based on the size of size_t on the person running bindgen).

So, long story short, if you are packaging and relying on pre-builting bindings and want them to work on 32bit and 64bit machines, you need to enable the --size_t-is-usize option for bindgen when you're packing your pre-built bindings.

You can trace the thread back from: rust-lang/rust-bindgen#1688

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh wow i did not know. So if i add .size_t_is_usize(true) to bindgen in build.rs it should work?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a created a PR for this: #127

Copy link
Member

@michaelkirk michaelkirk Dec 18, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if i add .size_t_is_usize(true) to bindgen in build.rs it should work?

Yes, my understanding is that this will maintain the behavior from 0.53 and before.

I notice you're updating from bindgen 0.54, so that ship may have already sailed, but it would have only affected your pre-built bindings if you'd regenerated the bindings when you last updated bindgen.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think all the bindings are older then the last bindgen update :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants