Hello all, I was trying to find a way to compile rustc-1.25.0 on an offline machine. It finally appeared to be possible, and I'd like BLFS to present this way of compilation (maybe as optional preparation steps before the current ones).
The changes are as follows. 1. In addition to the rustc-1.25.0-src.tar.gz, we need these tarballs: https://static.rust-lang.org/dist/2018-02-15/rust-std-1.24.0-i686-unknown-linux-gnu.tar.gz https://static.rust-lang.org/dist/2018-02-15/rustc-1.24.0-i686-unknown-linux-gnu.tar.gz https://static.rust-lang.org/dist/2018-02-15/cargo-0.25.0-i686-unknown-linux-gnu.tar.gz 2. Cargo package registry must be fetched into appropriate location. This can be done with the following commands (requires git): ### BEGIN mkdir -pv "$HOME/.cargo/registry/index/github.com-1ecc6299db9ec823" pushd "$HOME/.cargo/registry/index/github.com-1ecc6299db9ec823" git init . git fetch --tags https://github.com/rust-lang/crates.io-index refs/heads/master:refs/remotes/origin/master touch .cargo-index-lock popd ### END 3. We need to download the dependencies – Rust packages AKA crates, and place them into appropriate location. This can be done using the following bash commands: ### BEGIN mkdir -pv "$HOME/.cargo/registry/cache/github.com-1ecc6299db9ec823/" pushd "$HOME/.cargo/registry/cache/github.com-1ecc6299db9ec823/" crates=( filetime-0.1.15.crate textwrap-0.9.0.crate languageserver-types-0.31.0.crate synom-0.11.3.crate unicode-xid-0.0.3.crate same-file-0.1.3.crate open-1.2.1.crate serde_derive-1.0.27.crate hamcrest-0.1.1.crate syntex_errors-0.52.0.crate arrayvec-0.4.7.crate syntex_syntax-0.52.0.crate num-integer-0.1.35.crate percent-encoding-1.0.1.crate tempdir-0.3.5.crate rls-rustc-0.2.1.crate unicode-xid-0.0.4.crate debug_unreachable-0.1.1.crate rayon-core-1.4.0.crate phf_shared-0.7.21.crate shared_child-0.2.1.crate lazy_static-0.2.11.crate commoncrypto-sys-0.2.0.crate rustc-ap-rustc_cratesio_shim-29.0.0.crate toml-0.4.5.crate log-0.3.9.crate aho-corasick-0.5.3.crate unicode-normalization-0.1.5.crate openssl-0.9.23.crate lazycell-0.6.0.crate kernel32-sys-0.2.2.crate phf-0.7.21.crate net2-0.2.31.crate semver-0.8.0.crate getopts-0.2.15.crate libgit2-sys-0.6.19.crate procedural-masquerade-0.1.5.crate aho-corasick-0.6.4.crate crossbeam-deque-0.2.0.crate termion-1.5.1.crate thread_local-0.2.7.crate lazy_static-1.0.0.crate core-foundation-sys-0.5.1.crate tendril-0.4.0.crate string_cache_shared-0.3.0.crate env_logger-0.5.3.crate unicode-bidi-0.3.4.crate futf-0.1.3.crate semver-parser-0.7.0.crate thread_local-0.3.5.crate lazycell-0.5.1.crate semver-0.6.0.crate num-complex-0.1.41.crate home-0.3.0.crate term-0.4.6.crate log_settings-0.1.1.crate rls-analysis-0.11.3.crate handlebars-0.29.1.crate bitflags-0.7.0.crate utf8-ranges-1.0.0.crate byteorder-1.2.1.crate phf_codegen-0.7.21.crate miow-0.3.1.crate rustc-demangle-0.1.5.crate foreign-types-shared-0.1.1.crate glob-0.2.11.crate env_logger-0.4.3.crate winapi-0.2.8.crate shell-escape-0.1.3.crate xattr-0.1.11.crate toml-0.2.1.crate synstructure-0.6.1.crate yaml-rust-0.3.5.crate clap-2.29.0.crate num_cpus-1.8.0.crate bufstream-0.1.3.crate void-1.0.2.crate ar-0.3.1.crate string_cache_codegen-0.4.0.crate ignore-0.4.0.crate kuchiki-0.6.0.crate quote-0.3.15.crate wincolor-0.1.4.crate url-1.7.0.crate chrono-0.4.0.crate regex-0.1.80.crate fuchsia-zircon-sys-0.3.3.crate rls-data-0.15.0.crate cargo_metadata-0.4.0.crate rand-0.3.20.crate rls-blacklist-0.1.0.crate git2-0.6.11.crate rls-vfs-0.4.5.crate compiletest_rs-0.3.6.crate stable_deref_trait-1.0.0.crate nodrop-0.1.12.crate rustc-ap-rustc_data_structures-29.0.0.crate quick-error-1.2.1.crate bitflags-0.9.1.crate curl-0.4.11.crate derive-new-0.5.0.crate serde_json-1.0.9.crate rustc-serialize-0.3.24.crate serde-1.0.27.crate pkg-config-0.3.9.crate foreign-types-0.3.2.crate phf_generator-0.7.21.crate html-diff-0.0.6.crate ws2_32-sys-0.2.1.crate libz-sys-1.0.18.crate openssl-sys-0.9.24.crate html5ever-0.20.0.crate rustc-ap-serialize-29.0.0.crate ansi_term-0.10.2.crate advapi32-sys-0.2.0.crate itoa-0.3.4.crate rayon-1.0.0.crate selectors-0.18.0.crate failure-0.1.1.crate memchr-2.0.1.crate regex-syntax-0.3.9.crate precomputed-hash-0.1.1.crate pulldown-cmark-0.1.0.crate miow-0.2.1.crate smallvec-0.3.3.crate quine-mc_cluskey-0.2.4.crate xz2-0.1.4.crate regex-syntax-0.4.2.crate winapi-0.3.4.crate nibble_vec-0.0.3.crate shlex-0.1.1.crate bitflags-1.0.1.crate num-traits-0.1.41.crate memoffset-0.2.1.crate rustc-ap-syntax_pos-29.0.0.crate matches-0.1.6.crate userenv-sys-0.2.0.crate rustfmt-nightly-0.4.0.crate winapi-x86_64-pc-windows-gnu-0.4.0.crate scoped-tls-0.1.0.crate unreachable-0.1.1.crate is-match-0.1.0.crate failure_derive-0.1.1.crate utf-8-0.7.1.crate log-0.4.1.crate duct-0.8.2.crate nix-0.8.1.crate crossbeam-utils-0.2.2.crate unicode-width-0.1.4.crate num-0.1.41.crate futures-0.1.17.crate endian-type-0.1.2.crate libc-0.2.39.crate cssparser-0.13.7.crate fnv-1.0.6.crate itertools-0.7.6.crate num-iter-0.1.34.crate libssh2-sys-0.2.6.crate rls-span-0.4.0.crate smallvec-0.6.0.crate scopeguard-0.3.3.crate time-0.1.39.crate backtrace-0.3.5.crate pest-0.3.3.crate redox_syscall-0.1.37.crate siphasher-0.2.2.crate regex-0.2.5.crate vec_map-0.8.0.crate string_cache-0.6.2.crate jsonrpc-core-8.0.1.crate backtrace-sys-0.1.16.crate num-rational-0.1.40.crate atty-0.2.6.crate vcpkg-0.2.2.crate idna-0.1.4.crate globset-0.3.0.crate if_chain-0.1.2.crate same-file-1.0.2.crate syntex_pos-0.52.0.crate cargo_metadata-0.5.3.crate diff-0.1.11.crate enum_primitive-0.1.1.crate markup5ever-0.5.0.crate error-chain-0.11.0.crate cmake-0.1.29.crate git2-curl-0.7.0.crate rustc-ap-syntax-29.0.0.crate openssl-probe-0.1.2.crate cfg-if-0.1.2.crate rustc-ap-rustc_errors-29.0.0.crate cargo_metadata-0.2.3.crate walkdir-2.0.1.crate hex-0.3.1.crate fs2-0.4.3.crate mdbook-0.1.2.crate winapi-i686-pc-windows-gnu-0.4.0.crate curl-sys-0.4.1.crate tar-0.4.14.crate thread-id-2.0.0.crate syn-0.11.11.crate toml-query-0.6.0.crate mac-0.1.1.crate unicode-segmentation-1.2.0.crate either-1.4.0.crate env_logger-0.3.5.crate winapi-build-0.1.1.crate crossbeam-epoch-0.3.0.crate fuchsia-zircon-0.3.3.crate owning_ref-0.3.3.crate url_serde-0.2.0.crate os_pipe-0.5.1.crate hex-0.2.0.crate docopt-0.8.3.crate crossbeam-0.3.2.crate termcolor-0.3.3.crate parking_lot-0.5.3.crate cc-1.0.4.crate redox_termios-0.1.1.crate itertools-0.6.5.crate crypto-hash-0.3.0.crate walkdir-1.0.7.crate semver-0.9.0.crate serde_ignored-0.0.4.crate core-foundation-0.5.1.crate serde_derive_internals-0.19.0.crate error-chain-0.8.1.crate num-bigint-0.1.41.crate json-0.11.12.crate strsim-0.6.0.crate radix_trie-0.1.2.crate lzma-sys-0.1.9.crate cssparser-macros-0.3.0.crate pulldown-cmark-0.0.15.crate parking_lot_core-0.2.9.crate flate2-1.0.1.crate memchr-0.1.11.crate racer-2.0.12.crate jobserver-0.1.9.crate miniz-sys-0.1.10.crate unreachable-1.0.0.crate scopeguard-0.1.2.crate dtoa-0.4.2.crate schannel-0.1.10.crate socket2-0.3.0.crate utf8-ranges-0.1.3.crate commoncrypto-0.2.0.crate ) for crate in "${crates[@]}"; do # See discussion of API at https://github.com/rust-lang/crates.io/issues/65 wget --trust-server-names https://crates.io/api/v1/crates/$(sed 's@\(.*\)-\([^-]\+\)\.crate@\1/\2@' <<< "$crate")/download done popd ### END 4. After all these downloads have been done, we can finally do the (BLFS implied) extraction of rustc-1.25.0-src.tar.gz, cd into the resulting directory, and from there: ### BEGIN mkdir -pv build/cache/2018-02-15 ln -sv "$PWD"/../rust-std-1.24.0-i686-unknown-linux-gnu.tar.gz build/cache/2018-02-15/ ln -sv "$PWD"/../rustc-1.24.0-i686-unknown-linux-gnu.tar.gz build/cache/2018-02-15/ ln -sv "$PWD"/../cargo-0.25.0-i686-unknown-linux-gnu.tar.gz build/cache/2018-02-15/ ### END 5. After all these steps you no longer need Internet connection, so you can simply continue as you would following current BLFS instructions. I've actually built rustc on an offline machine using these preparations before going offline, and it worked nicely. Note about DESTDIR: it seems you don't actually have to use this way: you can simply set HOME environment variable to the normal user's home directory. Then Cargo should look for its registry and cache in the same place as while building, so it won't try to download all these files while installing. Regards, Ruslan -- http://lists.linuxfromscratch.org/listinfo/blfs-dev FAQ: http://www.linuxfromscratch.org/blfs/faq.html Unsubscribe: See the above information page
