-
Notifications
You must be signed in to change notification settings - Fork 84
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
Upgrade bindgen #5
Comments
I would like to give this a try. Since Builder::remove_prefix was removed, are you ok with using names with the "mbedtls_" prefix, except when we reexport values? |
Oh I forgot about this issue. See rust-lang/rust-bindgen#428 . I'd really like to automate this since I'm not a big fan of having to use the prefixes everywhere. |
I worked on this issue in the last few days, here is a status update on my progress so far. I would like to discuss potential approaches to deal with issues I encountered. You can find my work branch at https://github.com/ekse/rust-mbedtls/tree/bindgen-upgrade. First, a quick note on why I want to upgrade. The current master branch does not compile on my computers, it fails with the error "mbedtls_" prefixTo deal with the "mbedtls_" prefix, I tried the approach suggested by the bindgen maintainer to rename the imports with #[mbedtls_use]
use {
mbedtls_aes_context, mbedtls_cipher_context_t, mbedtls_cipher_id_t, mbedtls_cipher_mode_t,
mbedtls_des3_context, mbedtls_des_context, MBEDTLS_CIPHER_ID_3DES, MBEDTLS_CIPHER_ID_AES,
MBEDTLS_CIPHER_ID_DES, MBEDTLS_MODE_CBC, MBEDTLS_MODE_CFB, MBEDTLS_MODE_CTR,
}; There are a couple downsides to this approach. Procedural macros were just stabilized in Rust 1.30, that would make it a hard requirement. Also, the use statements are not in scope when using macros like define!, so I used the full type names (see https://github.com/ekse/rust-mbedtls/blob/bindgen-upgrade/mbedtls/src/pk/ec.rs#L19). Alternatively, we could remove the proc_macro and write the complete unsigned constantsThe second issue I encountered is with constants. Bindgen defines constants such as
Also, some getters and setters fail to compile because enums do not implement From conversions for i32 (because values in u32 could be outside the range of i32).
I temporarily worked around this by manually defining the constants as i32, and the crate successfully compiles at that point. To could be an approach to deal with this issue, I'm not sure what the best way to do that with bindgen would be. Sorry for the long message, it seems upgrading the bindgen dependency will require a good amount of effort. I suggest we decide on a way to deal with the mbedtls_ prefix issue and move on from there. Thanks, Sébastien |
prefixIf you take a look at the latest comments at rust-lang/rust-bindgen#428 it seems to me that reimplementing constantsI think it should be pretty easy to replace the current |
Thanks for the reply, I had not seen the reply on the bindgen issue. I implemented an item_name` callback and it is now merged in the master branch of bindgen. I pushed a new branch with your suggested approaches, the changeset is now much much smaller.
|
Haha I found it: The certificate is expired, the expiration date is '16 Aug 2016'. |
@ekse any progress? Do you need help figuring anything out? |
I opened a pull request (#13) to replace the expired certificate in the tests. For the bindgen upgrade, I was waiting for a new release of bindgen. I asked the maintainers today if they could make a new release. My branch currently compiles and all the tests are passing, it depends on the git repository of bindgen at the moment, so once the bindgen crate is updated it will be ready for a pull request. |
This is also necessary for the docs to show up properly on docs.rs |
66: Split up Travis into 4 jobs and pin to a specific nightly for SGX r=Goirad a=jack-fortanix This improves parallelism (Travis will run 5 jobs at once) and avoids redundancy (the core_io + nightly builds are being run twice, in the stable and beta builds). Pins the SGX build to 2019-07-11 as with most recently nightly, syntex_syntax fails to compile. Fixing that requires upgrading bindgen (#5) Co-authored-by: Jack Lloyd <[email protected]>
With recent nightly, the version of syntex-syntax pulled in by bindgen 0.19 fails to compile. In some months, that nightly behavior will become stable at which point mbedtls crate will be broken :( @jethrogb it seems like #14 is stalled on unresolved bindgen bugs. It is possible we can move to some intermediate version of bindgen to avoid the compilation problem but without hitting the bugs in more recent bindgen? |
No, we are on the latest possible bindgen. It works if you patch syntex_syntax to 0.40 and disable |
Hi folks. I also tried to use this library on windows, have been able to use it thanks to #102. As @nouwaarom, I also would be glad to help if anything is required to merge this fix. |
I echo the previous requests. This is too much of a problem to be left unfixed (I came here because this breaks fortanix sgx sdk Let me know if there is help required with this. |
As mentioned in #14 (comment) the new version of bindgen (after 0.19) is not capable of generating the bindings the way we are generating them today, so they'd be incompatible. In order to make progress, features need to be added to bindgen to make sure it can generate code the right way. |
Final PR: #152 |
Use pub(crate), not include!(), to access private fields
This crate is currently using an old version of bindgen which requires LLVM 3.8 and no newer. The API and behavior has changed significantly since then, so it'll be a bit of work to upgrade.
The text was updated successfully, but these errors were encountered: