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

Never use the "generic gnu" ponyc package #245

Merged
merged 7 commits into from
Jan 20, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .release-notes/245.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## Stop installing "generic gnu" ponyc builds

Previously, on glibc based Linux distributions, the default setup of ponyup would install the "generic gnu" builds of ponyc. These "generic builds" only work on Linux distributions that are library compatible with the build environment. This use of "generic gnu" made it easy to install a ponyc that wouldn't work on the users platform even if we have ponyc builds for said distribution.

We've stopped using the "generic gnu" builds and instead, on glibc Linux distributions, are using `lsb_release -d` to determine the distribution and if we support the distribution, set up ponyup to install ponyc builds for the distribution in question. If we don't support the distribution or recognize the output of `lsb_release`, an error message is displayed.
30 changes: 15 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@ The `ponyup show` command will display the installed package versions with the s
$ ponyup show
stable-nightly-20191116 *
stable-nightly-20191115
ponyc-release-0.33.0-gnu *
ponyc-nightly-20191116-gnu
ponyc-nightly-20191115-gnu
ponyc-release-0.33.0-musl *
ponyc-nightly-20191116-musl
ponyc-nightly-20191115-musl
corral-nightly-20191115 * -- corral-nightly-20191116
changelog-tool-nightly-20191116
changelog-tool-nightly-20191115 *
Expand All @@ -91,9 +91,9 @@ The `show` command also has an optional `package` argument to show only the inst

```console
$ ponyup show ponyc
ponyc-release-0.33.0-gnu *
ponyc-nightly-20191116-gnu
ponyc-nightly-20191115-gnu
ponyc-release-0.33.0-musl *
ponyc-nightly-20191116-musl
ponyc-nightly-20191115-musl
```

### Select an installed package as default
Expand All @@ -102,19 +102,19 @@ The `select` command can switch which installed package version to set as defaul

```console
$ ponyup show ponyc
ponyc-release-0.33.0-gnu *
ponyc-nightly-20191116-gnu
ponyc-nightly-20191115-gnu
ponyc-release-0.33.0-ubuntu18.04 *
ponyc-nightly-20191116-ubuntu18.04
ponyc-nightly-20191115-ubuntu18.04
$ ponyc --version
0.33.0-98c36095 [release]
compiled with: llvm 7.0.1 -- cc (Ubuntu 7.4.0-1ubuntu1~18.04.1) 7.4.0
Defaults: pic=true
$ ponyup select ponyc nightly-20191116
selecting ponyc-nightly-20191116-gnu as default for ponyc
selecting ponyc-nightly-20191116-ubuntu18.04 as default for ponyc
$ ponyup show ponyc
ponyc-release-0.33.0-gnu
ponyc-nightly-20191116-gnu *
ponyc-nightly-20191115-gnu
ponyc-release-0.33.0-ubuntu18.04
ponyc-nightly-20191116-ubuntu18.04 *
ponyc-nightly-20191115-ubuntu18.04
$ ponyc --version
nightly-20191116 [release]
compiled with: llvm 7.1.0 -- cc (Ubuntu 7.4.0-1ubuntu1~18.04.1) 7.4.0
Expand All @@ -123,7 +123,7 @@ Defaults: pic=true

### Platform options

Ponyup is able to detect the CPU architecture and operating system of the platform on which it is running. The `--platform` option is used to override any field in the platform identifier (e.g. `x86_64-linux-gnu`).
Ponyup is able to detect the CPU architecture and operating system of the platform on which it is running. The `--platform` option is used to override any field in the platform identifier (e.g. `x86_64-linux-ubuntu22.04`).

### Common Issues

Expand All @@ -133,4 +133,4 @@ Ponyup is able to detect the CPU architecture and operating system of the platfo
error: unexpected selection: ponyc-release-x86_64-unknown-linux
```

