tikv / raft-rs

Raft distributed consensus algorithm implemented in Rust.
Apache License 2.0
2.93k stars 394 forks source link

File name too long during cargo build #497

Open garethhu opened 1 year ago

garethhu commented 1 year ago

Describe the bug While trying to cargo build with this as a dependency I am receiving the error:

error: failed to run custom build command forraft-proto v0.6.0`

Caused by: process didn't exit successfully: /target/debug/build/raft-proto-5e113eaa23913a2a/build-script-build (exit status: 101) --- stderr thread 'main' panicked at 'Could not create file: Os { code: 36, kind: InvalidFilename, message: "File name too long" }'`

To Reproduce Steps to reproduce the behavior:

  1. Add raft = { version= "0.6.0", default-features= false, features = ["prost-codec"]} to 'Cargo.toml'
  2. On Windows
  3. Ensure wsl Ubuntu-18.04 is installed
  4. Ensure cargo is installed to wsl
  5. Ensure docker is installed
  6. Navigate to project directory in command line
  7. Then either run:

wsl -d Ubuntu-18.04 cargo +nightly build -Zbuild-std --target x86_64-unknown-linux-gnu

or, with the following Dockerfile:

FROM rust:latest
RUN apt update ;apt upgrade -y
RUN apt install -y gcc
RUN rustup target add x86_64-unknown-linux-gnu
RUN rustup toolchain install nightly-x86_64-unknown-linux-gnu
WORKDIR /WORKING_DIR
CMD ["cargo", "build", "--target", "x86_64-unknown-linux-gnu"]

run docker build .\rust-linux-env\ -t rust_cross_compile docker run -v <PWD>:/<WORKING_DIR> -itd rust_cross_compile followed by docker logs <CONTAINER> to get the logs for the execution

Expected behavior The project to build successfully to target a linux system

System information

Additional context The compilation works fine on native Windows using the 'x86_64-pc-windows-msvc' target however I need to compile this for docker for the project I am working on since it involves clustering.