Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File name too long during cargo build #497

Open
garethhu opened this issue Jan 5, 2023 · 0 comments
Open

File name too long during cargo build #497

garethhu opened this issue Jan 5, 2023 · 0 comments

Comments

@garethhu
Copy link

garethhu commented Jan 5, 2023

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 for raft-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

  • CPU architecture: x86_64
  • Distribution and kernel version: attempted on Windows WSL & the rust docker container with build tools installed
  • Any other system details we should know?: I have modified the Windows registry to allow for longer file paths.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant