Giter Club home page Giter Club logo

rust-cross-compile-x86_64's Introduction

rust-cross-compile-x86_64

Docker image for cross-compilation Rust programs for Linux, Windows and macOS.

Following toolchains are installed:

  • x86_64-apple-darwin
  • x86_64-pc-windows-gnu
  • x86_64-unknown-linux-musl

Usage

Run the following command in the directory where your Cargo.toml is located.

docker run --rm \
    -v cargo_registry:/usr/local/cargo/registry \
    -v cargo_git:/usr/local/cargo/git \
    -v "$(pwd):/work" \
    -w=/work \
    ghcr.io/agavrilov/rust-cross-compile-x86_64 \
    cross-cargo.sh \
    [your Cargo parameters...]

Make sure you specified the target you want to build for. For example, to build for macOS, specify

--target=x86_64-apple-darwin

There is a convienence script which wraps this command for you. With this script, the example above will become:

./cargo-in-container.sh build --target=x86_64-apple-darwin

rust-cross-compile-x86_64's People

Contributors

agavrilov avatar

Watchers

 avatar  avatar

Forkers

faldor20

rust-cross-compile-x86_64's Issues

Create cross-cargo.sh

Wrapper around 'docker run' to run cargo inside of Docker container. It should be able to mount some host directory and run cargo with parameters inside of this directory or some subdirectory.

Host directory and subdirectory should be passed to the script somehow - command-line parameters (do not mix with cargo parameters) or environment variables

Can't compile if package version is 2021

Cargo.toml:

[package]
name = "osx-cross-test"
version = "0.1.0"
edition = "2021"

No dependencies are listed.

The following error occurs:

error: failed to parse manifest at `/work/Cargo.toml`

Caused by:
  feature `edition2021` is required

  this Cargo does not support nightly features, but if you
  switch to nightly channel you can add
  `cargo-features = ["edition2021"]` to enable this feature

This also happens with any dependencies that are on the edition 2021

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.