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

默认的Alpine无法编译通过,需要固定版本 #260

Closed
wants to merge 2 commits into from

Conversation

zsinba
Copy link

@zsinba zsinba commented Jun 1, 2023

使用最新的版本也无法编译通过;
固定六个月前的版本:1.66-alpine 可以正常编译出Docker Image;

请尝试并合并。

default alpine version can not work for compile. 
It needs to specific fixed version.
@rapiz1
Copy link
Owner

rapiz1 commented Jun 1, 2023

我可以正常编译。你的rust:alpine版本是不是不对?尝试执行docker image rm rust:alpine之后再编译。如果还是出现错误,请发送编译日志

 docker build .
DEPRECATED: The legacy builder is deprecated and will be removed in a future release.
            Install the buildx component to build images with BuildKit:
            https://docs.docker.com/go/buildx/

Sending build context to Docker daemon  219.1kB
Step 1/12 : FROM rust:alpine as builder
alpine: Pulling from library/rust
f56be85fc22e: Pull complete
fd915fad0195: Pull complete
7135c4e7cae8: Pull complete
Digest: sha256:a1123af3383f0e71da8deca8afc1e506ff3ee48c7903f253a11b7b632d938190
Status: Downloaded newer image for rust:alpine
 ---> d7e1a81848a7
Step 2/12 : RUN apk add --no-cache musl-dev openssl openssl-dev pkgconfig
 ---> Running in f0b71af68ca4
fetch https://dl-cdn.alpinelinux.org/alpine/v3.17/main/x86_64/APKINDEX.tar.gz
fetch https://dl-cdn.alpinelinux.org/alpine/v3.17/community/x86_64/APKINDEX.tar.gz
(1/7) Upgrading musl (1.2.3-r4 -> 1.2.3-r5)
(2/7) Upgrading libcrypto3 (3.0.8-r3 -> 3.0.9-r1)
(3/7) Upgrading libssl3 (3.0.8-r3 -> 3.0.9-r1)
(4/7) Installing musl-dev (1.2.3-r5)
(5/7) Installing openssl (3.0.9-r1)
(6/7) Installing pkgconf (1.9.4-r0)
(7/7) Installing openssl-dev (3.0.9-r1)
Executing busybox-1.35.0-r29.trigger
Executing ca-certificates-20220614-r4.trigger
OK: 156 MiB in 30 packages
Removing intermediate container f0b71af68ca4
 ---> e637cc47dbfe
Step 3/12 : WORKDIR /home/rust/src
 ---> Running in 316bee8d8717
Removing intermediate container 316bee8d8717
 ---> 4d654a018186
Step 4/12 : COPY . .
 ---> 0693c5d095c2
