Git Product home page Git Product logo

cross's Introduction

crates.io crates.io CI Matrix

cross

“Zero setup” cross compilation and “cross testing” of Rust crates

This project is developed and maintained by the cross-rs team. It was previously maintained by the Rust Embedded Working Group Tools team. New contributors are welcome! Please join our Matrix room and say hi.

`cross test`ing a crate for the aarch64-unknown-linux-gnu target
`cross test`ing a crate for the aarch64-unknown-linux-gnu target

Features

  • cross will provide all the ingredients needed for cross compilation without touching your system installation.

  • cross provides an environment, cross toolchain and cross compiled libraries, that produces the most portable binaries.

  • “cross testing”, cross can test crates for architectures other than i686 and x86_64.

  • The stable, beta and nightly channels are supported.

Dependencies

See our Getting Started guide for detailed installation instructions.

One of these container engines is required. If both are installed, cross will default to docker.

  • Docker. Note that on Linux non-sudo users need to be in the docker group or use rootless docker. Read the container engine install guide for the required installation and post-installation steps. Requires version 20.10 (API 1.40) or later.
  • Podman. Requires version 3.4.0 or later.

Installation

cargo install cross --git https://github.com/cross-rs/cross

It's also possible to directly download the pre-compiled release binaries or using cargo-binstall.

Usage

cross has the exact same CLI as Cargo but relies on Docker or Podman. For Docker, you'll have to start the daemon before you can use it.

# (ONCE PER BOOT, on Linux)
# Start the Docker daemon, if it's not already running using systemd
# on WSL2 and other systems using SysVinit, use `sudo service docker start`.
$ sudo systemctl start docker

# MAGIC! This Just Works
$ cross build --target aarch64-unknown-linux-gnu

# EVEN MORE MAGICAL! This also Just Works
$ cross test --target mips64-unknown-linux-gnuabi64

# Obviously, this also Just Works
$ cross rustc --target powerpc-unknown-linux-gnu --release -- -C lto

Additional documentation can be found on the wiki or the docs/ subfolder.

Configuration

Configuring cross behavior

You have four options to configure cross. All of these options use the TOML format for configuration and the possible configuration values are documented here.

Option 1: Configuring cross directly in your Cargo.toml

You can directly set configuration values in your Cargo.toml file, under the [workspace.metadata.cross] table, i.e. key prefix. An example config snippet would look like this:

[workspace.metadata.cross.target.aarch64-unknown-linux-gnu]
# Install libssl-dev:arm64, see <https://github.com/cross-rs/cross/blob/main/docs/custom_images.md#adding-dependencies-to-existing-images>
pre-build = [
    "dpkg --add-architecture $CROSS_DEB_ARCH", 
    "apt-get update && apt-get --assume-yes install libssl-dev:$CROSS_DEB_ARCH"
]
[workspace.metadata.cross.target.armv7-unknown-linux-gnueabi]
image = "my/image:latest"
[workspace.metadata.cross.build]
env.volumes = ["A_DIRECTORY=/path/to/volume"]

Option 2: Configuring cross via a Cross.toml file

You can put your configuration inside a Cross.toml file in your project root directory.

Option 3: Using CROSS_CONFIG to specify the location of your configuration

By setting the CROSS_CONFIG environment variable, you can tell cross where it should search for the config file. This way you are not limited to a Cross.toml file in the project root.

Option 4: Configuring cross through environment variables

Besides the TOML-based configuration files, config can be passed through environment variables, too.

Docker in Docker

When running cross from inside a container, cross needs access to the hosts docker daemon itself. This is normally achieved by mounting the docker daemons socket /var/run/docker.sock. For example:

$ docker run -v /var/run/docker.sock:/var/run/docker.sock -v .:/project \
  -w /project my/development-image:tag cross build --target mips64-unknown-linux-gnuabi64

The image running cross requires the rust development tools to be installed.

With this setup cross must find and mount the correct host paths into the container used for cross compilation. This includes the original project directory as well as the root path of the parent container to give access to the rust build tools.

To inform cross that it is running inside a container set CROSS_CONTAINER_IN_CONTAINER=true.

A development or CI container can be created like this:

FROM rust:1

# set CROSS_CONTAINER_IN_CONTAINER to inform `cross` that it is executed from within a container
ENV CROSS_CONTAINER_IN_CONTAINER=true

# install `cross`
RUN cargo install cross

...

Limitations: Finding the mount point for the containers root directory is currently only available for the overlayfs2 storage driver. In order to access the parent containers rust setup, the child container mounts the parents overlayfs. The parent must not be stopped before the child container, as the overlayfs can not be unmounted correctly by Docker if the child container still accesses it.

Explicitly choose the container engine

By default, cross tries to use Docker or Podman, in that order. If you want to choose a container engine explicitly, you can set the binary name (or path) using the CROSS_CONTAINER_ENGINE environment variable.

For example in case you want use Podman, you can set CROSS_CONTAINER_ENGINE=podman.

Supported targets

A target is considered as “supported” if cross can cross compile a “non-trivial” (binary) crate, usually Cargo, for that target.

Testing support (cross test) is more complicated. It relies on QEMU emulation, so testing may fail due to QEMU bugs rather than bugs in your crate. That said, a target has a ✓ in test column of the table below if it can run the compiler-builtins test suite.

Also, testing is very slow. cross test runs units tests sequentially because QEMU gets upset when you spawn multiple threads. This means that, if one of your unit tests spawns threads, then it's more likely to fail or, worst, never terminate.

Target libc GCC C++ QEMU test
aarch64-linux-android [1] 9.0.8 9.0.8 6.1.0
aarch64-unknown-linux-gnu 2.31 9.4.0 6.1.0
aarch64-unknown-linux-gnu:centos [7] 2.17 4.8.5 4.2.1
aarch64-unknown-linux-musl 1.2.3 9.2.0 6.1.0
arm-linux-androideabi [1] 9.0.8 9.0.8 6.1.0
arm-unknown-linux-gnueabi 2.31 9.4.0 6.1.0
arm-unknown-linux-gnueabihf 2.31 8.5.0 6.1.0
arm-unknown-linux-musleabi 1.2.3 9.2.0 6.1.0
arm-unknown-linux-musleabihf 1.2.3 9.2.0 6.1.0
armv5te-unknown-linux-gnueabi 2.31 9.4.0 6.1.0
armv5te-unknown-linux-musleabi 1.2.3 9.2.0 6.1.0
armv7-linux-androideabi [1] 9.0.8 9.0.8 6.1.0
armv7-unknown-linux-gnueabi 2.31 9.4.0 6.1.0
armv7-unknown-linux-gnueabihf 2.31 9.4.0 6.1.0
armv7-unknown-linux-musleabi 1.2.3 9.2.0 6.1.0
armv7-unknown-linux-musleabihf 1.2.3 9.2.0 6.1.0
i586-unknown-linux-gnu 2.31 9.4.0 N/A
i586-unknown-linux-musl 1.2.3 9.2.0 N/A
i686-unknown-freebsd 1.5 6.4.0 N/A
i686-linux-android [1] 9.0.8 9.0.8 6.1.0
i686-pc-windows-gnu N/A 9.4 N/A
i686-unknown-linux-gnu 2.31 9.4.0 6.1.0
loongarch64-unknown-linux-gnu 2.36 13.2.0 8.2.2
mips-unknown-linux-gnu 2.30 9.4.0 6.1.0
mips-unknown-linux-musl 1.2.3 9.2.0 6.1.0
mips64-unknown-linux-gnuabi64 2.30 9.4.0 6.1.0
mips64-unknown-linux-muslabi64 1.2.3 9.2.0 6.1.0
mips64el-unknown-linux-gnuabi64 2.30 9.4.0 6.1.0
mips64el-unknown-linux-muslabi64 1.2.3 9.2.0 6.1.0
mipsel-unknown-linux-gnu 2.30 9.4.0 6.1.0
mipsel-unknown-linux-musl 1.2.3 9.2.0 6.1.0
powerpc-unknown-linux-gnu 2.31 9.4.0 6.1.0
powerpc64-unknown-linux-gnu 2.31 9.4.0 6.1.0
powerpc64le-unknown-linux-gnu 2.31 9.4.0 6.1.0
riscv64gc-unknown-linux-gnu 2.31 9.4.0 6.1.0
s390x-unknown-linux-gnu 2.31 9.4.0 6.1.0
sparc64-unknown-linux-gnu 2.31 9.4.0 6.1.0
sparcv9-sun-solaris 1.22.7 8.4.0 N/A
thumbv6m-none-eabi [4] 3.3.0 9.2.1 N/A
thumbv7em-none-eabi [4] 3.3.0 9.2.1 N/A
thumbv7em-none-eabihf [4] 3.3.0 9.2.1 N/A
thumbv7m-none-eabi [4] 3.3.0 9.2.1 N/A
thumbv7neon-linux-androideabi [1] 9.0.8 9.0.8 6.1.0
thumbv7neon-unknown-linux-gnueabihf 2.31 9.4.0 N/A
thumbv8m.base-none-eabi [4] 3.3.0 9.2.1 N/A
thumbv8m.main-none-eabi [4] 3.3.0 9.2.1 N/A
thumbv8m.main-none-eabihf [4] 3.3.0 9.2.1 N/A
wasm32-unknown-emscripten [6] 3.1.14 15.0.0 N/A
x86_64-linux-android [1] 9.0.8 9.0.8 6.1.0
x86_64-pc-windows-gnu N/A 9.3 N/A
x86_64-sun-solaris 1.22.7 8.4.0 N/A
x86_64-unknown-freebsd 1.5 6.4.0 N/A
x86_64-unknown-dragonfly [2] [3] 6.0.1 10.3.0 N/A
x86_64-unknown-illumos 1.20.4 8.4.0 N/A
x86_64-unknown-linux-gnu 2.31 9.4.0 6.1.0
x86_64-unknown-linux-gnu:centos [5] 2.17 4.8.5 4.2.1
x86_64-unknown-linux-musl 1.2.3 9.2.0 N/A
x86_64-unknown-netbsd [3] 9.2.0 9.4.0 N/A

[1] libc = bionic; Only works with native tests, that is, tests that do not depends on the Android Runtime. For i686 some tests may fails with the error assertion failed: signal(libc::SIGPIPE, libc::SIG_IGN) != libc::SIG_ERR, see issue #140 for more information.

[2] No std component available.

[3] For some *BSD and Solaris targets, the libc column indicates the OS release version from which libc was extracted.

[4] libc = newlib

[5] Must change image = "ghcr.io/cross-rs/x86_64-unknown-linux-gnu:main-centos" in Cross.toml for [target.x86_64-unknown-linux-gnu] to use the CentOS7-compatible target.

[6] libc = emscripten and GCC = clang

[7] Must change image = "ghcr.io/cross-rs/aarch64-unknown-linux-gnu:main-centos" in Cross.toml for [target.aarch64-unknown-linux-gnu] to use the CentOS7-compatible target.

Additional Dockerfiles for other targets can be found in cross-toolchains. These include MSVC and Apple Darwin targets, which we cannot ship pre-built images of.

Debugging

QEMU_STRACE (v0.1.9+)

You can set the QEMU_STRACE variable when you use cross run to get a backtrace of system calls from “foreign” (non x86_64) binaries.

$ cargo new --bin hello && cd $_

$ QEMU_STRACE=1 cross run --target aarch64-unknown-linux-gnu
9 brk(NULL) = 0x0000004000023000
9 uname(0x4000823128) = 0
(..)
9 write(1,0xa06320,14)Hello, world!
 = 14
9 sigaltstack(0x4000823588,(nil)) = 0
9 munmap(0x0000004000b16000,16384) = 0
9 exit_group(0)

Minimum Supported Rust Version (MSRV)

This crate is guaranteed to compile on stable Rust 1.64.0 and up. It might compile with older versions but that may change in any new patch release.

Some cross-compilation targets require a later Rust version, and using Xargo requires a nightly Rust toolchain.

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Code of Conduct

Contribution to this crate is organized under the terms of the Rust Code of Conduct, the maintainer of this crate, the cross-rs team, promises to intervene to uphold that code of conduct.

cross's People

Contributors

adamgreig avatar alexhuszagh avatar anatawa12 avatar bgermann avatar bors[bot] avatar brainstorm avatar dalance avatar dependabot[bot] avatar dixn avatar dylan-dpc avatar emilgardis avatar fenollp avatar gamma0987 avatar glehmann avatar gnzlbg avatar guihkx avatar har7an avatar homunkulus avatar japaric avatar jules-bertholet avatar kamalmarhubi avatar malbarbo avatar mntns avatar olitha avatar ostrosco avatar otavio avatar reitermarkus avatar strowk avatar ydirson avatar you54f avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cross's Issues

Output when QEMU/docker is actually used

We've been trying to debug some musl test issues, but we aren't certain if they're QEMU bugs or not since musl should be compileable on x86_64-linux for i686 and x86_64 architectures. cross doesn't output anything specific specifying when QEMU or Docker is being used, though Docker can be inferred from stdout. Having both of those output during a run would be quite useful.

Issues with Docker Daemon when user namespace is enabled

When the Docker daemon has user namespace enabled, the following will fail

  • Reading/writing to bind mount volumes
  • --privileged flag

The fix is as simple as adding --userns=host to the docker command. BUT this will break on older Docker client versions that do not support this. I can probably fix this easily, but I am not sure how I should proceed.

EDIT: I suggest this: Use a lazy_static or something similar to do a docker engine version check. (docker version --format '{{.Server.APIVersion}}') Then if the semver is newer than 1.24, we automatically add the flag --userns=host.

Propagate environment variables

I noticed that cross clears all environment variables when building a project with Docker. This breaks some build scripts and code that uses the env! macro.

musl C++ support

Trying to build a Rust project that uses C++ (via gcc-rs) on one of the musl targets fails with "musl-g++ not found". It would be neat if this combination just worked as well as C++ on other targets.

OpenSSL missing for i686-musl

I haven't been able to compile it with musl-gcc.

$ bash /openssl.sh 1.0.2j linux-elf musl- -static
/usr/bin/ld: skipping incompatible ../libssl.a when searching for -lssl
/usr/bin/ld: skipping incompatible ../libssl.a when searching for -lssl
/usr/bin/ld: cannot find -lssl
/usr/bin/ld: skipping incompatible ../libcrypto.a when searching for -lcrypto
/usr/bin/ld: skipping incompatible ../libcrypto.a when searching for -lcrypto
/usr/bin/ld: cannot find -lcrypto
/usr/bin/ld: skipping incompatible /usr/local/lib/libc.a when searching for -lc
/usr/bin/ld: cannot find -lc
collect2: error: ld returned 1 exit status

Support Docker for Mac

Right now on macOS host when target is not for macOS cross simply does nothing and calls cargo directly. But with Docker for Mac running it should be possible to cross compile to all targets that cross supports using docker.

*BSD support?

Hey, great work.

I was wondering if it is possible to support the various *BSDs as part of the platforms? I've definitely had issues with Mio breakage.

cross hangs when building the `curl-sys` crate

for these targets

  • mips-unknown-linux-gnu
  • mips64-unknown-linux-gnuabi64
  • powerpc64-unknown-linux-gnu

I have no idea why. This doesn't even involve QEMU.

cc @alexcrichton. Any tip on how to debug a build scripts that hangs/blocks? There's no output file so I can't inspect the stdout/stderr of the build script.

Newb Help

Will this help me compile a rust binary on my Mac that I want to distribute and run on an Ubuntu server?

libmusl with static OpenSSL?

This looks really cool!

There's a nice trick with musl-libc, where you can build a 100% static Rust executable that works on any distro with a reasonably modern kernel. It's also more-or-less possible to make this work with static OpenSSL. For an example, see https://github.com/emk/rust-musl-builder.

Is there any support for doing something like this with cross? If so, I'd be happy to retire rust-musl-builder and point people at cross!

iOS support

