Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: cross-rs/cross
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v0.1.1
Choose a base ref
...
head repository: cross-rs/cross
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v0.1.2
Choose a head ref
  • 15 commits
  • 22 files changed
  • 2 contributors

Commits on Dec 29, 2016

  1. rename a CommandExt method

    Jorge Aparicio committed Dec 29, 2016

    Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    domdfcoding Dominic Davis-Foster
    Copy the full SHA
    3bb6b96 View commit details
  2. update the README

    issues #4 has been fixed
    Jorge Aparicio committed Dec 29, 2016
    Copy the full SHA
    abf4229 View commit details
  3. switch back to a -dev version

    Jorge Aparicio committed Dec 29, 2016
    Copy the full SHA
    90066c6 View commit details

Commits on Dec 31, 2016

  1. pass USER and XARGO_HOME to the Docker containers

    Jorge Aparicio committed Dec 31, 2016
    Copy the full SHA
    2a1f90f View commit details
  2. add support for cross building thumbv*-none-eabi* targets

    Jorge Aparicio committed Dec 31, 2016
    Copy the full SHA
    2843588 View commit details
  3. install more packages on the thumb*-none-eabi* images

    - gcc + libc6-dev to be able to build build scripts
    
    - libnewlib-dev to be able to cross compile C code for these targets
    Jorge Aparicio committed Dec 31, 2016
    Copy the full SHA
    dd45052 View commit details
  4. use rustup branch of compiler-builtins

    Jorge Aparicio committed Dec 31, 2016
    Copy the full SHA
    2033c73 View commit details
  5. add support for i686-musl

    Jorge Aparicio committed Dec 31, 2016
    Copy the full SHA
    17abfe3 View commit details
  6. enable the thumb targets

    Jorge Aparicio committed Dec 31, 2016
    Copy the full SHA
    6c59529 View commit details
  7. Copy the full SHA
    550ba06 View commit details
  8. switch back to the master branch of compiler-builtins

    Jorge Aparicio committed Dec 31, 2016
    Copy the full SHA
    501f9a6 View commit details
  9. generate-lockfile

    Jorge Aparicio committed Dec 31, 2016
    Copy the full SHA
    6fe4d35 View commit details
  10. clone compiler-builtins recursively

    Jorge Aparicio committed Dec 31, 2016
    Copy the full SHA
    064d915 View commit details
  11. Auto merge of #28 - japaric:thumb, r=japaric

    enable the thumb targets and auto-install the rust-src component
    
    None
    homunkulus committed Dec 31, 2016
    Copy the full SHA
    752b84d View commit details
  12. release v0.1.2

    Jorge Aparicio committed Dec 31, 2016
    Copy the full SHA
    1939756 View commit details
5 changes: 5 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -9,6 +9,7 @@ matrix:
- env: TARGET=aarch64-unknown-linux-gnu
- env: TARGET=armv7-unknown-linux-gnueabihf
- env: TARGET=i686-unknown-linux-gnu
- env: TARGET=i686-unknown-linux-musl
- env: TARGET=mips-unknown-linux-gnu
- env: TARGET=mips64-unknown-linux-gnuabi64
- env: TARGET=mips64el-unknown-linux-gnuabi64
@@ -17,6 +18,10 @@ matrix:
- env: TARGET=powerpc64-unknown-linux-gnu
- env: TARGET=powerpc64le-unknown-linux-gnu
- env: TARGET=s390x-unknown-linux-gnu
- env: TARGET=thumbv6m-none-eabi
- env: TARGET=thumbv7em-none-eabi
- env: TARGET=thumbv7em-none-eabihf
- env: TARGET=thumbv7m-none-eabi
- env: TARGET=x86_64-unknown-linux-musl
- env: TARGET=i686-apple-darwin
os: osx
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -5,6 +5,13 @@ This project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased]

## [v0.1.2] - 2016-12-31

### Added

- Support for `i686-unknown-linux-musl`
- Support for `cross build`ing crates for the `thumbv*-none-eabi*` targets.

## [v0.1.1] - 2016-12-28