Step 5/12 : RUN cargo build --locked --release --features client,server,noise,hot-reload
 ---> Running in 5f13741917ea
    Updating crates.io index
 Downloading crates ...
  Downloaded foreign-types v0.3.2
  Downloaded fdlimit v0.2.1
  Downloaded futures-macro v0.3.25
  Downloaded cpufeatures v0.2.5
  Downloaded aes v0.7.5
  Downloaded cc v1.0.74
  Downloaded once_cell v1.16.0
  Downloaded mio v0.8.5
  Downloaded heck v0.4.0
  Downloaded inotify v0.9.6
  Downloaded inotify-sys v0.1.5
  Downloaded futures-task v0.3.25
  Downloaded lazy_static v1.4.0
  Downloaded jobserver v0.1.25
  Downloaded openssl-macros v0.1.0
  Downloaded itoa v1.0.4
  Downloaded pkg-config v0.3.26
  Downloaded proc-macro2 v1.0.47
  Downloaded notify v5.0.0
  Downloaded libc v0.2.137
  Downloaded pin-project-internal v1.0.12
  Downloaded num_threads v0.1.6
  Downloaded pin-project v1.0.12
  Downloaded num_cpus v1.14.0
  Downloaded parking_lot_core v0.9.4
  Downloaded generic-array v0.14.6
  Downloaded socket2 v0.4.7
  Downloaded signal-hook-registry v1.4.0
  Downloaded poly1305 v0.7.2
  Downloaded slab v0.4.7
  Downloaded getrandom v0.2.8
  Downloaded ghash v0.4.4
  Downloaded subtle v2.4.1
  Downloaded rustversion v1.0.9
  Downloaded pin-utils v0.1.0
  Downloaded proc-macro-error-attr v1.0.4
  Downloaded rand_core v0.6.4
  Downloaded httparse v1.8.0
  Downloaded textwrap v0.16.0
  Downloaded parking_lot v0.12.1
  Downloaded log v0.4.17
  Downloaded hex v0.4.3
  Downloaded openssl-probe v0.1.5
  Downloaded nu-ansi-term v0.46.0
  Downloaded lock_api v0.4.9
  Downloaded percent-encoding v2.2.0
  Downloaded thread_local v1.1.4
  Downloaded indexmap v1.9.1
  Downloaded regex-syntax v0.6.27
  Downloaded snow v0.9.0
  Downloaded openssl-sys v0.9.83
  Downloaded idna v0.3.0
  Downloaded time-core v0.1.0
  Downloaded thiserror v1.0.37
  Downloaded snowstorm v0.4.0
  Downloaded syn v1.0.103
  Downloaded time-macros v0.2.5
  Downloaded curve25519-dalek v4.0.0-pre.2
  Downloaded thiserror-impl v1.0.37
  Downloaded time v0.3.16
  Downloaded quote v1.0.21
  Downloaded tokio-native-tls v0.3.0
  Downloaded tokio-macros v1.8.0
  Downloaded universal-hash v0.4.1
  Downloaded tinyvec_macros v0.1.0
  Downloaded polyval v0.5.3
  Downloaded unicode-ident v1.0.5
  Downloaded semver v1.0.14
  Downloaded unicode-bidi v0.3.8
  Downloaded typenum v1.15.0
  Downloaded git2 v0.14.4
  Downloaded serde v1.0.147
  Downloaded zeroize v1.3.0
  Downloaded async-http-proxy v1.2.5
  Downloaded walkdir v2.3.2
  Downloaded aead v0.4.3
  Downloaded aes-gcm v0.9.4
  Downloaded block-buffer v0.10.3
  Downloaded bincode v1.3.3
  Downloaded backoff v0.4.0
  Downloaded blake2 v0.10.4
  Downloaded async-trait v0.1.58
  Downloaded os_str_bytes v6.3.1
  Downloaded anyhow v1.0.66
  Downloaded libgit2-sys v0.13.5+1.4.5
  Downloaded bytes v1.2.1
  Downloaded scopeguard v1.1.0
  Downloaded sha2 v0.10.6
  Downloaded version_check v0.9.4
  Downloaded same-file v1.0.6
  Downloaded opaque-debug v0.3.0
  Downloaded autocfg v1.1.0
  Downloaded rand_chacha v0.3.1
  Downloaded strsim v0.10.0
  Downloaded tracing-attributes v0.1.23
  Downloaded proc-macro-error v1.0.4
  Downloaded tracing-core v0.1.30
  Downloaded smallvec v1.10.0
  Downloaded ppv-lite86 v0.2.17
  Downloaded sharded-slab v0.1.4
  Downloaded rustc_version v0.4.0
  Downloaded byteorder v1.4.3
  Downloaded overload v0.1.1
  Downloaded bitflags v1.3.2
  Downloaded memchr v2.5.0
  Downloaded tinyvec v1.6.0
  Downloaded tracing v0.1.37
  Downloaded url v2.3.1
  Downloaded rand v0.8.5
  Downloaded unicode-normalization v0.1.22
  Downloaded regex-automata v0.1.10
  Downloaded tracing-log v0.1.3
  Downloaded base64 v0.13.1
  Downloaded tracing-subscriber v0.3.16
  Downloaded toml v0.5.9
  Downloaded regex v1.6.0
  Downloaded openssl v0.10.48
  Downloaded chacha20 v0.8.2
  Downloaded atty v0.2.14
  Downloaded ctr v0.8.0
  Downloaded filetime v0.2.18
  Downloaded clap_lex v0.2.4
  Downloaded form_urlencoded v1.1.0
  Downloaded crypto-common v0.1.6
  Downloaded foreign-types-shared v0.1.1
  Downloaded cfg-if v1.0.0
  Downloaded crossbeam-channel v0.5.6
  Downloaded crossbeam-utils v0.8.12
  Downloaded clap v3.2.23
  Downloaded hashbrown v0.12.3
  Downloaded digest v0.10.5
  Downloaded futures-core v0.3.25
  Downloaded chacha20poly1305 v0.9.1
  Downloaded futures-util v0.3.25
  Downloaded instant v0.1.12
  Downloaded cipher v0.3.0
  Downloaded native-tls v0.2.11
  Downloaded matchers v0.1.0
  Downloaded clap_derive v3.2.18
  Downloaded pin-project-lite v0.2.9
  Downloaded serde_derive v1.0.147
  Downloaded enum-iterator-derive v1.1.0
  Downloaded enum-iterator v1.1.3
  Downloaded async-socks5 v0.5.1
  Downloaded termcolor v1.1.3
  Downloaded getset v0.1.2
  Downloaded vergen v7.4.2
  Downloaded tokio v1.24.2
  Downloaded libz-sys v1.1.8
   Compiling libc v0.2.137
   Compiling proc-macro2 v1.0.47
   Compiling unicode-ident v1.0.5
   Compiling quote v1.0.21
   Compiling syn v1.0.103
   Compiling version_check v0.9.4
   Compiling cfg-if v1.0.0
   Compiling autocfg v1.1.0
   Compiling typenum v1.15.0
   Compiling generic-array v0.14.6
   Compiling jobserver v0.1.25
   Compiling pkg-config v0.3.26
   Compiling cc v1.0.74
   Compiling serde_derive v1.0.147
   Compiling log v0.4.17
   Compiling subtle v2.4.1
   Compiling serde v1.0.147
   Compiling thiserror v1.0.37
   Compiling cpufeatures v0.2.5
   Compiling lock_api v0.4.9
   Compiling proc-macro-error-attr v1.0.4
   Compiling parking_lot_core v0.9.4
   Compiling smallvec v1.10.0
   Compiling pin-project-lite v0.2.9
   Compiling once_cell v1.16.0
   Compiling anyhow v1.0.66
   Compiling libz-sys v1.1.8
   Compiling proc-macro-error v1.0.4
   Compiling tinyvec_macros v0.1.0
   Compiling opaque-debug v0.3.0
   Compiling scopeguard v1.1.0
   Compiling memchr v2.5.0
   Compiling tinyvec v1.6.0
   Compiling mio v0.8.5
   Compiling openssl-sys v0.9.83
   Compiling cipher v0.3.0
   Compiling universal-hash v0.4.1
   Compiling tokio v1.24.2
   Compiling getrandom v0.2.8
   Compiling semver v1.0.14
   Compiling rustversion v1.0.9
   Compiling rand_core v0.6.4
   Compiling unicode-normalization v0.1.22
   Compiling parking_lot v0.12.1
   Compiling libgit2-sys v0.13.5+1.4.5
   Compiling block-buffer v0.10.3
   Compiling crypto-common v0.1.6
   Compiling num_cpus v1.14.0
   Compiling signal-hook-registry v1.4.0
   Compiling socket2 v0.4.7
   Compiling num_threads v0.1.6
   Compiling itoa v1.0.4
   Compiling percent-encoding v2.2.0
   Compiling bitflags v1.3.2
   Compiling unicode-bidi v0.3.8
   Compiling time-core v0.1.0
   Compiling time v0.3.16
   Compiling form_urlencoded v1.1.0
   Compiling idna v0.3.0
   Compiling digest v0.10.5
   Compiling thiserror-impl v1.0.37
   Compiling tokio-macros v1.8.0
   Compiling zeroize v1.3.0
   Compiling futures-core v0.3.25
   Compiling rustc_version v0.4.0
   Compiling vergen v7.4.2
   Compiling enum-iterator-derive v1.1.0
   Compiling url v2.3.1
   Compiling polyval v0.5.3
   Compiling aead v0.4.3
   Compiling slab v0.4.7
   Compiling foreign-types-shared v0.1.1
   Compiling openssl v0.10.48
   Compiling futures-task v0.3.25
   Compiling regex-syntax v0.6.27
   Compiling crossbeam-utils v0.8.12
   Compiling enum-iterator v1.1.3
   Compiling foreign-types v0.3.2
   Compiling ghash v0.4.4
   Compiling snow v0.9.0
   Compiling chacha20 v0.8.2
   Compiling openssl-macros v0.1.0
   Compiling getset v0.1.2
   Compiling ctr v0.8.0
   Compiling aes v0.7.5
   Compiling poly1305 v0.7.2
   Compiling tracing-core v0.1.30
   Compiling indexmap v1.9.1
   Compiling futures-util v0.3.25
   Compiling httparse v1.8.0
   Compiling async-trait v0.1.58
   Compiling native-tls v0.2.11
   Compiling byteorder v1.4.3
   Compiling ppv-lite86 v0.2.17
   Compiling lazy_static v1.4.0
   Compiling curve25519-dalek v4.0.0-pre.2
   Compiling rand_chacha v0.3.1
   Compiling chacha20poly1305 v0.9.1
   Compiling aes-gcm v0.9.4
   Compiling bytes v1.2.1
   Compiling regex-automata v0.1.10
   Compiling futures-macro v0.3.25
   Compiling tracing-attributes v0.1.23
   Compiling pin-project-internal v1.0.12
   Compiling sha2 v0.10.6
   Compiling blake2 v0.10.4
   Compiling inotify-sys v0.1.5
   Compiling openssl-probe v0.1.5
   Compiling heck v0.4.0
   Compiling os_str_bytes v6.3.1
   Compiling overload v0.1.1
   Compiling hashbrown v0.12.3
   Compiling pin-utils v0.1.0
   Compiling same-file v1.0.6
   Compiling walkdir v2.3.2
   Compiling clap_lex v0.2.4
   Compiling nu-ansi-term v0.46.0
   Compiling clap_derive v3.2.18
   Compiling inotify v0.9.6
   Compiling pin-project v1.0.12
   Compiling tracing v0.1.37
   Compiling crossbeam-channel v0.5.6
   Compiling matchers v0.1.0
   Compiling rand v0.8.5
   Compiling sharded-slab v0.1.4
   Compiling tracing-log v0.1.3
   Compiling regex v1.6.0
   Compiling thread_local v1.1.4
   Compiling filetime v0.2.18
   Compiling atty v0.2.14
   Compiling instant v0.1.12
   Compiling base64 v0.13.1
   Compiling textwrap v0.16.0
   Compiling strsim v0.10.0
   Compiling termcolor v1.1.3
   Compiling clap v3.2.23
   Compiling async-http-proxy v1.2.5
   Compiling async-socks5 v0.5.1
   Compiling backoff v0.4.0
   Compiling notify v5.0.0
   Compiling tracing-subscriber v0.3.16
   Compiling snowstorm v0.4.0
   Compiling tokio-native-tls v0.3.0
   Compiling toml v0.5.9
   Compiling bincode v1.3.3
   Compiling fdlimit v0.2.1
   Compiling hex v0.4.3
   Compiling git2 v0.14.4
   Compiling rathole v0.4.8 (/home/rust/src)
    Finished release [optimized] target(s) in 5m 59s
Removing intermediate container 5f13741917ea
 ---> e3038824e07b
Step 6/12 : RUN mkdir -p build-out/
 ---> Running in 50019fa3b322
Removing intermediate container 50019fa3b322
 ---> 8bf0c2f72d05
Step 7/12 : RUN cp target/release/rathole build-out/
 ---> Running in ab1fdc6874a8
Removing intermediate container ab1fdc6874a8
 ---> 7e2b6bf34872
Step 8/12 : FROM scratch
 --->
Step 9/12 : WORKDIR /app
 ---> Running in 15b09207dccb
Removing intermediate container 15b09207dccb
 ---> 29f3e694e5bb
Step 10/12 : COPY --from=builder /home/rust/src/build-out/rathole .
 ---> 85b72e526b05
Step 11/12 : USER 1000:1000
 ---> Running in 24ecae33025b
Removing intermediate container 24ecae33025b
 ---> 9cd6fa48dfc8
Step 12/12 : ENTRYPOINT ["./rathole"]
 ---> Running in 2982f0a4e383
Removing intermediate container 2982f0a4e383
 ---> 168eb8a4e16f
Successfully built 168eb8a4e16f

@zsinba
Copy link
Author

zsinba commented Jun 1, 2023

你可以编译,可能是因为你的rust:alpine是六个月之前的版本的镜像;
你尝试删除镜像再编译试试。会报错的。

@rapiz1
Copy link
Owner

rapiz1 commented Jun 1, 2023

不能复现。你可以发一下你的日志吗?

@zsinba
Copy link
Author

zsinba commented Jun 1, 2023

Sending build context to Docker daemon 219.1kB Step 1/12 : FROM rust:alpine as builder alpine: Pulling from library/rust 97518928ae5f: Already exists a95f12a5672f: Pull complete 926567c683f3: Pull complete Digest: sha256:b0b3eb57c3f385499dca593a021e848167f7130a22b41818b7bbf4bdf8bba670 Status: Downloaded newer image for rust:alpine ---> 0ab042f7874a Step 2/12 : RUN apk add --no-cache musl-dev openssl openssl-dev pkgconfig ---> Running in 4462a06bb3e3 fetch https://dl-cdn.alpinelinux.org/alpine/v3.14/main/x86_64/APKINDEX.tar.gz fetch https://dl-cdn.alpinelinux.org/alpine/v3.14/community/x86_64/APKINDEX.tar.gz (1/7) Upgrading musl (1.2.2-r3 -> 1.2.2-r5) (2/7) Upgrading libcrypto1.1 (1.1.1l-r0 -> 1.1.1t-r2) (3/7) Upgrading libssl1.1 (1.1.1l-r0 -> 1.1.1t-r2) (4/7) Installing musl-dev (1.2.2-r5) (5/7) Installing openssl (1.1.1t-r2) (6/7) Installing pkgconf (1.7.4-r1) (7/7) Installing openssl-dev (1.1.1t-r2) Executing busybox-1.33.1-r6.trigger Executing ca-certificates-20191127-r5.trigger OK: 130 MiB in 30 packages Removing intermediate container 4462a06bb3e3 ---> 7103a1c45487 Step 3/12 : WORKDIR /home/rust/src ---> Running in f9ceb7226bb4 Removing intermediate container f9ceb7226bb4 ---> 92a807058b84 Step 4/12 : COPY . . ---> 4ee49267ebfc Step 5/12 : RUN cargo build --locked --release --features client,server,noise,hot-reload ---> Running in 3dc46afa1ee4 error: failed to parse manifest at/home/rust/src/Cargo.toml`

Caused by:
feature strip is required

The package requires the Cargo feature called strip, but that feature is not stabilized in this version of Cargo (1.57.0 (b2e52d7ca 2021-10-21)).
Consider trying a newer version of Cargo (this may require the nightly release).
See https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#profile-strip-option for more information about the status of this feature.
The command '/bin/sh -c cargo build --locked --release --features client,server,noise,hot-reload' returned a non-zero code: 101

`

@rapiz1
Copy link
Owner

rapiz1 commented Jun 1, 2023

这条错误信息显示编译时cargo版本过低。没有理由新版本镜像中的cargo版本更旧。请检查你的rust:alpine版本是否为最新

@rapiz1 rapiz1 closed this Jun 6, 2023
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

Successfully merging this pull request may close these issues.

None yet

2 participants