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

bitflags compilation errors #1877

Closed
joIivier opened this issue Apr 11, 2023 · 2 comments
Closed

bitflags compilation errors #1877

joIivier opened this issue Apr 11, 2023 · 2 comments

Comments

@joIivier
Copy link

Hello,
when I add openssl as a dependent crate to my crate, I get a lot of compilations errors within openssl like:

error[E0412]: cannot find type `Pkcs7Flags` in this scope
   --> /home/jolivier/.cargo/registry/src/index.crates.io-6f17d22bba15001f/openssl-0.10.50/src/pkcs7.rs:262:16
    |
262 |         flags: Pkcs7Flags,
    |                ^^^^^^^^^^ not found in this scope

error[E0422]: cannot find struct, variant or union type `X509VerifyFlags` in this scope
   --> /home/jolivier/.cargo/registry/src/index.crates.io-6f17d22bba15001f/openssl-0.10.50/src/x509/verify.rs:116:9
    |
64  | / foreign_type_and_impl_send_sync! {
65  | |     type CType = ffi::X509_VERIFY_PARAM;
66  | |     fn drop = ffi::X509_VERIFY_PARAM_free;
67  | |
...   |
71  | |     pub struct X509VerifyParamRef;
72  | | }
    | |_- similarly named struct `X509VerifyParam` defined here
...
116 |           X509VerifyFlags { bits }
    |           ^^^^^^^^^^^^^^^ help: a struct with a similar name exists: `X509VerifyParam`

Or

error[E0412]: cannot find type `SslVerifyMode` in this scope
    --> /home/jolivier/.cargo/registry/src/index.crates.io-6f17d22bba15001f/openssl-0.10.50/src/ssl/mod.rs:2339:52
     |
2339 |     pub fn set_verify_callback<F>(&mut self, mode: SslVerifyMode, verify: F)
     |                                                    ^^^^^^^^^^^^^ not found in this scope

I have 60 errors in total so not reproducing all of them here. They seem to be all related to the use of the bitflags! macro. All of the errors I checked were related to a struct declared via this macro.
I tried in stable and nightly versions:

cargo -V
cargo 1.70.0-nightly (0e474cfd7 2023-03-31)
cargo +stable -V
cargo 1.68.2 (6feb7c9cf 2023-03-26)

My Cargo.toml:

[package]
name = "xxx"
version = "0.1.0"
authors = ["xxx"]
edition = "2021"

[dependencies]
ansi_term = "*"
env_logger = "*"
log= { version = "0.4", features = ["max_level_debug", "release_max_level_warn"] }
maplit = "1.0"
openssl = "0.10"
rand = "0.8"
rand_distr = "0.4"
spade = "2.1"
tempfile = "3"
time = "0.3"

I tried the vendored build but got the same issue.

@sfackler
Copy link
Owner

Your local copy of bitflags may be corrupted. Try deleting your local cargo cache and rebuilding.

@joIivier
Copy link
Author

Ok, I dig deeper and found the issue:
bitflags 1.0.3 does not support Edition 2018 and this is fixed via bitflags/bitflags#165
I don't understand why version 1.0.3 was chosen but after deleting my local cargo cache it uses version 1.3.2 that doesn't have this issue anymore.
Thanks for the help anyway.

@joIivier joIivier changed the title Compilation errors as dependency bitflags compilation errors Apr 13, 2023
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

No branches or pull requests

2 participants