This is likely caused by a target triple that does not specify the libc ABI for the platform, as detected by `cc -dumpmachine`. The solution is to manually set the platform identifier using `ponyup default <platform>`, where `<platform>` is a platform identifier such as `x86_64-linux-gnu`.
This is likely caused by a target triple that does not specify the libc ABI for the platform, as detected by `cc -dumpmachine`. The solution is to manually set the platform identifier using `ponyup default <platform>`, where `<platform>` is a platform identifier such as `x86_64-linux-ubuntu22.04`.
6 changes: 3 additions & 3 deletions cmd/cli.pony
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ primitive CLI
"Install or update a package",
[ OptionSpec.string(
"platform",
"Specify platform (such as x86_64-linux-gnu)",
"Specify platform (such as x86_64-linux-ubuntu22.04)",
None,
"")
],
Expand All @@ -59,7 +59,7 @@ primitive CLI
"Select the default version for a package",
[ OptionSpec.string(
"platform",
"Specify platform (such as x86_64-linux-gnu)",
"Specify platform (such as x86_64-linux-ubuntu22.04)",
None,
"")
],
Expand All @@ -68,7 +68,7 @@ primitive CLI
])?
CommandSpec.leaf(
"default",
"Set the default platform (such as x86_64-linux-gnu)",
"Set the default platform (such as x86_64-linux-ubuntu22.04)",
[],
[ ArgSpec.string("platform")
])?
Expand Down
62 changes: 38 additions & 24 deletions ponyup-init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,36 @@ case "${uname_s}" in
Linux*)
case $(cc -dumpmachine) in
*gnu)
platform_triple_distro="gnu"
case "$(lsb_release -d)" in
*"Ubuntu 22.04"*)
platform_triple_distro="ubuntu_22.04"
;;
*"Ubuntu 20.04"*)
platform_triple_distro="ubuntu_20.04"
;;
*"Ubuntu 18.04"*)
platform_triple_distro="ubuntu_18.04"
;;
*"Linux Mint 21"*)
platform_triple_distro="ubuntu_22.04"
;;
*"Linux Mint 20"*)
platform_triple_distro="ubuntu_20.04"
;;
*"Linux Mint 19"*)
platform_triple_distro="ubuntu_18.04"
;;
*"Pop!_OS 22.04"*)
platform_triple_distro="ubuntu_22.04"
;;
*"Pop!_OS 20.04"*)
platform_triple_distro="ubuntu_20.04"
;;
*"Pop!_OS 18.04"*)
platform_triple_distro="ubuntu_18.04"
;;
*) ;;
esac
;;
*musl)
platform_triple_distro="musl"
Expand Down Expand Up @@ -198,29 +227,14 @@ fi
case "${uname_s}" in
Linux*)
if [ "${platform_triple_distro}" = "" ]; then
while true; do
echo "Unable to determine libc type. Please select one of the following:"
echo "1) glibc"
echo "2) musl"
echo "3) cancel"
printf "selection: "
read -r selection
case ${selection} in
1 | glibc)
platform_triple_distro="gnu"
break
;;
2 | musl)
platform_triple_distro="musl"
break
;;
3 | cancel)
exit 1
;;
*) ;;
esac
done
platform_triple="${platform_triple}-${platform_triple_distro}"
echo "Unable to determine Linux platform type."
echo "Please see to manually https://github.com/ponylang/ponyc/blob/main/INSTALL.md#linux to manually set your platform."

# set prefix even if we don't know the default platform to set
"${ponyup_root}/bin/ponyup" --prefix="${prefix}"

# we don't consider this exit to be an error
exit 0
fi
esac

Expand Down
6 changes: 3 additions & 3 deletions test/main.pony
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ class _TestParsePlatform is UnitTest

let tests =
[ as (String, ((CPU, OS, Distro) | None)):
("ponyc-?-?-x86_64-unknown-linux-gnu", (AMD64, Linux, "gnu"))
("ponyc-?-?-x64-linux-gnu", (AMD64, Linux, "gnu"))
("ponyc-?-?-x86_64-unknown-linux-ubuntu22.04", (AMD64, Linux, "ubuntu22.04"))
("ponyc-?-?-x64-linux-ubuntu22.04", (AMD64, Linux, "ubuntu22.04"))
("ponyc-x86_64-pc-linux-ubuntu18.04", (AMD64, Linux, "ubuntu18.04"))
("?-?-?-amd64-linux-gnu", (AMD64, Linux, None))
("?-?-?-amd64-linux-ubuntu22.04", (AMD64, Linux, None))
("ponyc-?-?-x86_64-alpine-linux-musl", (AMD64, Linux, "musl"))
("?-?-?-x86_64-alpine-linux-musl", (AMD64, Linux, None))
("ponyc-?-?-x86_64-apple-darwin", (AMD64, Darwin, None))
Expand Down