shadowsocks / shadowsocks-rust

A Rust port of shadowsocks
https://shadowsocks.org/
MIT License
8.6k stars 1.17k forks source link

cross build error: error[E0252]: the name `TlsStream` is defined multiple times #298

Closed abcfy2 closed 4 years ago

abcfy2 commented 4 years ago

The latest v1.8.20-alpha.1 cross build error:

$ RUSTFLAGS="-Ctarget-feature=+aes" cross build --target x86_64-unknown-linux-gnu --release --features "aes-pmac-siv openssl-vendored sodium rc4 aes-cfb aes-ctr local-http local-http-native-tls local-tunnel local-socks4 local-redir"
Unable to find image 'rustembedded/cross:x86_64-unknown-linux-gnu-0.2.1' locally
x86_64-unknown-linux-gnu-0.2.1: Pulling from rustembedded/cross
b5e173e44934: Pull complete 
29047100b040: Pull complete 
15743a713c2a: Pull complete 
4b6bc9e29877: Pull complete 
1123a44ff793: Pull complete 
b4abb5865867: Pull complete 
9fdbb524b1c4: Pull complete 
2350ee5e55fc: Pull complete 
968cdcbf9025: Pull complete 
a35b78509a07: Pull complete 
0b2212848106: Pull complete 
1e800e929340: Pull complete 
03e3688a1c75: Pull complete 
39fbe813311d: Pull complete 
ca9b9e19e390: Pull complete 
b870dbe38f53: Pull complete 
a87354bc0877: Pull complete 
Digest: sha256:9f368a726a8ba08559451cd64160f7d2b47f6180ad024a46e31d29cc85dd81ff
Status: Downloaded newer image for rustembedded/cross:x86_64-unknown-linux-gnu-0.2.1
   Compiling cfg-if v0.1.10
   Compiling lazy_static v1.4.0
   Compiling futures-core v0.3.6
   Compiling slab v0.4.2
   Compiling once_cell v1.4.1
   Compiling bytes v0.5.6
   Compiling smallvec v1.4.2
   Compiling scopeguard v1.1.0
   Compiling fnv v1.0.7
   Compiling arc-swap v0.4.7
   Compiling pin-project-lite v0.1.10
   Compiling futures-sink v0.3.6
   Compiling tower-service v0.3.0
   Compiling pin-utils v0.1.0
   Compiling futures-io v0.3.6
   Compiling untrusted v0.7.1
   Compiling spin v0.5.2
   Compiling subtle v1.0.0
   Compiling opaque-debug v0.2.3
   Compiling tinyvec v0.3.4
   Compiling matches v0.1.8
   Compiling itoa v0.4.6
   Compiling tower-layer v0.3.0
   Compiling ppv-lite86 v0.2.9
   Compiling percent-encoding v2.1.0
   Compiling gimli v0.22.0
   Compiling byte-tools v0.3.1
   Compiling adler v0.2.3
   Compiling foreign-types-shared v0.1.1
   Compiling match_cfg v0.1.0
   Compiling cfg-if v1.0.0
   Compiling openssl-probe v0.1.2
   Compiling object v0.21.1
   Compiling hashbrown v0.9.1
   Compiling rustc-demangle v0.1.17
   Compiling base64 v0.11.0
   Compiling unicode-width v0.1.8
   Compiling zeroize v1.1.1
   Compiling quick-error v1.2.3
   Compiling regex-syntax v0.6.18
   Compiling linked-hash-map v0.5.3
   Compiling ucd-trie v0.1.3
   Compiling try-lock v0.2.3
   Compiling httpdate v0.3.2
   Compiling ipnet v2.3.0
   Compiling siphasher v0.3.3
   Compiling strsim v0.8.0
   Compiling bit-vec v0.6.2
   Compiling ansi_term v0.11.0
   Compiling termcolor v1.1.0
   Compiling checked_int_cast v1.0.0
   Compiling fake-simd v0.1.2
   Compiling dtoa v0.4.6
   Compiling vec_map v0.8.2
   Compiling base64 v0.12.3
   Compiling byte_string v1.0.0
   Compiling strum v0.18.0
   Compiling lru_time_cache v0.10.0
   Compiling libc v0.2.79
   Compiling log v0.4.11
   Compiling memchr v2.3.3
   Compiling typenum v1.12.0
   Compiling proc-macro-nested v0.1.6
   Compiling byteorder v1.3.4
   Compiling getrandom v0.1.15
   Compiling lock_api v0.3.4
   Compiling bitflags v1.2.1
   Compiling tracing-core v0.1.17
   Compiling thread_local v1.0.1
   Compiling unicode-bidi v0.3.4
   Compiling serde v1.0.116
   Compiling futures-channel v0.3.6
   Compiling futures-task v0.3.6
   Compiling block-padding v0.1.5
   Compiling foreign-types v0.3.2
   Compiling ryu v1.0.5
   Compiling httparse v1.3.4
   Compiling serde_json v1.0.58
   Compiling pest v2.1.3
   Compiling unicode-normalization v0.1.13
   Compiling http v0.2.1
   Compiling lru-cache v0.1.2
   Compiling qrcode v0.12.0
   Compiling iprange v0.6.3
   Compiling ring v0.16.15
   Compiling num-traits v0.2.12
   Compiling miniz_oxide v0.4.3
   Compiling indexmap v1.6.0
   Compiling num-integer v0.1.43
   Compiling libsodium-sys v0.2.6
   Compiling openssl-sys v0.9.58
   Compiling want v0.3.0
   Compiling aho-corasick v0.7.13
   Compiling idna v0.2.0
   Compiling generic-array v0.12.3
   Compiling pin-project v0.4.27
   Compiling tracing v0.1.21
   Compiling thiserror v1.0.21
   Compiling futures-util v0.3.6
   Compiling tower-discover v0.3.0
   Compiling tower-load-shed v0.3.0
   Compiling net2 v0.2.35
   Compiling iovec v0.1.4
   Compiling parking_lot_core v0.7.2
   Compiling num_cpus v1.13.0
   Compiling signal-hook-registry v1.2.1
   Compiling hostname v0.3.1
   Compiling term_size v0.3.2
   Compiling atty v0.2.14
   Compiling socket2 v0.3.15
   Compiling time v0.1.44
   Compiling block-cipher-trait v0.6.2
   Compiling crypto-mac v0.7.0
   Compiling digest v0.8.1
   Compiling dbl v0.2.1
   Compiling stream-cipher v0.3.2
   Compiling aead v0.2.0
   Compiling block-buffer v0.7.3
   Compiling url v2.1.1
   Compiling regex v1.3.9
   Compiling addr2line v0.13.0
   Compiling http-body v0.3.1
   Compiling mio v0.6.22
   Compiling parking_lot v0.10.2
   Compiling rand_core v0.5.1
   Compiling resolv-conf v0.6.3
   Compiling textwrap v0.11.0
   Compiling aes-soft v0.3.3
   Compiling cmac v0.2.0
   Compiling pmac v0.2.0
   Compiling hmac v0.7.1
   Compiling ctr v0.3.2
   Compiling sha-1 v0.8.2
   Compiling md-5 v0.8.0
   Compiling chrono v0.4.19
   Compiling backtrace v0.3.53
   Compiling rand_chacha v0.2.2
   Compiling clap v2.33.3
   Compiling aes v0.3.2
   Compiling mio-uds v0.6.8
   Compiling hkdf v0.8.0
   Compiling env_logger v0.7.1
   Compiling aes-siv v0.2.0
   Compiling tokio v0.2.22
   Compiling rand v0.7.3
   Compiling webpki v0.21.3
   Compiling sct v0.6.0
   Compiling miscreant v0.5.2
   Compiling webpki-roots v0.19.0
   Compiling rustls v0.17.0
   Compiling futures-executor v0.3.6
   Compiling tower-util v0.3.1
   Compiling bloomfilter v1.0.3
   Compiling futures v0.3.6
   Compiling serde_urlencoded v0.6.1
   Compiling json5 v0.2.8
   Compiling rustls-native-certs v0.3.0
   Compiling tokio-util v0.3.1
   Compiling tower-load v0.3.0
   Compiling tower-retry v0.3.0
   Compiling tower-timeout v0.3.0
   Compiling trust-dns-proto v0.19.5
   Compiling tower-buffer v0.3.0
   Compiling tokio-rustls v0.13.1
   Compiling tower-limit v0.3.1
   Compiling h2 v0.2.6
   Compiling tower v0.3.1
   Compiling trust-dns-resolver v0.19.5
   Compiling hyper v0.13.8
   Compiling openssl v0.10.30
   Compiling native-tls v0.2.4
   Compiling tokio-native-tls v0.1.0
   Compiling shadowsocks-rust v1.8.20-alpha.1 (/project)
