Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install depends on rustc to find target triple #120

Open
sjparkinson opened this issue Mar 8, 2019 · 3 comments
Open

Install depends on rustc to find target triple #120

sjparkinson opened this issue Mar 8, 2019 · 3 comments

Comments

@sjparkinson
Copy link

If --target isn't supplied there is a dependency on rustc to find the target triple.

trust/install.sh

Lines 99 to 102 in 08c86c0

if [ -z $target ]; then
need grep
need rustc
fi

target=$(rustc -Vv | grep host | cut -d' ' -f2)

Given the usage instructions at https://github.com/japaric/trust#use-the-binary-releases-on-travis-ci, it surprised me that the script uses rustc to find the target triple.

If we could determine target by using commands like uname -a this script would be significantly more portable.

I'll try and dig up what could work across macOS and Linux.

@sjparkinson
Copy link
Author

This is work in progress, but I've also run the script through shellcheck and made a few improvements such as checking if the repository returns a 404 before downloading the releases.

https://gist.github.com/sjparkinson/327dc78c60ab81a06c946630b4288910

I'll make a PR to include these changes too.

@casey
Copy link

casey commented Aug 24, 2019

A project I maintain recently ran into the issue the current trust download script fails on systems where rustc reports a linux-gnu target, because we only provide a prebuilt linux-musl target for portability reasons.

Please feel free to consider this not in-scope for this issue, but it would be nice if a linux system would try to download both the -gnu target and the -musl target. Ideally, it would try the -musl target first, because that's more likely to work on all linux versions of all linux distros, even ones that have a very old system libc.

@rossmacarthur
Copy link

rossmacarthur commented Feb 22, 2021

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

https://github.com/rossmacarthur/install

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants