fengsp / pencil

A web application microframework for Rust
https://fengsp.github.io/pencil/
Other
872 stars 43 forks source link

Compilation fails on formdata-0.8.4 textnonce-0.3.4 #29

Closed mrLSD closed 7 years ago

mrLSD commented 7 years ago

rustc 1.11.0 (9b21dcd6a 2016-08-15) cargo 0.12.0-nightly (6b98d1f 2016-07-04)

Cargo.toml: [dependencies] pencil = "*"

Related issue: https://github.com/mikedilger/formdata/issues/34#issuecomment-243648134

Message:

Compiling textnonce v0.3.4
/home/evgeny/.cargo/registry/src/github.com-1ecc6299db9ec823/formdata-0.8.4/build.rs:20:35: 20:48 error: mismatched types [E0308]
/home/evgeny/.cargo/registry/src/github.com-1ecc6299db9ec823/formdata-0.8.4/build.rs:20 ::serde_codegen::register(&mut registry);
^~~~~~~~~~~~~
/home/evgeny/.cargo/registry/src/github.com-1ecc6299db9ec823/formdata-0.8.4/build.rs:20:35: 20:48 help: run rustc --explain E0308 to see a detailed explanation
/home/evgeny/.cargo/registry/src/github.com-1ecc6299db9ec823/formdata-0.8.4/build.rs:20:35: 20:48 note: expected type &mut syntex::Registry
/home/evgeny/.cargo/registry/src/github.com-1ecc6299db9ec823/formdata-0.8.4/build.rs:20:35: 20:48 note: found type &mut syntex::Registry
/home/evgeny/.cargo/registry/src/github.com-1ecc6299db9ec823/formdata-0.8.4/build.rs:20:35: 20:48 note: Perhaps two different versions of crate syntex are being used?
/home/evgeny/.cargo/registry/src/github.com-1ecc6299db9ec823/formdata-0.8.4/build.rs:20 ::serde_codegen::register(&mut registry);
^~~~~~~~~~~~~
/home/evgeny/.cargo/registry/src/github.com-1ecc6299db9ec823/textnonce-0.3.4/build.rs:20:35: 20:48 error: mismatched types [E0308]
/home/evgeny/.cargo/registry/src/github.com-1ecc6299db9ec823/textnonce-0.3.4/build.rs:20 ::serde_codegen::register(&mut registry);
^~~~~~~~~~~~~
/home/evgeny/.cargo/registry/src/github.com-1ecc6299db9ec823/textnonce-0.3.4/build.rs:20:35: 20:48 help: run rustc --explain E0308 to see a detailed explanation
/home/evgeny/.cargo/registry/src/github.com-1ecc6299db9ec823/textnonce-0.3.4/build.rs:20:35: 20:48 note: expected type &mut syntex::Registry
/home/evgeny/.cargo/registry/src/github.com-1ecc6299db9ec823/textnonce-0.3.4/build.rs:20:35: 20:48 note: found type &mut syntex::Registry
/home/evgeny/.cargo/registry/src/github.com-1ecc6299db9ec823/textnonce-0.3.4/build.rs:20:35: 20:48 note: Perhaps two different versions of crate syntex are being used?
/home/evgeny/.cargo/registry/src/github.com-1ecc6299db9ec823/textnonce-0.3.4/build.rs:20 ::serde_codegen::register(&mut registry);
^~~~~~~~~~~~~
error: aborting due to previous error
error: aborting due to previous error
Build failed, waiting for other jobs to finish...
error: Could not compile textnonce.
mikedilger commented 7 years ago

I know this is not the answer anyone is looking for. I would love it to just work out of the box without anyone understanding the intricacies of cargo. However, here is a hack that will synchronize the versions and get it working for you:

cargo update -p serde:0.8.5 --precise 0.7.15
cargo update -p syntex:0.43.0 --precise 0.39.0
mikedilger commented 7 years ago

