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

Has tcmalloc-vendored been deprecated? #328

Closed
IceCodeNew opened this issue Nov 26, 2020 · 7 comments
Closed

Has tcmalloc-vendored been deprecated? #328

IceCodeNew opened this issue Nov 26, 2020 · 7 comments

Comments

@IceCodeNew
Copy link

编译环境(alpine):https://github.com/IceCodeNew/rust-collection/blob/135976d54f5b6a1fba369e70661e0d86b39ebd08/nightly_build_base.Dockerfile

编译参数:cargo install --bins -j "$(nproc)" --target x86_64-unknown-linux-musl --no-default-features --features "trust-dns local-http local-http-rustls local-tunnel local-socks4 local-redir tcmalloc-vendored" --git 'https://github.com/shadowsocks/shadowsocks-rust.git' --verbose

错误输出(点击展开):

Compiling shadowsocks-rust v1.9.0 (/root/.cargo/git/checkouts/shadowsocks-rust-b6923cbb7e5e6de2/5d42ac9) Running `rustc --crate-name shadowsocks --edition=2018 src/lib.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type lib --emit=dep-info,metadata,link -C opt-level=3 -C panic=abort -C linker-plugin-lto -C codegen-units=1 --cfg 'feature="http"' --cfg 'feature="hyper"' --cfg 'feature="local-http"' --cfg 'feature="local-http-rustls"' --cfg 'feature="local-redir"' --cfg 'feature="local-socks4"' --cfg 'feature="local-tunnel"' --cfg 'feature="rustls-native-certs"' --cfg 'feature="tcmalloc"' --cfg 'feature="tcmalloc-vendored"' --cfg 'feature="tokio-rustls"' --cfg 'feature="tower"' --cfg 'feature="trust-dns"' --cfg 'feature="trust-dns-resolver"' --cfg 'feature="webpki-roots"' -C metadata=b3f2c7e0800311a7 -C extra-filename=-b3f2c7e0800311a7 --out-dir /tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps --target x86_64-unknown-linux-musl -L dependency=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps -L dependency=/tmp/cargo-installa8nRVA/release/deps --extern async_trait=/tmp/cargo-installa8nRVA/release/deps/libasync_trait-05e382079047af47.so --extern base64=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libbase64-166646a7f9b6e42a.rmeta --extern bloomfilter=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libbloomfilter-d0f776d37df6d444.rmeta --extern byte_string=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libbyte_string-cbe66a8afe1e517b.rmeta --extern byteorder=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libbyteorder-471c9ea5b5c19085.rmeta --extern bytes=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libbytes-63dab56ce9c2dd49.rmeta --extern cfg_if=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libcfg_if-21fe4733b70b6c03.rmeta --extern clap=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libclap-2135e052ce96db4c.rmeta --extern daemonize=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libdaemonize-9c882605e65dbe0b.rmeta --extern futures=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libfutures-73bc14d6288696c6.rmeta --extern http=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libhttp-0480d088866f7d9e.rmeta --extern hyper=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libhyper-d6080fbd0d038d4b.rmeta --extern ipnet=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libipnet-b118b81678214fb0.rmeta --extern iprange=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libiprange-b1998321b4b79dc1.rmeta --extern json5=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libjson5-8a9172447f956626.rmeta --extern lazy_static=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/liblazy_static-50a9ac717074720d.rmeta --extern libc=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/liblibc-67bb363af1afaa89.rmeta --extern log=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/liblog-82052da370009fc5.rmeta --extern log4rs=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/liblog4rs-de28d4569559807a.rmeta --extern lru_time_cache=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/liblru_time_cache-c9ca4087e9316fd7.rmeta --extern mio=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libmio-2fbe2d68f55e5548.rmeta --extern pin_project=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libpin_project-38419f996887a078.rmeta --extern qrcode=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libqrcode-f6511b898d2d36d4.rmeta --extern rand=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/librand-0469b89ecde29ee4.rmeta --extern regex=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libregex-26ee8cd368cdc99c.rmeta --extern ring=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libring-f94d11c5bdff8e5e.rmeta --extern rustls_native_certs=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/librustls_native_certs-248f2e253d7a8a8d.rmeta --extern serde=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libserde-95fcd5280928a721.rmeta --extern serde_json=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libserde_json-e8cca79c27b30b9a.rmeta --extern serde_urlencoded=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libserde_urlencoded-b086139c5ff0fe38.rmeta --extern shadowsocks_crypto=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libshadowsocks_crypto-b483e4b896d107be.rmeta --extern socket2=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libsocket2-3537db5fedbb896f.rmeta --extern spin=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libspin-0fbc369cf905f114.rmeta --extern strum=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libstrum-1b96f463398f2a6d.rmeta --extern strum_macros=/tmp/cargo-installa8nRVA/release/deps/libstrum_macros-0708b7f83e63825f.so --extern tcmalloc=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libtcmalloc-52c1e3ec81741ea1.rmeta --extern tokio=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libtokio-b88008ebdac4152b.rmeta --extern tokio_rustls=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libtokio_rustls-b2f55baf2a2339b1.rmeta --extern tower=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libtower-fe2170a5bad79ffd.rmeta --extern trust_dns_resolver=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libtrust_dns_resolver-5995a733ca614702.rmeta --extern url=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/liburl-401d9efe098daceb.rmeta --extern webpki_roots=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libwebpki_roots-f260a6033dcb7beb.rmeta -L native=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/build/ring-f3c65820b0aa48c0/out` Running `rustc --crate-name ssmanager --edition=2018 src/bin/manager.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type bin --emit=dep-info,link -C opt-level=3 -C panic=abort -C lto=fat -C codegen-units=1 --cfg 'feature="http"' --cfg 'feature="hyper"' --cfg 'feature="local-http"' --cfg 'feature="local-http-rustls"' --cfg 'feature="local-redir"' --cfg 'feature="local-socks4"' --cfg 'feature="local-tunnel"' --cfg 'feature="rustls-native-certs"' --cfg 'feature="tcmalloc"' --cfg 'feature="tcmalloc-vendored"' --cfg 'feature="tokio-rustls"' --cfg 'feature="tower"' --cfg 'feature="trust-dns"' --cfg 'feature="trust-dns-resolver"' --cfg 'feature="webpki-roots"' -C metadata=b6f727169a7fa721 -C extra-filename=-b6f727169a7fa721 --out-dir /tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps --target x86_64-unknown-linux-musl -L dependency=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps -L dependency=/tmp/cargo-installa8nRVA/release/deps --extern async_trait=/tmp/cargo-installa8nRVA/release/deps/libasync_trait-05e382079047af47.so --extern base64=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libbase64-166646a7f9b6e42a.rlib --extern bloomfilter=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libbloomfilter-d0f776d37df6d444.rlib --extern byte_string=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libbyte_string-cbe66a8afe1e517b.rlib --extern byteorder=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libbyteorder-471c9ea5b5c19085.rlib --extern bytes=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libbytes-63dab56ce9c2dd49.rlib --extern cfg_if=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libcfg_if-21fe4733b70b6c03.rlib --extern clap=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libclap-2135e052ce96db4c.rlib --extern daemonize=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libdaemonize-9c882605e65dbe0b.rlib --extern futures=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libfutures-73bc14d6288696c6.rlib --extern http=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libhttp-0480d088866f7d9e.rlib --extern hyper=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libhyper-d6080fbd0d038d4b.rlib --extern ipnet=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libipnet-b118b81678214fb0.rlib --extern iprange=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libiprange-b1998321b4b79dc1.rlib --extern json5=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libjson5-8a9172447f956626.rlib --extern lazy_static=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/liblazy_static-50a9ac717074720d.rlib --extern libc=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/liblibc-67bb363af1afaa89.rlib --extern log=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/liblog-82052da370009fc5.rlib --extern log4rs=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/liblog4rs-de28d4569559807a.rlib --extern lru_time_cache=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/liblru_time_cache-c9ca4087e9316fd7.rlib --extern mio=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libmio-2fbe2d68f55e5548.rlib --extern pin_project=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libpin_project-38419f996887a078.rlib --extern qrcode=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libqrcode-f6511b898d2d36d4.rlib --extern rand=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/librand-0469b89ecde29ee4.rlib --extern regex=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libregex-26ee8cd368cdc99c.rlib --extern ring=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libring-f94d11c5bdff8e5e.rlib --extern rustls_native_certs=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/librustls_native_certs-248f2e253d7a8a8d.rlib --extern serde=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libserde-95fcd5280928a721.rlib --extern serde_json=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libserde_json-e8cca79c27b30b9a.rlib --extern serde_urlencoded=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libserde_urlencoded-b086139c5ff0fe38.rlib --extern shadowsocks_crypto=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libshadowsocks_crypto-b483e4b896d107be.rlib --extern shadowsocks=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libshadowsocks-b3f2c7e0800311a7.rlib --extern socket2=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libsocket2-3537db5fedbb896f.rlib --extern spin=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libspin-0fbc369cf905f114.rlib --extern strum=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libstrum-1b96f463398f2a6d.rlib --extern strum_macros=/tmp/cargo-installa8nRVA/release/deps/libstrum_macros-0708b7f83e63825f.so --extern tcmalloc=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libtcmalloc-52c1e3ec81741ea1.rlib --extern tokio=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libtokio-b88008ebdac4152b.rlib --extern tokio_rustls=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libtokio_rustls-b2f55baf2a2339b1.rlib --extern tower=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libtower-fe2170a5bad79ffd.rlib --extern trust_dns_resolver=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libtrust_dns_resolver-5995a733ca614702.rlib --extern url=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/liburl-401d9efe098daceb.rlib --extern webpki_roots=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libwebpki_roots-f260a6033dcb7beb.rlib -L native=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/build/ring-f3c65820b0aa48c0/out` Running `rustc --crate-name ssurl --edition=2018 src/bin/ssurl.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type bin --emit=dep-info,link -C opt-level=3 -C panic=abort -C lto=fat -C codegen-units=1 --cfg 'feature="http"' --cfg 'feature="hyper"' --cfg 'feature="local-http"' --cfg 'feature="local-http-rustls"' --cfg 'feature="local-redir"' --cfg 'feature="local-socks4"' --cfg 'feature="local-tunnel"' --cfg 'feature="rustls-native-certs"' --cfg 'feature="tcmalloc"' --cfg 'feature="tcmalloc-vendored"' --cfg 'feature="tokio-rustls"' --cfg 'feature="tower"' --cfg 'feature="trust-dns"' --cfg 'feature="trust-dns-resolver"' --cfg 'feature="webpki-roots"' -C metadata=b82fd912ff06d33c -C extra-filename=-b82fd912ff06d33c --out-dir /tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps --target x86_64-unknown-linux-musl -L dependency=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps -L dependency=/tmp/cargo-installa8nRVA/release/deps --extern async_trait=/tmp/cargo-installa8nRVA/release/deps/libasync_trait-05e382079047af47.so --extern base64=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libbase64-166646a7f9b6e42a.rlib --extern bloomfilter=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libbloomfilter-d0f776d37df6d444.rlib --extern byte_string=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libbyte_string-cbe66a8afe1e517b.rlib --extern byteorder=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libbyteorder-471c9ea5b5c19085.rlib --extern bytes=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libbytes-63dab56ce9c2dd49.rlib --extern cfg_if=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libcfg_if-21fe4733b70b6c03.rlib --extern clap=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libclap-2135e052ce96db4c.rlib --extern daemonize=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libdaemonize-9c882605e65dbe0b.rlib --extern futures=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libfutures-73bc14d6288696c6.rlib --extern http=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libhttp-0480d088866f7d9e.rlib --extern hyper=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libhyper-d6080fbd0d038d4b.rlib --extern ipnet=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libipnet-b118b81678214fb0.rlib --extern iprange=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libiprange-b1998321b4b79dc1.rlib --extern json5=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libjson5-8a9172447f956626.rlib --extern lazy_static=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/liblazy_static-50a9ac717074720d.rlib --extern libc=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/liblibc-67bb363af1afaa89.rlib --extern log=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/liblog-82052da370009fc5.rlib --extern log4rs=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/liblog4rs-de28d4569559807a.rlib --extern lru_time_cache=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/liblru_time_cache-c9ca4087e9316fd7.rlib --extern mio=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libmio-2fbe2d68f55e5548.rlib --extern pin_project=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libpin_project-38419f996887a078.rlib --extern qrcode=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libqrcode-f6511b898d2d36d4.rlib --extern rand=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/librand-0469b89ecde29ee4.rlib --extern regex=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libregex-26ee8cd368cdc99c.rlib --extern ring=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libring-f94d11c5bdff8e5e.rlib --extern rustls_native_certs=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/librustls_native_certs-248f2e253d7a8a8d.rlib --extern serde=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libserde-95fcd5280928a721.rlib --extern serde_json=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libserde_json-e8cca79c27b30b9a.rlib --extern serde_urlencoded=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libserde_urlencoded-b086139c5ff0fe38.rlib --extern shadowsocks_crypto=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libshadowsocks_crypto-b483e4b896d107be.rlib --extern shadowsocks=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libshadowsocks-b3f2c7e0800311a7.rlib --extern socket2=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libsocket2-3537db5fedbb896f.rlib --extern spin=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libspin-0fbc369cf905f114.rlib --extern strum=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libstrum-1b96f463398f2a6d.rlib --extern strum_macros=/tmp/cargo-installa8nRVA/release/deps/libstrum_macros-0708b7f83e63825f.so --extern tcmalloc=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libtcmalloc-52c1e3ec81741ea1.rlib --extern tokio=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libtokio-b88008ebdac4152b.rlib --extern tokio_rustls=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libtokio_rustls-b2f55baf2a2339b1.rlib --extern tower=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libtower-fe2170a5bad79ffd.rlib --extern trust_dns_resolver=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libtrust_dns_resolver-5995a733ca614702.rlib --extern url=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/liburl-401d9efe098daceb.rlib --extern webpki_roots=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libwebpki_roots-f260a6033dcb7beb.rlib -L native=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/build/ring-f3c65820b0aa48c0/out` error: linking with `cc` failed: exit code: 1 | = note: "cc" "-Wl,--as-needed" "-Wl,-z,noexecstack" "-m64" "-Wl,--eh-frame-hdr" "-nostartfiles" "/root/.rustup/toolchains/nightly-x86_64-unknown-linux-musl/lib/rustlib/x86_64-unknown-linux-musl/lib/self-contained/rcrt1.o" "/root/.rustup/toolchains/nightly-x86_64-unknown-linux-musl/lib/rustlib/x86_64-unknown-linux-musl/lib/self-contained/crti.o" "-L" "/root/.rustup/toolchains/nightly-x86_64-unknown-linux-musl/lib/rustlib/x86_64-unknown-linux-musl/lib" "-L" "/root/.rustup/toolchains/nightly-x86_64-unknown-linux-musl/lib/rustlib/x86_64-unknown-linux-musl/lib/self-contained" "/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/ssurl-b82fd912ff06d33c.ssurl.3zltxwrq-cgu.0.rcgu.o" "-o" "/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/ssurl-b82fd912ff06d33c" "-Wl,--gc-sections" "-static-pie" "-Wl,-zrelro" "-Wl,-znow" "-Wl,-O1" "-nodefaultlibs" "-L" "/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps" "-L" "/tmp/cargo-installa8nRVA/release/deps" "-L" "/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/build/ring-f3c65820b0aa48c0/out" "-L" "/root/.rustup/toolchains/nightly-x86_64-unknown-linux-musl/lib/rustlib/x86_64-unknown-linux-musl/lib" "-Wl,-Bstatic" "/tmp/rustcWFpYEz/libring-f94d11c5bdff8e5e.rlib" "-Wl,--start-group" "/tmp/rustcWFpYEz/libunwind-94c746280016be9c.rlib" "/tmp/rustcWFpYEz/liblibc-a6df7fa84d406b53.rlib" "-Wl,--end-group" "/root/.rustup/toolchains/nightly-x86_64-unknown-linux-musl/lib/rustlib/x86_64-unknown-linux-musl/lib/libcompiler_builtins-a256d4446bd09d00.rlib" "-Wl,-Bdynamic" "-ltcmalloc" "/root/.rustup/toolchains/nightly-x86_64-unknown-linux-musl/lib/rustlib/x86_64-unknown-linux-musl/lib/self-contained/crtn.o" = note: /usr/lib/gcc/x86_64-alpine-linux-musl/10.2.1/../../../../x86_64-alpine-linux-musl/bin/ld: cannot find -ltcmalloc collect2: error: ld returned 1 exit status

error: aborting due to previous error

error: could not compile shadowsocks-rust

Caused by:
process didn't exit successfully: rustc --crate-name ssurl --edition=2018 src/bin/ssurl.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type bin --emit=dep-info,link -C opt-level=3 -C panic=abort -C lto=fat -C codegen-units=1 --cfg 'feature="http"' --cfg 'feature="hyper"' --cfg 'feature="local-http"' --cfg 'feature="local-http-rustls"' --cfg 'feature="local-redir"' --cfg 'feature="local-socks4"' --cfg 'feature="local-tunnel"' --cfg 'feature="rustls-native-certs"' --cfg 'feature="tcmalloc"' --cfg 'feature="tcmalloc-vendored"' --cfg 'feature="tokio-rustls"' --cfg 'feature="tower"' --cfg 'feature="trust-dns"' --cfg 'feature="trust-dns-resolver"' --cfg 'feature="webpki-roots"' -C metadata=b82fd912ff06d33c -C extra-filename=-b82fd912ff06d33c --out-dir /tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps --target x86_64-unknown-linux-musl -L dependency=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps -L dependency=/tmp/cargo-installa8nRVA/release/deps --extern async_trait=/tmp/cargo-installa8nRVA/release/deps/libasync_trait-05e382079047af47.so --extern base64=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libbase64-166646a7f9b6e42a.rlib --extern bloomfilter=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libbloomfilter-d0f776d37df6d444.rlib --extern byte_string=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libbyte_string-cbe66a8afe1e517b.rlib --extern byteorder=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libbyteorder-471c9ea5b5c19085.rlib --extern bytes=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libbytes-63dab56ce9c2dd49.rlib --extern cfg_if=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libcfg_if-21fe4733b70b6c03.rlib --extern clap=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libclap-2135e052ce96db4c.rlib --extern daemonize=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libdaemonize-9c882605e65dbe0b.rlib --extern futures=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libfutures-73bc14d6288696c6.rlib --extern http=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libhttp-0480d088866f7d9e.rlib --extern hyper=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libhyper-d6080fbd0d038d4b.rlib --extern ipnet=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libipnet-b118b81678214fb0.rlib --extern iprange=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libiprange-b1998321b4b79dc1.rlib --extern json5=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libjson5-8a9172447f956626.rlib --extern lazy_static=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/liblazy_static-50a9ac717074720d.rlib --extern libc=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/liblibc-67bb363af1afaa89.rlib --extern log=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/liblog-82052da370009fc5.rlib --extern log4rs=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/liblog4rs-de28d4569559807a.rlib --extern lru_time_cache=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/liblru_time_cache-c9ca4087e9316fd7.rlib --extern mio=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libmio-2fbe2d68f55e5548.rlib --extern pin_project=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libpin_project-38419f996887a078.rlib --extern qrcode=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libqrcode-f6511b898d2d36d4.rlib --extern rand=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/librand-0469b89ecde29ee4.rlib --extern regex=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libregex-26ee8cd368cdc99c.rlib --extern ring=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libring-f94d11c5bdff8e5e.rlib --extern rustls_native_certs=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/librustls_native_certs-248f2e253d7a8a8d.rlib --extern serde=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libserde-95fcd5280928a721.rlib --extern serde_json=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libserde_json-e8cca79c27b30b9a.rlib --extern serde_urlencoded=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libserde_urlencoded-b086139c5ff0fe38.rlib --extern shadowsocks_crypto=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libshadowsocks_crypto-b483e4b896d107be.rlib --extern shadowsocks=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libshadowsocks-b3f2c7e0800311a7.rlib --extern socket2=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libsocket2-3537db5fedbb896f.rlib --extern spin=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libspin-0fbc369cf905f114.rlib --extern strum=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libstrum-1b96f463398f2a6d.rlib --extern strum_macros=/tmp/cargo-installa8nRVA/release/deps/libstrum_macros-0708b7f83e63825f.so --extern tcmalloc=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libtcmalloc-52c1e3ec81741ea1.rlib --extern tokio=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libtokio-b88008ebdac4152b.rlib --extern tokio_rustls=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libtokio_rustls-b2f55baf2a2339b1.rlib --extern tower=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libtower-fe2170a5bad79ffd.rlib --extern trust_dns_resolver=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libtrust_dns_resolver-5995a733ca614702.rlib --extern url=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/liburl-401d9efe098daceb.rlib --extern webpki_roots=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/libwebpki_roots-f260a6033dcb7beb.rlib -L native=/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/build/ring-f3c65820b0aa48c0/out (exit code: 1)
warning: build failed, waiting for other jobs to finish...
error: linking with cc failed: exit code: 1
|
= note: "cc" "-Wl,--as-needed" "-Wl,-z,noexecstack" "-m64" "-Wl,--eh-frame-hdr" "-nostartfiles" "/root/.rustup/toolchains/nightly-x86_64-unknown-linux-musl/lib/rustlib/x86_64-unknown-linux-musl/lib/self-contained/rcrt1.o" "/root/.rustup/toolchains/nightly-x86_64-unknown-linux-musl/lib/rustlib/x86_64-unknown-linux-musl/lib/self-contained/crti.o" "-L" "/root/.rustup/toolchains/nightly-x86_64-unknown-linux-musl/lib/rustlib/x86_64-unknown-linux-musl/lib" "-L" "/root/.rustup/toolchains/nightly-x86_64-unknown-linux-musl/lib/rustlib/x86_64-unknown-linux-musl/lib/self-contained" "/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/ssmanager-b6f727169a7fa721.ssmanager.6qk220y8-cgu.0.rcgu.o" "-o" "/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps/ssmanager-b6f727169a7fa721" "-Wl,--gc-sections" "-static-pie" "-Wl,-zrelro" "-Wl,-znow" "-Wl,-O1" "-nodefaultlibs" "-L" "/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/deps" "-L" "/tmp/cargo-installa8nRVA/release/deps" "-L" "/tmp/cargo-installa8nRVA/x86_64-unknown-linux-musl/release/build/ring-f3c65820b0aa48c0/out" "-L" "/root/.rustup/toolchains/nightly-x86_64-unknown-linux-musl/lib/rustlib/x86_64-unknown-linux-musl/lib" "-Wl,-Bstatic" "/tmp/rustcYJzPJW/libring-f94d11c5bdff8e5e.rlib" "-Wl,--start-group" "/tmp/rustcYJzPJW/libunwind-94c746280016be9c.rlib" "/tmp/rustcYJzPJW/liblibc-a6df7fa84d406b53.rlib" "-Wl,--end-group" "/root/.rustup/toolchains/nightly-x86_64-unknown-linux-musl/lib/rustlib/x86_64-unknown-linux-musl/lib/libcompiler_builtins-a256d4446bd09d00.rlib" "-Wl,-Bdynamic" "-ltcmalloc" "/root/.rustup/toolchains/nightly-x86_64-unknown-linux-musl/lib/rustlib/x86_64-unknown-linux-musl/lib/self-contained/crtn.o"
= note: /usr/lib/gcc/x86_64-alpine-linux-musl/10.2.1/../../../../x86_64-alpine-linux-musl/bin/ld: cannot find -ltcmalloc
collect2: error: ld returned 1 exit status

