trust icon indicating copy to clipboard operation
trust copied to clipboard

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

Open cs97dah opened this issue 4 years ago • 5 comments

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

cs97dah avatar Jun 22 '20 10:06 cs97dah

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.

samtay avatar Jun 25 '20 08:06 samtay

I'm running into this problem as well.

cantino avatar Jan 31 '21 01:01 cantino

@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

rossmacarthur avatar Feb 22 '21 09:02 rossmacarthur

@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.

cantino avatar Feb 27 '21 18:02 cantino

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')

tyranron avatar Nov 15 '22 10:11 tyranron