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.
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:
raft = { version= "0.6.0", default-features= false, features = ["prost-codec"]}
to 'Cargo.toml'wsl -d Ubuntu-18.04 cargo +nightly build -Zbuild-std --target x86_64-unknown-linux-gnu
or, with the following Dockerfile:
run
docker build .\rust-linux-env\ -t rust_cross_compile docker run -v <PWD>:/<WORKING_DIR> -itd rust_cross_compile
followed bydocker logs <CONTAINER>
to get the logs for the executionExpected 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.