BTW, newer versions of formdata drop serde entirely (because hyper headers don't support it) and these annoyances are now gone. Unfortunately the API changed a bit too, so it's not quite a drop-in replacement.

mrLSD commented 7 years ago

Any idea?

$ cargo update -p serde:0.8.5 --precise 0.7.15 error: package id specification serde:0.8.5 matched no packages

$ cargo update -p syntex:0.43.0 --precise 0.39.0 error: package id specification syntex:0.43.0 matched no packages

mikedilger commented 7 years ago

Those particular commands worked when I compiled pencil. If you are compiling a program that depends on pencil, you may need other ones, especially with an existing Cargo.lock file. Look in your Cargo.lock for the multiple versions of serde and syntex and force cargo to use just one version with a similar command.

A number of packages now are specifying ranges of version numbers for these AST-specific packages. Usually that allows you to find a version that works for all of the packages involved. Unfortunately cargo isn't doing that for us yet.

mrLSD commented 7 years ago

I clone:

https://github.com/fengsp/pencil

then:


cd pencil/hello
$ cargo build
   ...
   Compiling formdata v0.8.4
   Compiling textnonce v0.3.4
/home/evgeny/.cargo/registry/src/github.com-1ecc6299db9ec823/textnonce-0.3.4/build.rs:20:35: 20:48/home/evgeny/.cargo/registry/src/github.com-1ecc6299db9ec823/formdata-0.8.4/build.rs:20:35: 20:48  errorerror: : mismatched typesmismatched types [ [E0308E0308]]

/home/evgeny/.cargo/registry/src/github.com-1ecc6299db9ec823/formdata-0.8.4/build.rs/home/evgeny/.cargo/registry/src/github.com-1ecc6299db9ec823/textnonce-0.3.4/build.rs:20 :20         ::serde_codegen::register(&mut registry);        ::serde_codegen::register(&mut registry);

                                                                                                                                                             ^~~~~~~~~~~~~^~~~~~~~~~~~~

/home/evgeny/.cargo/registry/src/github.com-1ecc6299db9ec823/formdata-0.8.4/build.rs:20:35: 20:48/home/evgeny/.cargo/registry/src/github.com-1ecc6299db9ec823/textnonce-0.3.4/build.rs:20:35: 20:48  helphelp: : run `rustc --explain E0308` to see a detailed explanationrun `rustc --explain E0308` to see a detailed explanation

/home/evgeny/.cargo/registry/src/github.com-1ecc6299db9ec823/textnonce-0.3.4/build.rs:20:35: 20:48/home/evgeny/.cargo/registry/src/github.com-1ecc6299db9ec823/formdata-0.8.4/build.rs:20:35: 20:48  notenote: : expected type `&mut syntex::Registry`expected type `&mut syntex::Registry`

/home/evgeny/.cargo/registry/src/github.com-1ecc6299db9ec823/textnonce-0.3.4/build.rs:20:35: 20:48/home/evgeny/.cargo/registry/src/github.com-1ecc6299db9ec823/formdata-0.8.4/build.rs:20:35: 20:48  notenote: :    found type `&mut syntex::Registry`   found type `&mut syntex::Registry`

/home/evgeny/.cargo/registry/src/github.com-1ecc6299db9ec823/textnonce-0.3.4/build.rs:20:35: 20:48/home/evgeny/.cargo/registry/src/github.com-1ecc6299db9ec823/formdata-0.8.4/build.rs:20:35: 20:48  notenote: : Perhaps two different versions of crate `syntex` are being used?Perhaps two different versions of crate `syntex` are being used?

/home/evgeny/.cargo/registry/src/github.com-1ecc6299db9ec823/textnonce-0.3.4/build.rs/home/evgeny/.cargo/registry/src/github.com-1ecc6299db9ec823/formdata-0.8.4/build.rs:20 :20         ::serde_codegen::register(&mut registry);        ::serde_codegen::register(&mut registry);

                                                                                                                                                                                                                                                     ^~~~~~~~~~~~~^~~~~~~~~~~~~

errorerror: : aborting due to previous erroraborting due to previous error

Build failed, waiting for other jobs to finish...
error: Could not compile `formdata`.

To learn more, run the command again with --verbose.

pencil/examples/hello$ cargo update -p syntex:0.43.0 --precise 0.39.0
    Updating registry `https://github.com/rust-lang/crates.io-index`
    Removing syntex v0.43.0
    Removing syntex_errors v0.43.0
    Removing syntex_pos v0.43.0
    Removing syntex_syntax v0.43.0

pencil/examples/hello$ cargo build

end got many-many errors...

For reprodusing error, you should: