emk / rust-musl-builder

Docker images for compiling static Rust binaries using musl-libc and musl-gcc, with static versions of useful C libraries. Supports openssl and diesel crates.
Apache License 2.0
1.54k stars 193 forks source link

Can not find crate for std, when building with rust-toolchain file #39

Closed avkonst closed 6 years ago

avkonst commented 6 years ago

My project has got a file named: rust-toolchain. It's content is required compiler version: 1.24.1 The project builds fine on my desktop. rust-toolchain is also taken into account automatically and correctly.

However, the builder container failed to build one:

> docker run --rm -it --mount type=bind,source=$(pwd),target=/home/rust/src ekidd/rust-musl-builder cargo build --release

The output is:

info: syncing channel updates for '1.24.1-x86_64-unknown-linux-gnu'
269.6 KiB / 269.6 KiB (100 %) 247.4 KiB/s ETA:   0 s
info: latest update on 2018-03-01, rust version 1.24.1 (d3ae9a9e0 2018-02-27)
info: downloading component 'rustc'
 47.8 MiB /  47.8 MiB (100 %)  17.2 MiB/s ETA:   0 s
info: downloading component 'rust-std'
 66.9 MiB /  66.9 MiB (100 %)  18.1 MiB/s ETA:   0 s
info: downloading component 'cargo'
info: downloading component 'rust-docs'
info: installing component 'rustc'
info: installing component 'rust-std'
info: installing component 'cargo'
info: installing component 'rust-docs'
    Updating registry `https://github.com/rust-lang/crates.io-index`
 Downloading serde_json v1.0.6
 Downloading serde v1.0.20
 Downloading env_logger v0.5.4
 Downloading tokio-timer v0.1.2
 Downloading log v0.4.1
 Downloading chrono v0.4.0
 Downloading clap v2.27.1
 Downloading error-chain v0.11.0
 Downloading serde_derive v1.0.20
 Downloading reqwest v0.8.4
 Downloading uuid v0.6.0
 Downloading tokio-core v0.1.10
 Downloading openssl-probe v0.1.2
 Downloading hyper v0.11.15
 Downloading futures v0.1.17
 Downloading dtoa v0.4.2
 Downloading itoa v0.3.4
 Downloading num-traits v0.1.40
 Downloading regex v0.2.6
 Downloading humantime v1.1.0
 Downloading atty v0.2.3
 Downloading termcolor v0.3.5
 Downloading cfg-if v0.1.2
 Downloading aho-corasick v0.6.4
 Downloading memchr v2.0.1
 Downloading utf8-ranges v1.0.0
 Downloading regex-syntax v0.4.2
 Downloading thread_local v0.3.5
 Downloading libc v0.2.33
 Downloading unreachable v1.0.0
 Downloading lazy_static v1.0.0
 Downloading void v1.0.2
 Downloading quick-error v1.2.1
 Downloading slab v0.3.0
 Downloading time v0.1.38
 Downloading num v0.1.40
 Downloading num-integer v0.1.35
 Downloading num-iter v0.1.34
 Downloading vec_map v0.8.0
 Downloading strsim v0.6.0
 Downloading bitflags v0.9.1
 Downloading ansi_term v0.9.0
 Downloading unicode-width v0.1.4
 Downloading textwrap v0.9.0
 Downloading backtrace v0.3.5
 Downloading rustc-demangle v0.1.5
 Downloading serde_derive_internals v0.17.0
 Downloading quote v0.3.15
 Downloading syn v0.11.11
 Downloading synom v0.11.3
 Downloading unicode-xid v0.0.4
 Downloading serde_urlencoded v0.5.1
 Downloading native-tls v0.1.5
 Downloading uuid v0.5.1
 Downloading mime_guess v2.0.0-alpha.3
 Downloading hyper-tls v0.1.2
 Downloading url v1.6.0
 Downloading tokio-tls v0.1.4
 Downloading tokio-io v0.1.4
 Downloading bytes v0.4.5
 Downloading libflate v0.1.14
 Downloading matches v0.1.6
 Downloading idna v0.1.4
 Downloading percent-encoding v1.0.1
 Downloading unicode-bidi v0.3.4
 Downloading unicode-normalization v0.1.5
 Downloading slab v0.4.0
 Downloading iovec v0.1.1
 Downloading scoped-tls v0.1.0
 Downloading mio v0.6.11
 Downloading log v0.3.8
 Downloading byteorder v1.1.0
 Downloading net2 v0.2.31
 Downloading lazycell v0.5.1
 Downloading lazy_static v0.2.11
 Downloading rand v0.3.18
 Downloading unicase v1.4.2
 Downloading phf v0.7.21
 Downloading mime v0.3.5
 Downloading version_check v0.1.3
 Downloading phf_shared v0.7.21
 Downloading siphasher v0.2.2
 Downloading unicase v2.0.0
 Downloading rustc_version v0.1.7
 Downloading semver v0.1.20
 Downloading phf_codegen v0.7.21
 Downloading phf_generator v0.7.21
 Downloading tokio-service v0.1.0
 Downloading relay v0.1.0
 Downloading tokio-proto v0.1.1
 Downloading httparse v1.2.3
 Downloading base64 v0.9.0
 Downloading language-tags v0.2.2
 Downloading futures-cpupool v0.1.7
 Downloading smallvec v0.2.1
 Downloading take v0.1.0
 Downloading safemem v0.2.0
 Downloading num_cpus v1.7.0
 Downloading crc v1.7.0
 Downloading adler32 v1.0.2
 Downloading build_const v0.2.0
 Downloading rand v0.4.2
 Downloading backtrace-sys v0.1.16
 Downloading cc v1.0.4
 Downloading openssl v0.9.23
 Downloading foreign-types v0.3.2
 Downloading openssl-sys v0.9.24
 Downloading foreign-types-shared v0.1.1
 Downloading pkg-config v0.3.9
   Compiling quick-error v1.2.1
   Compiling take v0.1.0
error[E0463]: can't find crate for `std`
  |
  = note: the `x86_64-unknown-linux-musl` target may not be installed

error: aborting due to previous error

error[E0463]: can't find crate for `std`
  |
  = note: the `x86_64-unknown-linux-musl` target may not be installed

error: aborting due to previous error

error: Could not compile `take`.
warning: build failed, waiting for other jobs to finish...
error: Could not compile `quick-error`.

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

What is the way to fix it?

emk commented 6 years ago

The rust-musl-builder image comes with a specific, preinstalled version of the Rust toolchain. If you want to use a different version, you need to find a matching version of rust-musl-builder.

I just asked Docker Hub to build a new image for 1.24.1, and it should be ready in an hour or two. Once this is available, you should be able to use rust-musl-builder:1.24.1.

avkonst commented 6 years ago

Well. It means I need to remove rust-toolchain file before invoking docker. This file is in the git repo too for my project. I would like to have consistent build on my desktop as well as in the container for release.

On Sat, 24 Mar 2018, 04:40 Eric Kidd, notifications@github.com wrote:

The rust-musl-builder image comes with a specific, preinstalled version of the Rust toolchain. If you want to use a different version, you need to find a matching version of rust-musl-builder.

I just asked Docker Hub to build a new image for 1.24.1, and it should be ready in an hour or two. Once this is available, you should be able to use rust-musl-builder:1.24.1.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/emk/rust-musl-builder/issues/39#issuecomment-375707277, or mute the thread https://github.com/notifications/unsubscribe-auth/ADyZVTSPq94FpjHlS0yc808geRsGjw3kks5thRdjgaJpZM4S4LxE .

emk commented 6 years ago

Please try using the rust-musl-builder:1.24.1, which contains the compiler corresponding to your rust-toolchain file.

avkonst commented 6 years ago

I have tried. The recommended tag is not available on docker hub: image

Could you please check if you pushed it?

emk commented 6 years ago

Weird. I can see it with no problem:

rust-musl-builder-1 24 1

avkonst commented 6 years ago

Yes. It is weird. Appeared recently for me. Have managed to build successfully. Thanks.