I didn't see any listed iOS support. I thought that I would open an issue for it.

I recently got Mio running iOS CI on Travis. It isn't super generalized, but some of the insights that I discovered could be useful in figuring out how to generalize it.

The iOS CI script is here: https://github.com/carllerche/mio/blob/master/ci/run-ios.sh

The difficulty lies in the fact that a process on iOS must start up a coca application* within 20 seconds or the OS will kill the process. Even more fun is that the iOS application must run on the main thread. This wouldn't be a huge deal except that the rust test runner is pretty limited and also starts on the main thread.

The insight that I had is that you can specify an alternate entry point symbol during the link phase. So, I build a little iOS harness that starts the app then runs the Rust tests.

This could probably be generalized and included in cross.

  • I am not an iPhone dev, so I may be misunderstanding or using wrong terminology.

Can't use custom docker image?

I have this Cargo.toml:

[package]
name = "play-youtube"
version = "0.1.0"
authors = ["LEGOlord208 <[email protected]>"]

[dependencies]
# dependencies here

[target.x86_64-unknown-linux-gnu]
image = "play-youtube"

I have the play-youtube docker image with the latest tag.

Using cross build --release -v --target x86_64-unknown-linux-gnu,
I just see that it doesn't use the image - AND it prints
warning: unused manifest key: target.x86_64-unknown-linux-gnu.image

Help?

EDIT: s/cargo build/cross build

asm.js and wasm32 don't work anymore

I'm not entirely sure what happened, but cross can't compile my code anymore, even though nothing changed in either my code, the rust compiler or cross. I assume Travis themselves broke something.

https://travis-ci.org/CryZe/livesplit-core/jobs/245407142#L596

  = note: WARNING:root:(Emscripten: unknown: [Errno 13] Permission denied, clearing cache)
          CRITICAL:root:Could not verify LLVM version: [Errno 13] Permission denied
          CRITICAL:root:fastcomp in use, but LLVM has not been built with the JavaScript backend as a target, llc reports:
          ===========================================================================
          (no targets could be identified: [Errno 13] Permission denied)
          ===========================================================================
          CRITICAL:root:you can fall back to the older (pre-fastcomp) compiler core, although that is not recommended, see http://kripken.github.io/emscripten-site/docs/building_from_source/LLVM-Backend.html
          INFO:root:(Emscripten: Running sanity checks)
          CRITICAL:root:failing sanity checks due to previous fastcomp failure

glibc version not new enough to compile crates that use error-chain crate as a dependency

I'm trying to use error-chain in one of my project with cross, but it seems that the version of glibc in the ubuntu 12.04 base images is not sufficient for one of the error-chain dependencies called backtrace. Is there a specific reason for the Dockerfiles to base off of ubuntu 12.04 or can they be upgraded to 14.04 or 16.04?

This is the error I currently get:

Build failed, waiting for other jobs to finish...
error: failed to run custom build command for `backtrace v0.3.0`
process didn't exit successfully: `/target/debug/build/backtrace-4d922e79d0b3f0f4/build-script-build` (exit code: 1)
--- stderr
/target/debug/build/backtrace-4d922e79d0b3f0f4/build-script-build: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.17' not found (required by /target/debug/build/backtrace-4d922e79d0b3f0f4/build-script-build)
/target/debug/build/backtrace-4d922e79d0b3f0f4/build-script-build: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.18' not found (required by /target/debug/build/backtrace-4d922e79d0b3f0f4/build-script-build)

segmentation fault when running cross build

On archlinux x86_64
Rust has been installed through rustup

on running
cross build
I have:
[1] 31972 segmentation fault (core dumped) /home/rog/.cargo/bin/cross build

Reproduced on two machines with archlinux x86_64 installed on it

Cross not compatible with SELinux

I've been trying to debug our CI failures by running cross locally, but I've run into Permission denied error when doing so. I'm not really certain where to look to try and debug this issue, so I'm posting here. Any help figuring this out would be appreciated.

$ cross build --target aarch64-unknown-linux-gnu
Unable to find image 'japaric/aarch64-unknown-linux-gnu:v0.1.10' locally
Trying to pull repository docker.io/japaric/aarch64-unknown-linux-gnu ... 
sha256:7bd5365e6aec2cdcab009e59039117f3e8b5e25b089d28d30036a10739225fdc: Pulling from docker.io/japaric/aarch64-unknown-linux-gnu
30d541b48fc0: Pull complete 
8ecd7f80d390: Pull complete 
46ec9927bb81: Pull complete 
2e67a4d67b44: Pull complete 
7d9dd9155488: Pull complete 
08aa1b431028: Pull complete 
7d802a03e2fb: Pull complete 
a37098550b32: Pull complete 
031c3405b7a7: Pull complete 
Digest: sha256:7bd5365e6aec2cdcab009e59039117f3e8b5e25b089d28d30036a10739225fdc
Status: Downloaded newer image for docker.io/japaric/aarch64-unknown-linux-gnu:v0.1.10
sh: 1: cargo: Permission denied

Add x86_64 and i686 manylinux1 targets

The Python Wheel format requires Linux wheels containing compiled binaries to be built using particular versions of glibc, libstdc++ etc, on a CentOS 5.11 distro, specified in PEP 513 to ensure wide compatibility. x86_64 and i686 Docker images to do this are available and maintained by the community, and installing rustup and building libs works fine, but it's an extra step, requiring modifications to a trust setup in order to pull the docker image, install rustup, copy the binaries etc.
Would it be possible for cross to provide these images as targets? I'm happy to work on the PR if you're open to it.

Preferred way to run docker

Being able to run the docker command is equivalent to being root, which is why I'm not quite comfortable adding my regular user to the docker group.

Running docker via sudo is fine, but cross doesn't do this, so I'd have to run cross itself via sudo, which in turn causes all sorts of problems: Build files would be created that belong to root, rustup uses root's configuration (which doesn't exist in my case), and it's just running much more code than necessary as root (including random build scripts of any dependencies, I think!).

This tells me that being in the docker group is indeed the preferred way of using cross (right?), which is already a bit questionable, but there's also no way to get around this, so I'd like some way of configuring how docker is invoked.

Add support for custom docker images

Cross is lacking support for custom docker images. Custom images should be used either by default or optionally.

Option 1:

Cross looks on launch for an image called <target>:<tag> where <tag> is optionally specified with a flag --tag (if none then default tag, i.e latest or latest tagged version). If successful, cross will later launch docker with the specified image. If unsucessful, cross will load japaric/<target>:<tag> (<tag> is also the default here). Cross will also take a docker-image flag to fully specify what image to be used, i.e using other-user/foo:<tag> or <local-image>:<tag> where the user simply gives the full path to cross.

Option 2:

Cross does the same as Option 1 but doesn't look for another image but japaric/<target>:<tag>unless any is specified.

Things to consider

  • cargo --tag is currently undefined, however it could be used in the feature, using --docker-tag could be safer to use for future compatability reasons.
  • Instead of just using flags for cross --docker-image myimage, also consider using enviromental variables for this, possible even using dotenv.
  • When user specifies a full path to an image, parse it with docker_image.replace("{target}", target) so that when using cross --target=<target> --docker-image={target}:v0.1.0, the docker-image will be expanded and set to <target>:v0.1.0.

Access to TARGET variable in tests

I have integration tests which run a binary. Normally, they invoke "target/debug/foo". However, when testing under cross, the binaries are in "target/TARGET/debug/foo".

Would it be possible to export the TARGET variable so that they can be accessed in tests and used to locate built binaries?

I would use "cargo run" but I need to change the cwd of the process to one not under the crate root, so that won't work.

Add a C++ cross-compiler/cross-compiled libstdc++

(This is a feature request)

Since OpenSSL is available in the Docker images, I think it would make sense for there to be a C++ environment as well; arguably it's more common to depend on a C++ library that needs to be cross-compiled than depending on OpenSSL (maybe OpenSSL is more common when dealing with network-related libraries?).

There would need to be a compiler available for the target platform; there would preferably also be an ENV layer in the Docker image that sets environment variables that are compatible with https://github.com/alexcrichton/gcc-rs (e.g. HOST_CXX, TARGET_CXX)

Of course libstdc++ would also be cross-compiled and match the chosen compiler.

Cross fails with error: `"rustup" "target" "list"` failed with exit code: Some(1)

https://github.com/nix-rust/nix has been using cross for its CI tests for a few months now. But on about 25-June, all of our Travis builds started to fail with the error message:

error: "rustup" "target" "list" failed with exit code: Some(1)

I don't know why it started on 25-June. It's probably either a change to Travis (they updated their builders, but they claim it was done by 21-June), or Rustup, or Cross. It looks like cross is refusing to run without a default target, even though cross itself should be installing the toolchain. Do you have any idea why? At the very least, it should print rustup's full error message.

https://travis-ci.org/nix-rust/nix/builds/246718360

Downstream bug: nix-rust/nix#634

unconditionally generate lockfile

Right now, something like this produces an error:

$ cargo add foo
$ cross build
error: failed to write /project/Cargo.lock

Caused by:
  failed to open: /project/Cargo.lock

Support for unprivileged docker daemon

I have my dockerd configured to run under an unprivileged user. However, it seems this is not really supported by cross:

$ cross test --target armv7-unknown-linux-musleabihf
docker: Error response from daemon: Privileged mode is incompatible with user namespaces.
See 'docker run --help'.
error: `"docker" "run" "--privileged" "--rm" "-it" "ubuntu:16.04" "sh" "-c" "apt-get update && apt-get install --no-install-recommends -y binfmt-support qemu-user-static"` failed with exit code: Some(125)
note: run with `RUST_BACKTRACE=1` for a backtrace

It fails with a different error with build, which probably could be solved by granting some unreasonable permissive permissions to ~/.cargo:

docker: Error response from daemon: oci runtime error: container_linux.go:247: starting container process caused "process_linux.go:359: container init caused \"rootfs_linux.go:54: mounting \\\"/home/vorner/.cargo\\\" to rootfs \\\"/var/lib/docker/231072.231072/btrfs/subvolumes/9a8dd48eec320f381e259e8640fb3414aa0baa4874c540c1334396d7a739bffc\\\" at \\\"/cargo\\\" caused \\\"stat /home/vorner/.cargo: permission denied\\\"\"".

Would it be viable to support these more paranoid modes of operation, or at least document this is not supported and why?

Refactor `Target` to separate out triple components?

@japaric would you be open to a refactor of Target break things up a bit. I'm thinking something like what appears in the LLVM source. This would allow is_bsd() to be reduced to:

fn is_bsd(&self) -> bool {
    match self.os {
        FreeBsd | NetBsd | Dragonfly | OpenBsd => true,
        _ => false
    }

and other similar simplifications. The outline I'm imagining is this:

pub struct Triple {
    arch: Arch,
    sub_arch: Option<SubArch>,
    vendor: Vendor,
    os: Os,
    environment: Environment,
}

pub enum Arch {
    X86,
    X86_64,
    /* ... */
}

// Mosty for ARM.
pub enum SubArch {
    ArmV7,
    /* ... */  // Not actually that many for the purposes of cross
}

pub enum Vendor {
    Unknown,
    Apple,
    Pc,
    /* ... */
}

pub enum Os {
    Linux,
    Darwin,
    Windows,
    /* ... */
}

pub enum Environment {
    Gnu,
    GnuEabi,
    GnuEabiHf,
    Musl,
    /* ... */
}

Missing rust-std for targets

x86_64-unknown-dragonfly, armv7-unknown-linux-musleabihf, and arm-unknown-linux-musleabihf are affected. I think this is because rustup doesn't have support for installation on those platforms (see here).

Change gcc/ld/ar version.

Trying to get this to work correctly and one thing I want to do is use the thumbv7em-none-eabi target. I want to use 6.2.0/ but cross provides 4.9.3. How do I change this (if possible)

How to loop over all valid targets?

How could a cross user automatically build for every supported target, like gox?

Is there a command invocation that lists the supported triples?

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.