error: aborting due to previous error

error: failed to compile shadowsocks-rust v1.9.0 (https://github.com/shadowsocks/shadowsocks-rust.git#5d42ac93), intermediate artifacts can be found at /tmp/cargo-installa8nRVA

Caused by:
build failed


连接错误信息显示 cannot find -ltcmalloc,我又在 GitHub 仓库里以 malloc 作关键词搜了一下,没有一个文件的文件名匹配这个关键词的。
感觉现在项目应该是已经不再自带 tcmalloc 源码了,README 和 cargo.toml 里相关的部分或许应该删除或修改。

@zonyitoo
Copy link
Collaborator

I cannot reproduce it on my Linux server: 4.9.0-13-amd64 #1 SMP Debian 4.9.228-1 (2020-07-05) x86_64 GNU/Linux.

$ cargo test --features "bundled"
   Compiling tcmalloc-sys v0.3.0 (/root/tcmalloc-rs/tcmalloc-sys)
   Compiling tcmalloc v0.3.0 (/root/tcmalloc-rs)
    Finished test [unoptimized + debuginfo] target(s) in 1m 09s
     Running target/debug/deps/tcmalloc-de38b5d5a4b0dd33

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out

   Doc-tests tcmalloc

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out

I think the main problem is that tcmalloc-sys only builds for the host, but ignores the --target x86_64-unknown-linux-musl.

@zonyitoo
Copy link
Collaborator

I tested with cross:

$ cross build --target x86_64-unknown-linux-gnu
   Compiling proc-macro2 v1.0.24
   Compiling unicode-xid v0.2.1
   Compiling syn v1.0.51
   Compiling libc v0.2.80
   Compiling autocfg v1.0.1
   Compiling cfg-if v0.1.10
   Compiling serde_derive v1.0.117
   Compiling serde v1.0.117
   Compiling cfg-if v1.0.0
   Compiling log v0.4.11
   Compiling once_cell v1.5.2
   Compiling memchr v2.3.4
   Compiling lazy_static v1.4.0
   Compiling futures-core v0.3.8
   Compiling smallvec v1.5.0
   Compiling pin-project-lite v0.2.0
   Compiling scopeguard v1.1.0
   Compiling slab v0.4.2
   Compiling cc v1.0.65
   Compiling proc-macro-hack v0.5.19
   Compiling proc-macro-nested v0.1.6
   Compiling getrandom v0.1.15
   Compiling futures-sink v0.3.8
   Compiling bytes v0.6.0
   Compiling untrusted v0.7.1
   Compiling spin v0.5.2
   Compiling futures-io v0.3.8
   Compiling itoa v0.4.6
   Compiling matches v0.1.8
   Compiling pin-utils v0.1.0
   Compiling ppv-lite86 v0.2.10
   Compiling tinyvec_macros v0.1.0
   Compiling pin-project-internal v0.4.27
   Compiling percent-encoding v2.1.0
   Compiling unicode-segmentation v1.7.1
   Compiling fnv v1.0.7
   Compiling ryu v1.0.5
   Compiling ucd-trie v0.1.3
   Compiling linked-hash-map v0.5.3
   Compiling bytes v0.5.6
   Compiling quick-error v1.2.3
   Compiling crc32fast v1.2.1
   Compiling maplit v1.0.2
   Compiling pin-project-lite v0.1.11
   Compiling match_cfg v0.1.0
   Compiling hashbrown v0.9.1
   Compiling httparse v1.3.4
   Compiling ipnet v2.3.0
   Compiling base64 v0.12.3
   Compiling adler v0.2.3
   Compiling bitflags v1.2.1
   Compiling traitobject v0.1.0
   Compiling serde_json v1.0.59
   Compiling tower-service v0.3.0
   Compiling try-lock v0.2.3
   Compiling dtoa v0.4.6
   Compiling data-encoding v2.3.1
   Compiling unicode-width v0.1.8
   Compiling byteorder v1.3.4
   Compiling boxfnonce v0.1.1
   Compiling arc-swap v0.4.7
   Compiling checked_int_cast v1.0.0
   Compiling crypto2 v0.1.1
   Compiling bit-vec v0.6.2
   Compiling log-mdc v0.1.0
   Compiling strsim v0.8.0
   Compiling vec_map v0.8.2
   Compiling openssl-probe v0.1.2
   Compiling siphasher v0.3.3
   Compiling regex-syntax v0.6.21
   Compiling tower-layer v0.3.0 (https://github.com/tower-rs/tower.git#d4d1c67c)
   Compiling httpdate v0.3.2
   Compiling ansi_term v0.11.0
   Compiling strum v0.19.5
   Compiling byte_string v1.0.0
   Compiling base64 v0.13.0
   Compiling lru_time_cache v0.11.3
   Compiling spin v0.7.0
   Compiling tokio v0.3.4
   Compiling num-traits v0.2.14
   Compiling indexmap v1.6.0
   Compiling num-integer v0.1.44
   Compiling miniz_oxide v0.4.3
   Compiling instant v0.1.9
   Compiling futures-task v0.3.8
   Compiling tracing-core v0.1.17
   Compiling thread_local v1.0.1
   Compiling lock_api v0.4.2
   Compiling futures-channel v0.3.8
   Compiling ring v0.16.17
   Compiling unicode-bidi v0.3.4
   Compiling tinyvec v1.1.0
   Compiling form_urlencoded v1.0.0
   Compiling heck v0.3.1
   Compiling pest v2.1.3
   Compiling yaml-rust v0.4.4
   Compiling lru-cache v0.1.2
   Compiling humantime v1.3.0
   Compiling http v0.2.1
   Compiling iprange v0.6.3
   Compiling unsafe-any v0.4.2
   Compiling qrcode v0.12.0
   Compiling unicode-normalization v0.1.16
   Compiling pest_meta v2.1.3
   Compiling typemap v0.3.3
   Compiling quote v1.0.7
   Compiling http-body v0.4.0 (https://github.com/hyperium/http-body#5e434739)
   Compiling aho-corasick v0.7.15
   Compiling parking_lot_core v0.8.0
   Compiling num_cpus v1.13.0
   Compiling signal-hook-registry v1.2.2
   Compiling term_size v0.3.2
   Compiling hostname v0.3.1
   Compiling time v0.1.44
   Compiling thread-id v3.3.0
   Compiling atty v0.2.14
   Compiling socket2 v0.3.17
   Compiling daemonize v0.4.1
   Compiling idna v0.2.0
   Compiling ordered-float v1.1.0
   Compiling parking_lot v0.11.1
   Compiling rand_core v0.5.1
   Compiling regex v1.4.2
   Compiling textwrap v0.11.0
   Compiling resolv-conf v0.7.0
   Compiling flate2 v1.0.19
   Compiling url v2.2.0
   Compiling chrono v0.4.19
   Compiling rand_chacha v0.2.2
   Compiling clap v2.33.3
   Compiling rand v0.7.3
   Compiling pest_generator v2.1.3
   Compiling bloomfilter v1.0.3
   Compiling webpki v0.21.3
   Compiling sct v0.6.0
   Compiling shadowsocks-crypto v0.1.0
   Compiling pin-project-internal v1.0.2
   Compiling futures-macro v0.3.8
   Compiling tokio-macros v0.3.1
   Compiling tracing-attributes v0.1.11
   Compiling thiserror-impl v1.0.22
   Compiling enum-as-inner v0.3.3
   Compiling async-trait v0.1.42
   Compiling pest_derive v2.1.0
   Compiling strum_macros v0.19.4
   Compiling webpki-roots v0.20.0
   Compiling pin-project v1.0.2
   Compiling pin-project v0.4.27
   Compiling futures-util v0.3.8
   Compiling serde-value v0.6.0
   Compiling serde_yaml v0.8.14
   Compiling serde_urlencoded v0.7.0
   Compiling futures-executor v0.3.8
   Compiling mio v0.7.6
   Compiling tracing v0.1.22
   Compiling rustls v0.18.1
   Compiling want v0.3.0
   Compiling log4rs v0.13.0
   Compiling futures v0.3.8
   Compiling tracing-futures v0.2.4
   Compiling tower v0.4.0 (https://github.com/tower-rs/tower.git#d4d1c67c)
   Compiling rustls-native-certs v0.4.0
   Compiling thiserror v1.0.22
   Compiling tokio-util v0.5.0
   Compiling tokio-rustls v0.20.0
   Compiling h2 v0.3.0 (https://github.com/hyperium/h2.git#73bf6a61)
   Compiling hyper v0.14.0-dev (https://github.com/hyperium/hyper.git#d6aadb83)
   Compiling trust-dns-proto v0.20.0-alpha.3 (https://github.com/bluejekyll/trust-dns.git?branch=upgrade-to-tokio-0.3#398ba5e7)
   Compiling trust-dns-resolver v0.20.0-alpha.3 (https://github.com/bluejekyll/trust-dns.git?branch=upgrade-to-tokio-0.3#398ba5e7)
   Compiling json5 v0.3.0
   Compiling shadowsocks-rust v1.9.0 (/project)
    Finished dev [unoptimized + debuginfo] target(s) in 18m 24s

, works perfectly. You may have to set the global environment variable CC and AR to your gcc in your build chain, or use cross's build image directly.

@IceCodeNew
Copy link
Author

IceCodeNew commented Nov 27, 2020

I tested with cross:
, works perfectly. You may have to set the global environment variable CC and AR to your gcc in your build chain, or use cross's build image directly.

感谢抽空帮忙解惑。在我把 target 调整为 x86_64-unknown-linux-gnu 以后确实可以顺利编译了,而且最新版本的 rust 已经支持编译时对 glibc 静态连接,所以我的问题已经彻底解决。

我观察到你本地重现都是指定的 x86_64-unknown-linux-gnu 为 target,联系报错信息里的 undefined reference 提示,我似乎明白这里遇到的编译问题是什么了。
——不知道可不可以请您帮忙确认一下:这个项目是不是不支持 musl libc 库?

另及:不过要是能在这里确认本项目对 musl libc 库的支持程度,相信能帮助未来使用类似 Alpine 发行版的用户节省不必要的试错。
我在下面对这个问题做了些测试,目前的结论是不涉及 libm 的部分都是可以 link against musl libc 的,但是额外指定 malloc 实现时好像就不支持 x86_64-unknown-linux-musl 作 target 了。

@IceCodeNew
Copy link
Author

我试图用 cross 的 x86_64-unknown-linux-musl 镜像验证我的猜想,结果也不知道是我搞错了使用方式还是它们这个镜像本身的问题,拉下来居然只找得见 xargo 二进制文件,却不见 cross, cargo, rustc 等等一票关键依赖项,所以根本无法验证以 x86_64-unknown-linux-musl 为 target 编译本项目时具体遇到的是什么问题。

podman --runtime /usr/bin/crun run \
       --replace --pull always \
       --tz 'Asia/Taipei' --cgroups no-conmon \
       --restart=unless-stopped --name cross \
       -e 'CROSS_CONTAINER_ENGINE=podman' \
       -e 'PKG_CONFIG_ALL_STATIC=true' \
       rustembedded/cross:x86_64-unknown-linux-musl \
       cross install --bins -j "$(nproc)" --target x86_64-pc-windows-gnu --no-default-features --features "trust-dns local-http local-http-rustls local-tunnel local-socks4 mimalloc" --git 'https://github.com/shadowsocks/shadowsocks-rust.git' --verbose
podman --runtime /usr/bin/crun run \
       --replace --pull always \
       --tz 'Asia/Taipei' --cgroups no-conmon \
       --restart=unless-stopped --name cross \
       -e 'CROSS_CONTAINER_ENGINE=podman' \
       -e 'PKG_CONFIG_ALL_STATIC=true' \
       rustembedded/cross:x86_64-unknown-linux-musl \
       type -P rustc

@IceCodeNew
Copy link
Author

I tested with cross:
, works perfectly. You may have to set the global environment variable CC and AR to your gcc in your build chain, or use cross's build image directly.

感谢抽空帮忙解惑。我观察到你本地重现都是指定的 x86_64-unknown-linux-gnu 为 target,联系报错信息里的 undefined reference 提示,我似乎明白这里遇到的编译问题是什么了。
——不知道可不可以请您帮忙确认一下:这个项目是不是不支持 musl libc 库?

另及:在我把 target 调整为 x86_64-unknown-linux-gnu 以后确实可以顺利编译了,而且最新版本的 rust 已经支持编译时对 glibc 静态连接,所以我的问题已经彻底解决。
不过要是能在这里确认本项目对 musl libc 库的支持程度,相信能帮助未来使用类似 Alpine 发行版的用户节省不必要的试错。

实际拿 alpine 镜像编译测试完了,不额外指定 malloc 实现时,本项目可以用 x86_64-unknown-linux-musl 为 target 顺利编译及使用。
额外指定 malloc 实现时,无论选择哪种实现都会遇到编译错误。

我猜想是涉及到 libm 的部分目前 musl 还有问题,不过有待开发者帮忙证实。

@zonyitoo
Copy link
Collaborator

zonyitoo commented Nov 27, 2020

拉下来居然只找得见 xargo 二进制文件,却不见 cross, cargo, rustc 等等一票关键依赖项,所以根本无法验证以 x86_64-unknown-linux-musl 为 target 编译本项目时具体遇到的是什么问题。

Because cross uses cargo in your host environment.

@zonyitoo
Copy link
Collaborator

zonyitoo commented Nov 27, 2020

我观察到你本地重现都是指定的 x86_64-unknown-linux-gnu 为 target,联系报错信息里的 undefined reference 提示,我似乎明白这里遇到的编译问题是什么了。

Because I don't want to install another build image on my laptop.

It seems that tcmalloc doesn't support to build with MUSL: gperftools/gperftools#693 .

BTW, mimalloc seems to be compatible with MUSL, but couldn't link with Rust's MUSL, don't know why, maybe it is because Rust's current MUSL build is built with an old version of MUSL?

Actually, jemalloc also has an issue about building with MUSL: gnzlbg/jemallocator#124 .

So, yeah, good luck to Alpine users.. :(

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