### Added
@@ -17,5 +24,6 @@ This project adheres to [Semantic Versioning](http://semver.org/).

- Initial release. Supports 12 targets.

[Unreleased]: https://github.com/japaric/cross/compare/v0.1.1...HEAD
[Unreleased]: https://github.com/japaric/cross/compare/v0.1.2...HEAD
[v0.1.2]: https://github.com/japaric/cross/compare/v0.1.1...v0.1.2
[v0.1.1]: https://github.com/japaric/cross/compare/v0.1.0...v0.1.1
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@ keywords = ["cross", "compilation", "testing", "tool"]
license = "MIT OR Apache-2.0"
name = "cross"
repository = "https://github.com/japaric/cross"
version = "0.1.1"
version = "0.1.2"

[dependencies]
error-chain = "0.7.1"
41 changes: 21 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -43,7 +43,7 @@
## Installation

```
$ cargo install --git https://github.com/japaric/cross
$ cargo install cross
```

## Usage
@@ -89,25 +89,26 @@ because QEMU gets upset when you spawn several threads. This also means that, if
one of your unit tests spawns several threads then it's more likely to fail or,
worst, "hang" (never terminate).

| Target | glibc | GCC | QEMU | OpenSSL | `test` |
|--------------------------------------|-------|-------|-------|---------|:------:|
| `aarch64-unknown-linux-gnu` | 2.19 | 4.8.2 | 2.8.0 | 1.0.2j ||
| `armv7-unknown-linux-gnueabihf` | 2.15 | 4.6.2 | 2.8.0 | 1.0.2j ||
| `i686-unknown-linux-gnu` | 2.15 | 4.6.2 | N/A | 1.0.2j ||
| `mips-unknown-linux-gnu` (\*) | 2.23 | 5.3.1 | 2.8.0 | 1.0.2j ||
| `mips64-unknown-linux-gnuabi64` (\*) | 2.23 | 5.3.1 | 2.8.0 | 1.0.2j ||
| `mips64el-unknown-linux-gnuabi64` | 2.23 | 5.3.1 | 2.8.0 | 1.0.2j ||
| `mipsel-unknown-linux-gnu` | 2.23 | 5.3.1 | 2.8.0 | 1.0.2j ||
| `powerpc-unknown-linux-gnu` | 2.19 | 4.8.2 | 2.7.1 | 1.0.2j ||
| `powerpc64-unknown-linux-gnu` (\*) | 2.19 | 4.8.2 | 2.7.1 | 1.0.2j ||
| `powerpc64le-unknown-linux-gnu` | 2.19 | 4.8.2 | 2.7.1 | 1.0.2j ||
| `s390x-unknown-linux-gnu` | 2.23 | 5.3.1 | 2.8.0 | 1.0.2j | |
| `x86_64-unknown-linux-gnu` | 2.15 | 4.6.2 | N/A | 1.0.2j ||
| `x86_64-unknown-linux-musl` | N/A | 5.3.1 | N/A | 1.0.2j ||

(\*) For some reason behind my comprehension, the build script of the `curl-sys`
crate hangs when `cross build`ing that crate for these three targets
(see [issue #4](https://github.com/japaric/cross/issues/4)).
| Target | libc | GCC | QEMU | OpenSSL | `test` |
|--------------------------------------|--------|-------|-------|---------|:------:|
| `aarch64-unknown-linux-gnu` | 2.19 | 4.8.2 | 2.8.0 | 1.0.2j ||
| `armv7-unknown-linux-gnueabihf` | 2.15 | 4.6.2 | 2.8.0 | 1.0.2j ||
| `i686-unknown-linux-gnu` | 2.15 | 4.6.2 | N/A | 1.0.2j ||
| `i686-unknown-linux-musl` | 1.1.15 | 5.3.1 | N/A | N/A ||
| `mips-unknown-linux-gnu` | 2.23 | 5.3.1 | 2.8.0 | 1.0.2j ||
| `mips64-unknown-linux-gnuabi64` | 2.23 | 5.3.1 | 2.8.0 | 1.0.2j ||
| `mips64el-unknown-linux-gnuabi64` | 2.23 | 5.3.1 | 2.8.0 | 1.0.2j ||
| `mipsel-unknown-linux-gnu` | 2.23 | 5.3.1 | 2.8.0 | 1.0.2j ||
| `powerpc-unknown-linux-gnu` | 2.19 | 4.8.2 | 2.7.1 | 1.0.2j ||
| `powerpc64-unknown-linux-gnu` | 2.19 | 4.8.2 | 2.7.1 | 1.0.2j ||
| `powerpc64le-unknown-linux-gnu` | 2.19 | 4.8.2 | 2.7.1 | 1.0.2j ||
| `s390x-unknown-linux-gnu` | 2.23 | 5.3.1 | 2.8.0 | 1.0.2j | |
| `thumbv6m-none-eabi` | N/A | 5.3.1 | N/A | N/A | |
| `thumbv7em-none-eabi` | N/A | 5.3.1 | N/A | N/A | |
| `thumbv7em-none-eabihf` | N/A | 5.3.1 | N/A | N/A | |
| `thumbv7m-none-eabi` | N/A | 5.3.1 | N/A | N/A | |
| `x86_64-unknown-linux-gnu` | 2.15 | 4.6.2 | N/A | 1.0.2j ||
| `x86_64-unknown-linux-musl` | 1.1.15 | 5.3.1 | N/A | 1.0.2j ||

## Caveats / gotchas

25 changes: 23 additions & 2 deletions ci/script.sh
Original file line number Diff line number Diff line change
@@ -13,7 +13,27 @@ main() {

cargo install --path .

if [ $TARGET != i686-apple-darwin ]; then
case $TARGET in
thumbv*-none-eabi*)
td=$(mktemp -d)

git clone \
--depth 1 \
--recursive \
https://github.com/rust-lang-nursery/compiler-builtins $td

pushd $td
cargo generate-lockfile
cross build --features c --target $TARGET
popd

rm -rf $td

return
;;
esac

if [ $TARGET != i686-apple-darwin && $TARGET != i686-unknown-linux-musl ]; then
td=$(mktemp -d)

git clone --depth 1 https://github.com/rust-lang/cargo $td
@@ -29,7 +49,8 @@ main() {
# NOTE(x86_64-musl) can't test compiler-builtins because that crate needs
# cdylibs and this musl target doesn't support cdylibs
case $TARGET in
s390x-unknown-linux-gnu | \
i686-unknown-linux-musl | \
s390x-unknown-linux-gnu | \
x86_64-unknown-linux-musl)
;;
*)
16 changes: 16 additions & 0 deletions docker/i686-unknown-linux-musl/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM ubuntu:16.04

RUN apt-get update && \
apt-get install -y --no-install-recommends \
gcc-multilib

COPY musl.sh /
RUN bash /musl.sh 1.1.15 i386 -m32

RUN apt-get install -y --no-install-recommends \
ca-certificates \
cmake \
make \
pkg-config

ENV CC_i686_unknown_linux_musl=musl-gcc
32 changes: 32 additions & 0 deletions docker/musl-gcc.specs.x86_64-unknown-linux-musl
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
%rename cpp_options old_cpp_options

*cpp_options:
-nostdinc -isystem /usr/local/include -isystem include%s %(old_cpp_options)

*cc1:
%(cc1_cpu) -nostdinc -isystem /usr/local/include -isystem include%s

*link_libgcc:
-L/usr/local/lib -L .%s

*libgcc:
libgcc.a%s %:if-exists(libgcc_eh.a%s)

*startfile:
%{!shared: /usr/local/lib/%{pie:S}crt1.o} /usr/local/lib/crti.o %{shared|pie:crtbeginS.o%s;:crtbegin.o%s}

*endfile:
%{shared|pie:crtendS.o%s;:crtend.o%s} /usr/local/lib/crtn.o

*link:
-dynamic-linker /lib/ld-musl-x86_64.so.1 -nostdlib %{shared:-shared} %{static:-static} %{rdynamic:-export-dynamic}

*esp_link:


*esp_options:


*esp_cpp_options:


2 changes: 2 additions & 0 deletions docker/musl-gcc.x86_64-unknown-linux-musl
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/sh
exec "${REALGCC:-cc}" "$@" -specs "/usr/local/lib/musl-gcc.specs"
47 changes: 47 additions & 0 deletions docker/musl.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
set -ex

main() {
local version=$1 \
target=$2

local dependencies=(
ca-certificates
curl
make
)

apt-get install -y --no-install-recommends ${dependencies[@]}

local td=$(mktemp -d)

pushd $td
curl https://www.musl-libc.org/releases/musl-$version.tar.gz | \
tar --strip-components=1 -xz

if [ ! -z $target ]; then
ln -s /usr/bin/{,$target-}ar
ln -s /usr/bin/{,$target-}cc
ln -s /usr/bin/{,$target-}ranlib
fi

CFLAGS="-fPIC ${@:3}" ./configure \
--disabled-shared \
--prefix=/usr/local \
$(test -z $target || echo --target=$target)
nice make -j$(nproc)
nice make install
ln -s /usr/bin/ar /usr/local/bin/musl-ar

if [ ! -z $target ]; then
rm /usr/bin/$target-{ar,ranlib}
fi

apt-get purge --auto-remove -y ${dependencies[@]}

popd

rm -rf $td
rm $0
}

main "${@}"
12 changes: 8 additions & 4 deletions docker/openssl.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
set -ex

main() {
local cflags=$4 \
os=$2 \
local os=$2 \
triple=$3 \
version=$1

@@ -22,8 +21,13 @@ main() {
pushd $td
curl https://www.openssl.org/source/openssl-$version.tar.gz | \
tar --strip-components=1 -xz
AR=${triple}ar CC=${triple}gcc ./Configure --prefix=/openssl no-dso $os -fPIC $cflags
nice make -j$(nproc)
AR=${triple}ar CC=${triple}gcc ./Configure \
--prefix=/openssl \
no-dso \
$os \
-fPIC \
${@:4}
nice make -j1
make install

apt-get purge --auto-remove -y ${dependencies[@]}
12 changes: 12 additions & 0 deletions docker/thumbv6m-none-eabi/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM ubuntu:16.04

RUN apt-get update && \
apt-get install -y --no-install-recommends \
ca-certificates \
curl \
gcc \
gcc-arm-none-eabi \
libc6-dev \
libnewlib-dev && \
curl -LSfs http://japaric.github.io/trust/install.sh | \
sh -s -- --git japaric/xargo --tag v0.3.1 --target x86_64-unknown-linux-gnu --to /usr/bin
12 changes: 12 additions & 0 deletions docker/thumbv7em-none-eabi/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM ubuntu:16.04

RUN apt-get update && \
apt-get install -y --no-install-recommends \
ca-certificates \
curl \
gcc \
gcc-arm-none-eabi \
libc6-dev \
libnewlib-dev && \
curl -LSfs http://japaric.github.io/trust/install.sh | \
sh -s -- --git japaric/xargo --tag v0.3.1 --target x86_64-unknown-linux-gnu --to /usr/bin
12 changes: 12 additions & 0 deletions docker/thumbv7em-none-eabihf/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM ubuntu:16.04

RUN apt-get update && \
apt-get install -y --no-install-recommends \
ca-certificates \
curl \
gcc \
gcc-arm-none-eabi \
libc6-dev \
libnewlib-dev && \
curl -LSfs http://japaric.github.io/trust/install.sh | \
sh -s -- --git japaric/xargo --tag v0.3.1 --target x86_64-unknown-linux-gnu --to /usr/bin
12 changes: 12 additions & 0 deletions docker/thumbv7m-none-eabi/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM ubuntu:16.04

RUN apt-get update && \
apt-get install -y --no-install-recommends \
ca-certificates \
curl \
gcc \
gcc-arm-none-eabi \
libc6-dev \
libnewlib-dev && \
curl -LSfs http://japaric.github.io/trust/install.sh | \
sh -s -- --git japaric/xargo --tag v0.3.1 --target x86_64-unknown-linux-gnu --to /usr/bin
13 changes: 9 additions & 4 deletions docker/x86_64-unknown-linux-musl/Dockerfile
Original file line number Diff line number Diff line change
@@ -2,11 +2,15 @@ FROM ubuntu:16.04

RUN apt-get update && \
apt-get install -y --no-install-recommends \
musl-tools && \
ln -s /usr/bin/ar /usr/bin/musl-ar
gcc

COPY musl.sh /
RUN bash /musl.sh 1.1.15
COPY musl-gcc.x86_64-unknown-linux-musl /usr/local/bin/musl-gcc
COPY musl-gcc.specs.x86_64-unknown-linux-musl /usr/local/lib/musl-gcc.specs

COPY openssl.sh /
RUN bash /openssl.sh 1.0.2j linux-x86_64 musl-
RUN bash /openssl.sh 1.0.2j linux-x86_64 musl- -static

RUN apt-get install -y --no-install-recommends \
ca-certificates \
@@ -15,4 +19,5 @@ RUN apt-get install -y --no-install-recommends \
make \
pkg-config

ENV OPENSSL_DIR=/openssl
ENV CC_i686_unknown_linux_musl=musl-gcc \
OPENSSL_DIR=/openssl
2 changes: 1 addition & 1 deletion src/cargo.rs
Original file line number Diff line number Diff line change
@@ -65,5 +65,5 @@ pub fn root() -> Result<Option<PathBuf>> {

/// Pass-through mode
pub fn run(args: &[String], verbose: bool) -> Result<ExitStatus> {
Command::new("cargo").args(args).run_and_get_exit_status(verbose)
Command::new("cargo").args(args).run_and_get_status(verbose)
}
Loading