reown-com / a2

An Asynchronous Apple Push Notification (apns2) Client for Rust
MIT License
151 stars 53 forks source link

Support For Using Rocket And a2 #23

Closed oscartbeaumont closed 6 years ago

oscartbeaumont commented 6 years ago

I Have A Project I Am Working on Where I Have A Rocket Webserver And I Would Also Like To Be Able To Send Push Notifications. Is There A Way For This Module Conflict (In The Code Below) To Be Fixed Here or Would I Have To Contact The Developers Of Rocket.

error: multiple packages link to native library `ring-asm`, but a native library can be linked only once

package `ring v0.13.0-alpha`
    ... which is depended on by `webpki v0.18.0-alpha`
    ... which is depended on by `rustls v0.12.0`
    ... which is depended on by `a2 v0.2.0-pre.0 (https://github.com/pimeys/a2/#48b6d746)`
    ... which is depended on by `[REMOVED PROJECT NAME] v1.0.0 ([REMOVED DIRECTORY])`
links to native library `ring-asm`

package `ring v0.11.0`
    ... which is depended on by `webpki v0.14.0`
    ... which is depended on by `webpki-roots v0.11.0`
    ... which is depended on by `hyper-sync-rustls v0.1.0`
    ... which is depended on by `rocket v0.3.8`
    ... which is depended on by `rocket_codegen v0.3.8`
    ... which is depended on by `[REMOVED PROJECT NAME] v1.0.0 ([REMOVED DIRECTORY])`
also links to native library `ring-asm`
pimeys commented 6 years ago

Have you tried to delete your Cargo.lock file before updating your dependencies? It usually helps in situations like this.

I'm not really depending on anything with the webpki 0.18.0-alpha, so the next step would be to try to downgrade it to version 0.17.0.

oscartbeaumont commented 6 years ago

I deleted my 'cargo.lock' file and my 'target' directory and I have rebuild the application. I am still getting the same error.

My Cargo.toml Dependencies:

rocket = { version = "*", features = ["tls"] }
rocket_codegen = "*"

a2 = { git = "https://github.com/pimeys/a2/" }
pimeys commented 6 years ago

Yeah, I found the same when I was digging into the issue. It seems the encryption library ring has a native dependency ring-asm, which you can't have holding two different versions in the same project.

Here the issue is rocket, which wants to use a crate called hyper-sync-rustls, which in turn has a dependency to a ring version that is ancient in ring standards (ring forces everybody to update fast, new versions containing important security fixes). And rocket seem to depend on an ancient version of hyper (0.10) through the hyper-sync-rustls, not using the more recent reqwest written by the Hyper author @seanmonstar. I mean hyper 0.11 has been available more than a year already and it's a complete refactoring and a massive change how 0.10 worked.

So what I would suggest: try digging into the rocket dependencies and see if you can upgrade the problematic dependencies. In this crate the tokio-rustls depends on a recent version of ring, and I'm not so happy downgrading encryption libraries.

oscartbeaumont commented 6 years ago

Thanks For Your All Your Help

pimeys commented 6 years ago

One more pointer! Follow this issue in Rocket:

https://github.com/SergioBenitez/Rocket/issues/17