japaric / trust

Travis CI and AppVeyor template to test your Rust crate on 5 architectures and publish binary releases of it for Linux, macOS and Windows
Apache License 2.0
1.26k stars 59 forks source link

Issue running the trust install script with the latest version of cross #130

Open cs97dah opened 4 years ago

cs97dah commented 4 years ago

Hi there. I wonder if you might be able to help me?

I've noticed the following failure on Travis Linux builds when trying to install the binary release:

$  curl -LSfs https://japaric.github.io/trust/install.sh | \
>     sh -s -- --git japaric/cross

install.sh: GitHub repository: https://github.com/japaric/cross
install.sh: Crate: cross
install.sh: Tag: latest (latest)
install.sh: Target: x86_64-unknown-linux-gnu
install.sh: Installing to: /home/travis/.cargo/bin

gzip: stdin: not in gzip format
tar: Child returned status 1
tar: Error is not recoverable: exiting now

It looks to me like the install.sh script might be incompatible with the latest tag of cross because specifying the previous tag works:

$ curl -LSfs https://japaric.github.io/trust/install.sh | \
>         sh -s -- \
>          --git japaric/cross \
>            --tag v0.1.16
install.sh: GitHub repository: https://github.com/japaric/cross
install.sh: Crate: cross
install.sh: Tag: v0.1.16
install.sh: Target: x86_64-unknown-linux-gnu
install.sh: Installing to: /home/travis/.cargo/bin

We also target mac OS and it looks like it has a similar issue:

$ curl -LSfs https://japaric.github.io/trust/install.sh | \
    sh -s -- --git japaric/cross

install.sh: GitHub repository: https://github.com/japaric/cross
install.sh: Crate: cross
install.sh: Tag: latest (latest)
install.sh: Target: x86_64-apple-darwin
install.sh: Installing to: /Users/dean/.cargo/bin

tar: Unrecognized archive format
tar: Error exit delayed from previous errors.

Do you have any ideas what the problem might be here? I'm afraid I'm a bit of a Rust newbie so I must admit I'm not sure what to look for here. Let me know if I can get anything else to help with this, or if I should actually report this on this Cross project?

Thanks very much, Dean

samtay commented 4 years ago

I can at least answer the first part:

install.sh: Target: x86_64-unknown-linux-gnu
install.sh: Installing to: /home/travis/.cargo/bin

gzip: stdin: not in gzip format
tar: Child returned status 1

happens because the latest cross release doesn't have that -gnu binary. Not sure about the apple problem.

cantino commented 3 years ago

I'm running into this problem as well.

rossmacarthur commented 3 years ago

@cantino I wrote a near drop-in replacement install script that will check for -musl, -gnu suffixes and also even doesn't require rustc to be present on the system to detect the platform (uses platform detection code take from rustup). It should work with the latest cross. Contributions welcome 😄.

https://github.com/rossmacarthur/install

curl -LSfs https://rossmacarthur.github.io/install/crate.sh \
    | bash -s -- --repo "japaric/cross" --to ~/.cargo/bin
cantino commented 3 years ago

@rossmacarthur Appreciated! But I think what I need is an updated version of trust & cross that compiles for M1 Macs.

Edit: unless I'm misunderstanding what you're saying. I'm using trust to build my binary in CI.

tyranron commented 1 year ago

It looks to me like the install.sh script might be incompatible with the latest tag of cross because specifying the previous tag works:

It seems that default detection of the latest tag just doesn't work:

if [ -z $tag ]; then
    tag=$(curl -s "$url/latest" | cut -d'"' -f2 | rev | cut -d'/' -f1 | rev)
    say_err "Tag: latest ($tag)"
else
    say_err "Tag: $tag"
fi

In your log it outputs:

install.sh: Tag: latest (latest)

When it should be:

install.sh: Tag: latest (v0.1.17)

The workaround here would be to detect latest version correctly, but manually:

curl -LSfs https://japaric.github.io/trust/install.sh | \
sh -s -- --git japaric/cross \
         --tag $(curl -s https://api.github.com/repos/japaric/cross/releases/latest \
                 | jq -r '.tag_name')