Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Peco602/rust-universal-compiler

Open more actions menu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Test Mentioned in awesome-docker

Rust Universal Compiler Docker image

Container solution to compile Rust projects for Linux, macOS and Windows.

Build the image

docker build -t rust-universal-compiler:latest .

Configure the project

To allow cross-compilation from Linux to Windows and MacOS, it is necessary to create in the project folder the .cargo/config file containing the following lines:

[target.x86_64-pc-windows-msvc]
rustflags = ["-C", "target-feature=+crt-static"]

[target.x86_64-apple-darwin]
linker = "x86_64-apple-darwin14-clang"
ar = "x86_64-apple-darwin14-ar"

Compile the project

Compile for Linux (x86_64-unknown-linux-gnu):

docker run --rm -v $PWD/test-project:/app -w /app rust-universal-compiler:latest cargo build --target x86_64-unknown-linux-gnu --release

Compile for MacOS (x86_64-apple-darwin):

docker run --rm -v $PWD/test-project:/app -w /app rust-universal-compiler:latest cargo build --target x86_64-apple-darwin --release

Compile for Windows (x86_64-pc-windows-msvc):

docker run --rm -v $PWD/test-project:/app -w /app rust-universal-compiler:latest cargo build --target x86_64-pc-windows-msvc --release

DockerHub

Bibliography

About

Container solution to compile Rust projects for Linux, macOS and Windows

Topics

Resources

Stars

Watchers

Forks

Used by

Contributors

Languages

Morty Proxy This is a proxified and sanitized view of the page, visit original site.