Giter Club home page Giter Club logo

Comments (17)

lawliet89 avatar lawliet89 commented on July 19, 2024

The crate does not depend specifically on Rocket 0.3.3 -- in fact I do not even have a Cargo.lock checked in as per usual library practices. It depends on all 0.3.x.

Anyway neither this crate nor Rocket depend on ring directly. You can add these lines to your Cargo.toml to use the same workaround as Rocket does.

from rocket_cors.

Boscop avatar Boscop commented on July 19, 2024

The problem is, this crate depends on rocket 0.3 but rocket master is 0.4.0-dev, so I get this error:

error: Multiple packages link to native library `ring-asm`. A native library can be linked only once.

Package `ring v0.11.0`
    ... which is depended on by `cookie v0.9.1`
    ... which is depended on by `rocket v0.3.5`
    ... which is depended on by `rocket_cors v0.2.1`
    ... which is depended on by `webserver v0.1.0 (file:///D:/docs/foo/foo-server/server)`
    ... which is depended on by `foo-server v0.1.0 (file:///D:/docs/foo/foo-server)`
links to native library `ring-asm`.

Package `ring v0.12.1`
    ... which is depended on by `cookie v0.11.0-dev (https://github.com/alexcrichton/cookie-rs?rev=a15b37a#a15b37af)`
    ... which is depended on by `webserver v0.1.0 (file:///D:/docs/foo/foo-server/server)`
    ... which is depended on by `foo-server v0.1.0 (file:///D:/docs/foo/foo-server)`
also links to native library `ring-asm`.

How can I fix this? :)

from rocket_cors.

Boscop avatar Boscop commented on July 19, 2024

I bumped up the rocket version in a fork for now: https://github.com/Boscop/rocket_cors

from rocket_cors.

lawliet89 avatar lawliet89 commented on July 19, 2024

Another way to fix this is to simply replace the Rocket dependency to point to Rocket's master branch in your own crate:

[patch.crates-io]
rocket = { git = "https://github.com/SergioBenitez/Rocket", version = "0.4.0-dev" }

I don't intend to update the master branch to point to an unreleased version of Rocket at the moment.

from rocket_cors.

Boscop avatar Boscop commented on July 19, 2024

I don't intend to update the master branch to point to an unreleased version of Rocket at the moment.

I didn't mean to suggest you to do that..

But I like the patch solution more, I tried to do it:

[patch.crates-io]
ring = { git = "https://github.com/SergioBenitez/ring", branch = "v0.12" }
rocket = { git = "https://github.com/SergioBenitez/Rocket", version = "0.4.0-dev" }

(the ring patch was from before, to make it work)
But now I get the same error again:

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

package `ring v0.12.2 (https://github.com/SergioBenitez/ring?branch=v0.12#9ccfa153)`
    ... which is depended on by `cookie v0.11.0-dev (https://github.com/alexcrichton/cookie-rs?rev=a15b37a#a15b37af)`
    ... which is depended on by `rocket v0.4.0-dev (https://github.com/SergioBenitez/Rocket#9bf33bdd)`
    ... which is depended on by `rocket_contrib v0.4.0-dev (https://github.com/SergioBenitez/Rocket#9bf33bdd)`
    ... which is depended on by `webserver v0.1.0 (file:///D:/docs/foo/foo-server/server)`
    ... which is depended on by `foo-server v0.1.0 (file:///D:/docs/foo/foo-server)`
links to native library `ring-asm`

package `ring v0.11.0`
    ... which is depended on by `cookie v0.9.2`
    ... which is depended on by `rocket v0.3.5`
    ... which is depended on by `rocket_cors v0.2.1`
    ... which is depended on by `webserver v0.1.0 (file:///D:/docs/foo/foo-server/server)`
    ... which is depended on by `foo-server v0.1.0 (file:///D:/docs/foo/foo-server)`
also links to native library `ring-asm`

Why does it use the ring patch but not the one for rocket?

Btw, in the rest of my Cargo.toml I have:

rocket = { git = "https://github.com/SergioBenitez/Rocket", version = "0.4.0-dev" }
rocket_codegen = { git = "https://github.com/SergioBenitez/Rocket", version = "0.4.0-dev" }
rocket_contrib = { git = "https://github.com/SergioBenitez/Rocket", version = "0.4.0-dev" }

from rocket_cors.

lawliet89 avatar lawliet89 commented on July 19, 2024

Looks like you need to do the same for Cookie. Might just be better off using your forked version if you have to do this for every other dependency.

from rocket_cors.

Boscop avatar Boscop commented on July 19, 2024

But how to do this for cookie? Am I not doing it globally for ALL crates that depend on rocket?

from rocket_cors.

Boscop avatar Boscop commented on July 19, 2024
11:04 <Sergio> You can only patch within semver compatible versions

Seems like there is no way to patch it, so I have to keep using my fork..

from rocket_cors.

lawliet89 avatar lawliet89 commented on July 19, 2024

from rocket_cors.

lawliet89 avatar lawliet89 commented on July 19, 2024

@Boscop There is a PR in ring that will hopefully prevent this issue in the future.

I'll keep this open to keep an eye on that PR and I'll update accordingly when rocket also upgrades.

from rocket_cors.

lawliet89 avatar lawliet89 commented on July 19, 2024

Rocket 0.4 now requires ring 0.13.

from rocket_cors.

incker avatar incker commented on July 19, 2024

My Cargo.toml

[package]
name = "rocket2"
version = "0.1.0"
authors = ["incker"]
edition = "2018"

[dependencies]
rocket = "0.4.0-rc.2"

[dependencies.rocket_contrib]
version = "*"
default-features = false
features = ["handlebars_templates", "tera_templates"]

Error that I see:

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

package `ring v0.13.5`
    ... which is depended on by `cookie v0.11.0`
    ... which is depended on by `rocket_http v0.4.0-rc.2`
    ... which is depended on by `rocket v0.4.0-rc.2`
    ... which is depended on by `rocket2 v0.1.0 (C:\rust\rocket2)`
links to native library `ring-asm`

package `ring v0.11.0`
    ... which is depended on by `cookie v0.9.2`
    ... which is depended on by `rocket v0.3.17`
    ... which is depended on by `rocket_contrib v0.3.17`
    ... which is depended on by `rocket2 v0.1.0 (C:\rust\rocket2)`
also links to native library `ring-asm`

What I did wrong?

from rocket_cors.

lawliet89 avatar lawliet89 commented on July 19, 2024

@incker: I haven't updated the crate to support Rocket 0.4.0.rc.2.

Fixed in #53.

New release: https://github.com/lawliet89/rocket_cors/releases/tag/v0.4.0-rc.3

from rocket_cors.

incker avatar incker commented on July 19, 2024

@incker: I haven't updated the crate to support Rocket 0.4.0.rc.2.

Fixed in #53.

New release: https://github.com/lawliet89/rocket_cors/releases/tag/v0.4.0-rc.3

I am not sure, what exactly have helped me, but this code works for me:

[package]
name = "rocket2"
version = "0.1.0"
authors = ["incker"]
edition = "2018"

[dependencies]
rocket = "0.4.0-rc.2"
rocket_cors = { git = "https://github.com/lawliet89/rocket_cors", branch = "master" }

[dependencies.rocket_contrib]
version = "0.4.0-rc.2"
default-features = false
features = ["handlebars_templates", "tera_templates"]

maybe version of dependencies.rocket_contrib was also needed

Thank you

from rocket_cors.

incker avatar incker commented on July 19, 2024

Maybe it is already not that topic to write,
but now I have same problem when I added line rocket_static_fs = "*" to Cargo.toml

from rocket_cors.

lawliet89 avatar lawliet89 commented on July 19, 2024
rocket_cors = "0.4.0-rc.3"

would be sufficient.

Like the earlier comments in the issue, anything that depends directly or transitively on ring needs to be on the same version. There's not much I can do about it for you.

from rocket_cors.

lawliet89 avatar lawliet89 commented on July 19, 2024

I am closing this issue for now. The version of Ring supported by this crate will track that of Rocket's.

from rocket_cors.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.