error[E0252]: the name `TlsStream` is defined multiple times
  --> src/relay/tcprelay/http_tls/mod.rs:15:37
   |
9  | pub use self::native_tls::{TlsAcceptor, TlsStream};
   |                                         --------- previous import of the type `TlsStream` here
...
15 | pub use self::rustls::{TlsAcceptor, TlsStream};
   |                                     ^^^^^^^^^ `TlsStream` reimported here
   |
   = note: `TlsStream` must be defined only once in the type namespace of this module
help: you can use `as` to change the binding name of the import
   |
15 | pub use self::rustls::{TlsAcceptor, TlsStream as OtherTlsStream};
   |                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0428]: the name `Https` is defined multiple times
  --> src/relay/tcprelay/http_local.rs:64:5
   |
62 |     Https(#[pin] tokio_native_tls::TlsStream<ProxyStream>, bool),
   |     ------------------------------------------------------------ previous definition of the type `Https` here
63 |     #[cfg(feature = "local-http-rustls")]
64 |     Https(#[pin] tokio_rustls::client::TlsStream<ProxyStream>, bool),
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `Https` redefined here
   |
   = note: `Https` must be defined only once in the type namespace of this enum

error[E0428]: the name `Https` is defined multiple times
  --> src/relay/tcprelay/http_local.rs:58:1
   |
58 | #[pin_project(project = ProxyHttpStreamProj)]
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   | |
   | `Https` redefined here
   | previous definition of the type `Https` here
   |
   = note: `Https` must be defined only once in the type namespace of this enum
   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0252]: the name `TlsAcceptor` is defined multiple times
  --> src/relay/tcprelay/http_tls/mod.rs:15:24
   |
9  | pub use self::native_tls::{TlsAcceptor, TlsStream};
   |                            ----------- previous import of the type `TlsAcceptor` here
...
15 | pub use self::rustls::{TlsAcceptor, TlsStream};
   |                        ^^^^^^^^^^^ `TlsAcceptor` reimported here
   |
   = note: `TlsAcceptor` must be defined only once in the type namespace of this module
help: you can use `as` to change the binding name of the import
   |
15 | pub use self::rustls::{TlsAcceptor as OtherTlsAcceptor, TlsStream};
   |                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0201]: duplicate definitions with name `connect_https`:
   --> src/relay/tcprelay/http_local.rs:98:5
    |
73  | /     async fn connect_https(stream: ProxyStream, domain: &str) -> io::Result<ProxyHttpStream> {
74  | |         use native_tls::TlsConnector;
75  | |
76  | |         let cx = match TlsConnector::builder().build() {
...   |
94  | |         }
95  | |     }
    | |_____- previous definition of `connect_https` here
...
98  | /     async fn connect_https(stream: ProxyStream, domain: &str) -> io::Result<ProxyHttpStream> {
99  | |         use lazy_static::lazy_static;
100 | |         use log::warn;
101 | |         use tokio_rustls::{
...   |
147 | |         Ok(ProxyHttpStream::Https(tls_stream, negociated_http2))
148 | |     }
    | |_____^ duplicate definition

error: aborting due to 5 previous errors

Some errors have detailed explanations: E0201, E0252, E0428.
For more information about an error, try `rustc --explain E0201`.
error: could not compile `shadowsocks-rust`.

To learn more, run the command again with --verbose.
zonyitoo commented 4 years ago

https://github.com/shadowsocks/shadowsocks-rust/blob/62df3159229cfc35a5117024e52a4653e91405ed/Cargo.toml#L42

Since local-http-rustls is in the default feature list, you shouldn't set local-http-native-tls in your --feature argument.

abcfy2 commented 4 years ago

OK. Thanks