Skip to content

Instantly share code, notes, and snippets.

@DrSensor
Created October 16, 2019 01:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DrSensor/52d550c7adf0e6d6b1bba11d8a94fa5d to your computer and use it in GitHub Desktop.
Save DrSensor/52d550c7adf0e6d6b1bba11d8a94fa5d to your computer and use it in GitHub Desktop.
Hacktoberfest Log

Cross compiling notes

1st attempt 2019-10-15

$ cross build --target x86_64-unknown-linux-gnu --release --package substrate
.
.
error: failed to run custom build command for `librocksdb-sys v5.18.3`
Caused by:
  process didn't exit successfully: `/target/release/build/librocksdb-sys-e17ed1a83908e9ac/build-script-build` (exit code: 101)
--- stdout
cargo:rerun-if-changed=build.rs
cargo:rerun-if-changed=rocksdb/
cargo:rerun-if-changed=snappy/
cargo:rerun-if-changed=lz4/
cargo:rerun-if-changed=zstd/
cargo:rerun-if-changed=zlib/
cargo:rerun-if-changed=bzip2/
--- stderr
thread 'main' panicked at 'Unable to find libclang: "couldn\'t find any valid shared libraries matching: [\'libclang.so\', \'libclang-*.so\', \'libclang.so.*\'], set the `LIBCLANG_PATH` environment variable to a path where one of these files can be found (invalid: [])"', src/libcore/result.rs:1084:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
.
.

got stalled which need to be force kill

failed to run custom build command for librocksdb-sys

2nd attempt 2019-10-15

FROM rustembedded/cross:x86_64-unknown-linux-gnu-0.1.16

RUN apt-get update \
    && apt-get install -y  \
      cmake pkg-config     \
      libssl-dev git       \
      clang libclang-dev   \
    && rm -rf /var/lib/apt/lists/*

Compile using ☝️ docker image

$ cross build --target x86_64-unknown-linux-gnu --release --package substrate
Compiling node-runtime v2.0.0 (/project/node/runtime)
Compiling librocksdb-sys v5.18.3
.
.
Compiling node-cli v2.0.0 (/project/node/cli)
Building [===================================================> ] 1056/1061: node-runtime(build)
  • stuck when building node-runtime, even after installing wasm-gc
  • cpu load become stable again like nothing happens
  • no rustc process detected, only this process is detected (base on Relative Start Time):
    • build-script-build
    • cargo
    • sh
    • container-shim
    • docker
    • cross

3rd attempt 2019-10-16

This works as expected

wget -nv -O- https://github.com/alexcrichton/wasm-gc/releases/download/wasm-gc-api-0.1.11/wasm-gc-wasm-gc-api-0.1.11-x86_64-unknown-linux-musl.tar.gz | tar xzvf - --strip=1 -C $HOME/.cargo/bin --wildcards '*/wasm-gc'
rustup target add wasm32-unknown-unknown --toolchain nightly # still don't know why the stable channel didn't work
cargo build --target x86_64-unknown-linux-gnu --release --package substrate # compile using stable channel
However, if using stable channel of `wasm32-unknown-unknown` (nightly version not yet installed)
$ cargo build --target x86_64-unknown-linux-gnu --release --package substrate
Compiling node-runtime v2.0.0 (/home/wildan/Projects/OSS/@parity/substrate/node/runtime)
Compiling num-traits v0.2.8
Compiling ctrlc v3.1.3
Compiling serde_derive v1.0.101
Compiling proc-macro-hack v0.5.10
Compiling wasm-bindgen-backend v0.2.51
Compiling impl-trait-for-tuples v0.1.2
error: failed to run custom build command for `node-runtime v2.0.0 (/home/wildan/Projects/OSS/@parity/substrate/node/runtime)`
Caused by:
  process didn't exit successfully: `/home/wildan/Projects/OSS/@parity/substrate/target/release/build/node-runtime-d681597f5fe0a55c/build-script-build` (exit code: 1)
--- stderr
  Compiling wasm-build-runner-impl v1.0.0 (/home/wildan/Projects/OSS/@parity/substrate/target/x86_64-unknown-linux-gnu/release/wbuild-runner/node-runtime)
   Finished release [optimized] target(s) in 6.28s
     Running `/home/wildan/Projects/OSS/@parity/substrate/target/x86_64-unknown-linux-gnu/release/wbuild-runner/node-runtime/target/release/wasm-build-runner-impl`
Rust WASM toolchain not installed, please install it!

warning: build failed, waiting for other jobs to finish...
error: build failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment