GetFirefly/firefly

cant build lumen on linux using the latest nightly nor nightly-2020-05-13

vans163 opened this issue · 3 comments

I am trying to build lumen and keep getting errors, I made the following podman script to setup the env. Using the nightly nightly-2020-05-13

FROM ubuntu:20.04
ENV DEBIAN_FRONTEND noninteractive

RUN useradd -ms /bin/bash user

RUN apt-get update && apt-get install -y vim git locate wget apt-transport-https apt-utils locales
ENV LANGUAGE en_US.UTF-8
ENV LANG en_US.UTF-8
ENV LC_ALL en_US.UTF-8
RUN echo "en_US UTF-8" >> /etc/locale.gen && locale-gen

WORKDIR "/root"

RUN apt-get update && \
    apt-get install --no-install-recommends -y \
    git curl ca-certificates curl file \
    build-essential \
    autoconf automake autotools-dev libtool xutils-dev && \
    rm -rf /var/lib/apt/lists/*

ENV SSL_VERSION=1.0.2s

RUN curl https://www.openssl.org/source/openssl-$SSL_VERSION.tar.gz -O && \
    tar -xzf openssl-$SSL_VERSION.tar.gz && \
    cd openssl-$SSL_VERSION && ./config && make depend && make install && \
    cd .. && rm -rf openssl-$SSL_VERSION*

ENV OPENSSL_LIB_DIR=/usr/local/ssl/lib \
    OPENSSL_INCLUDE_DIR=/usr/local/ssl/include \
    OPENSSL_STATIC=1

# install nightly-2020-05-13 toolchain only
RUN curl https://sh.rustup.rs -sSf | \
    sh -s -- --default-toolchain nightly-2020-05-13 -y && \
    /root/.cargo/bin/rustup update nightly-2020-05-13

ENV PATH=/root/.cargo/bin:$PATH
ENV XDG_DATA_HOME=/root/.local/share

RUN apt-get update && apt-get install -y ninja-build cmake ccache

RUN mkdir -p $XDG_DATA_HOME/llvm/lumen/ && \
    cd $XDG_DATA_HOME/llvm/lumen/ && \
    wget https://github.com/lumen/llvm-project/releases/download/lumen-12.0.0-dev_2020-10-22/clang+llvm-12.0.0-x86_64-linux-gnu.tar.gz && \
    tar -xz --strip-components 1 -f clang+llvm-12.0.0-x86_64-linux-gnu.tar.gz && \
    rm clang+llvm-12.0.0-x86_64-linux-gnu.tar.gz && \
    cd -

RUN rustup default nightly-2020-05-13
RUN cargo install cargo-make
RUN rustup component add rls rustfmt clippy
RUN rustup target add wasm32-unknown-unknown --toolchain nightly-2020-05-13

RUN git clone https://github.com/lumen/lumen
RUN cd /root/lumen && LLVM_PREFIX=$XDG_DATA_HOME/llvm/lumen cargo make

CMD ["/bin/bash"]
[cargo-make] INFO - Execute Command: "cargo" "script" "/tmp/root/fsio/ioEggEFGJh.rs"
    Updating crates.io index
   Compiling proc-macro2 v1.0.24
   Compiling unicode-xid v0.2.1
   Compiling syn v1.0.54
   Compiling serde_derive v1.0.118
   Compiling serde v1.0.118
   Compiling ryu v1.0.5
   Compiling serde_json v1.0.60
   Compiling same-file v1.0.6
   Compiling itoa v0.4.6
   Compiling walkdir v2.3.1
   Compiling quote v1.0.7
   Compiling ioEggEFGJh v0.1.0 (/root/.cargo/script-cache/file-ioEggEFGJh-b2409432f464298a)
    Finished release [optimized] target(s) in 31.03s
Starting build..
Build command completed, waiting for exit..
thread 'main' panicked at 'command did not execute successfully: "rustup" "run" "nightly" "cargo" "rustc" "-p" "lumen" "--message-format=json" "--color=never" "--" "-Clink-args=-Wl,-rpath,$ORIGIN/../lib" "-C" "opt-level=0"
expected success, got: exit code: 1', ioEggEFGJh.rs:290:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
[cargo-make] ERROR - Unable to execute rust code.
[cargo-make] WARN - Build Failed.
The command '/bin/sh -c cd /root/lumen && LLVM_PREFIX=$XDG_DATA_HOME/llvm/lumen cargo make' returned a non-zero code: 1

I get a similar error with nightly and nightly-2020-05-13, which is caused by a compile error

error[E0599]: no method named `reserve_in_place` found for struct `RawVec<T>` in the current scope
   --> liblumen_arena/src/arena.rs:183:39
    |
183 |                 if last_chunk.storage.reserve_in_place(currently_used_cap, n) {
    |                                       ^^^^^^^^^^^^^^^^ method not found in `RawVec<T>`

error[E0599]: no method named `reserve_in_place` found for struct `RawVec<u8>` in the current scope
   --> liblumen_arena/src/arena.rs:322:22
    |
322 |                     .reserve_in_place(used_bytes, needed_bytes)
    |                      ^^^^^^^^^^^^^^^^ method not found in `RawVec<u8>`

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0599`.

@vans163 Try this patch:

--- a/Makefile.toml
+++ b/Makefile.toml
@@ -72,7 +72,7 @@ CARGO_MAKE_RUST_SCRIPT_PROVIDER = "cargo-script"
 CARGO_MAKE_USE_WORKSPACE_PROFILE = true
 CARGO_MAKE_CARGO_BUILD_TEST_FLAGS = "--no-fail-fast"
 CARGO_TARGET_DIR = { value = "${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/target", condition = { env_not_set = ["CARGO_TARGET_DIR"] } }
-CARGO_MAKE_TOOLCHAIN_DEFAULT = { source = "${CARGO_MAKE_CI}", default_value = "nightly", mapping = { "true" = "nightly-2020-05-13", "false" = "nightly" } }
+CARGO_MAKE_TOOLCHAIN_DEFAULT = { source = "${CARGO_MAKE_CI}", default_value = "nightly-2020-05-13", mapping = { "true" = "nightly-2020-05-13", "false" = "nightly-2020-05-13" } }
 CARGO_MAKE_TOOLCHAIN = { value = "${CARGO_MAKE_TOOLCHAIN_DEFAULT}", condition = { env_not_set = ["CARGO_MAKE_TOOLCHAIN"] } }
 BACKTRACE_DEFAULT = { source = "${CARGO_MAKE_CI}", mapping = { "true" = "1", "false" = "0" } }
 RUST_BACKTRACE = { value = "${BACKTRACE_DEFAULT}", condition = { env_not_set = ["RUST_BACKTRACE"] } }

@danielzfranklin I get the same outside of docker.

Try applying the patch above and running:

docker run -v $PWD:/code --rm -it kronicdeth/lumen-development@sha256:71d03d818e85085995170b6211ec9ad17231bfee5716bda0552e14a7d1979b1b /bin/bash
cd /code
cargo make lumen

After that, to build spawn-chain example for wasm:

cargo make spawn-chain-web

Sorry for getting back late on this but nightly has since changed. Could you please retry? I'll close for now but let us know if this still isn't working and we can reopen to address