Skip to content

Reduce number of linux release binaries #11083

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all 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
166 changes: 67 additions & 99 deletions .github/workflows/reusable-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ on:
ghc_targets:
type: string
default: "install_bin install_lib update_package_db install_extra"
gmp:
type: string
default: 6.3.0
cabal:
type: string
default: 3.14.2.0
Expand All @@ -30,6 +33,8 @@ env:
GHC_TEST_VERSION: 9.6.7
GHC_TEST_TARGETS: "install_bin install_lib update_package_db"
CABAL_VERSION: ${{ inputs.cabal }}
GMP_VERSION: ${{ inputs.gmp }}
GMP_URL: "https://ftp.gnu.org/gnu/gmp/"
BOOTSTRAP_HASKELL_NONINTERACTIVE: 1
BOOTSTRAP_HASKELL_MINIMAL: 1
DEBIAN_FRONTEND: noninteractive
Expand Down Expand Up @@ -70,89 +75,19 @@ jobs:
fail-fast: false
matrix:
branch: ${{ fromJSON(inputs.branches) }}
platform: [ { image: "debian:11"
, installCmd: "apt-get update && apt-get install -y"
, toolRequirements: "${{ needs.tool-output.outputs.apt_tools }}"
, DISTRO: "Debian"
, ARTIFACT: "x86_64-linux-deb11"
, ADD_CABAL_ARGS: "--enable-split-sections"
},
{ image: "debian:12"
, installCmd: "apt-get update && apt-get install -y"
, toolRequirements: "${{ needs.tool-output.outputs.apt_tools }}"
, DISTRO: "Debian"
, ARTIFACT: "x86_64-linux-deb12"
, ADD_CABAL_ARGS: "--enable-split-sections"
},
{ image: "ubuntu:20.04"
, installCmd: "apt-get update && apt-get install -y"
, toolRequirements: "${{ needs.tool-output.outputs.apt_tools }}"
, DISTRO: "Ubuntu"
, ARTIFACT: "x86_64-linux-ubuntu20.04"
, ADD_CABAL_ARGS: "--enable-split-sections"
},
{ image: "ubuntu:22.04"
, installCmd: "apt-get update && apt-get install -y"
, toolRequirements: "${{ needs.tool-output.outputs.apt_tools }}"
, DISTRO: "Ubuntu"
, ARTIFACT: "x86_64-linux-ubuntu22.04"
, ADD_CABAL_ARGS: "--enable-split-sections"
},
{ image: "ubuntu:24.04"
, installCmd: "apt-get update && apt-get install -y"
, toolRequirements: "${{ needs.tool-output.outputs.apt_tools_ncurses6 }}"
, DISTRO: "Ubuntu"
, ARTIFACT: "x86_64-linux-ubuntu24.04"
, ADD_CABAL_ARGS: "--enable-split-sections"
},
{ image: "fedora:33"
, installCmd: "dnf install -y"
, toolRequirements: "${{ needs.tool-output.outputs.rpm_tools }}"
, DISTRO: "Fedora"
, ARTIFACT: "x86_64-linux-fedora33"
, ADD_CABAL_ARGS: "--enable-split-sections"
},
{ image: "fedora:36"
, installCmd: "dnf install -y"
, toolRequirements: "${{ needs.tool-output.outputs.rpm_tools }}"
, DISTRO: "Fedora"
, ARTIFACT: "x86_64-linux-fedora36"
, ADD_CABAL_ARGS: "--enable-split-sections"
},
{ image: "fedora:38"
, installCmd: "dnf install -y"
, toolRequirements: "${{ needs.tool-output.outputs.rpm_tools }}"
, DISTRO: "Fedora"
, ARTIFACT: "x86_64-linux-fedora38"
, ADD_CABAL_ARGS: "--enable-split-sections"
},
{ image: "rockylinux:8"
platform: [ { image: "rockylinux:8"
, installCmd: "yum -y install epel-release && yum install -y --allowerasing"
, toolRequirements: "${{ needs.tool-output.outputs.rpm_tools }}"
, DISTRO: "Unknown"
, ARTIFACT: "x86_64-linux-rocky8"
, DISTRO: "Rockylinux"
, ARTIFACT: "x86_64-linux-glibc"
, ADD_CABAL_ARGS: "--enable-split-sections"
},
{ image: "alpine:3.20"
, installCmd: "apk update && apk add"
, toolRequirements: "${{ needs.tool-output.outputs.apk_tools }}"
, DISTRO: "Unknown"
, ARTIFACT: "x86_64-linux-unknown"
, DISTRO: "Alpine"
, ARTIFACT: "x86_64-linux-musl-static"
, ADD_CABAL_ARGS: "--enable-split-sections --enable-executable-static"
},
{ image: "alpine:3.12"
, installCmd: "apk update && apk add"
, toolRequirements: "${{ needs.tool-output.outputs.apk_tools }}"
, DISTRO: "Unknown"
, ARTIFACT: "x86_64-linux-alpine312"
, ADD_CABAL_ARGS: "--enable-split-sections"
},
{ image: "alpine:3.20"
, installCmd: "apk update && apk add"
, toolRequirements: "${{ needs.tool-output.outputs.apk_tools }}"
, DISTRO: "Unknown"
, ARTIFACT: "x86_64-linux-alpine320"
, ADD_CABAL_ARGS: "--enable-split-sections"
}
]
container:
Expand All @@ -172,6 +107,19 @@ jobs:
with:
ref: ${{ matrix.branch }}

- name: install GMP
if: matrix.platform.DISTRO == 'Rockylinux'
run: |
set -eux

curl -O -L ${{ env.GMP_URL }}/gmp-${{ env.GMP_VERSION }}.tar.xz
tar xf gmp-${{ env.GMP_VERSION }}.tar.xz
cd gmp-${{ env.GMP_VERSION }}
CFLAGS=-fPIC ./configure --prefix=$HOME/.local/ --disable-shared
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAIU, static linking of the gmp library is suitable for the distribution of cabal-install since it is possible for an end user to rebuild the relevant cabal-install release (since the source code is distributed) and link against a different version of gmp.

As I think this point is commonly misunderstood, at least linking to a description of this issue would be a good idea I think in case someone else wonders the same thing.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was wondering about a more practical issue: cabal doesn't use gmp itself, the dependency comes from the RTS. How safe is linking against a different version than GHC was built against?

make install
cd ..
echo "extra-lib-dirs: $HOME/.local/lib/" >> cabal.release.project.local

- name: Run build
run: |
bash .github/scripts/build.bash
Expand All @@ -181,6 +129,14 @@ jobs:
DISTRO: ${{ matrix.platform.DISTRO }}
ADD_CABAL_ARGS: ${{ matrix.platform.ADD_CABAL_ARGS }}

- name: check linking
if: matrix.platform.DISTRO == 'Rockylinux'
run: |
cd out
tar xf *.${TARBALL_EXT}
ldd cabal | grep --quiet gmp && exit 1
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This check could also check that there aren't other libraries dynamically linked just-in-case others slip into the build plan accidentally.

rm cabal plan.json

- if: always()
name: Upload artifact
uses: ./.github/actions/upload
Expand Down Expand Up @@ -473,73 +429,85 @@ jobs:
, installCmd: "apt-get update && apt-get install -y"
, toolRequirements: "${{ needs.tool-output.outputs.apt_tools }}"
, DISTRO: "Debian"
, ARTIFACT: "x86_64-linux-deb11"
, ARTIFACT: "x86_64-linux-glibc"
},
{ image: "debian:12"
, installCmd: "apt-get update && apt-get install -y"
, toolRequirements: "${{ needs.tool-output.outputs.apt_tools }}"
, DISTRO: "Debian"
, ARTIFACT: "x86_64-linux-deb12"
, ARTIFACT: "x86_64-linux-glibc"
},
{ image: "ubuntu:20.04"
, installCmd: "apt-get update && apt-get install -y"
, toolRequirements: "${{ needs.tool-output.outputs.apt_tools }}"
, DISTRO: "Ubuntu"
, ARTIFACT: "x86_64-linux-ubuntu20.04"
, ARTIFACT: "x86_64-linux-glibc"
},
{ image: "ubuntu:22.04"
, installCmd: "apt-get update && apt-get install -y"
, toolRequirements: "${{ needs.tool-output.outputs.apt_tools }}"
, DISTRO: "Ubuntu"
, ARTIFACT: "x86_64-linux-ubuntu22.04"
, ARTIFACT: "x86_64-linux-glibc"
},
{ image: "ubuntu:24.04"
, installCmd: "apt-get update && apt-get install -y"
, toolRequirements: "${{ needs.tool-output.outputs.apt_tools_ncurses6 }}"
, DISTRO: "Ubuntu"
, ARTIFACT: "x86_64-linux-ubuntu24.04"
, ARTIFACT: "x86_64-linux-glibc"
},
{ image: "linuxmintd/mint20.3-amd64"
, installCmd: "apt-get update && apt-get install -y"
, toolRequirements: "${{ needs.tool-output.outputs.apt_tools }}"
, DISTRO: "Mint"
, ARTIFACT: "x86_64-linux-glibc"
},
{ image: "linuxmintd/mint21.3-amd64"
, installCmd: "apt-get update && apt-get install -y"
, toolRequirements: "${{ needs.tool-output.outputs.apt_tools }}"
, DISTRO: "Mint"
, ARTIFACT: "x86_64-linux-glibc"
},
{ image: "fedora:33"
, installCmd: "dnf install -y"
, toolRequirements: "${{ needs.tool-output.outputs.rpm_tools }}"
, DISTRO: "Fedora"
, ARTIFACT: "x86_64-linux-fedora33"
, ARTIFACT: "x86_64-linux-glibc"
},
{ image: "fedora:36"
{ image: "fedora:37"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These test platform changes seem unrelated.

, installCmd: "dnf install -y"
, toolRequirements: "${{ needs.tool-output.outputs.rpm_tools }}"
, DISTRO: "Fedora"
, ARTIFACT: "x86_64-linux-fedora36"
, ARTIFACT: "x86_64-linux-glibc"
},
{ image: "fedora:38"
{ image: "fedora:42"
, installCmd: "dnf install -y"
, toolRequirements: "${{ needs.tool-output.outputs.rpm_tools }}"
, DISTRO: "Fedora"
, ARTIFACT: "x86_64-linux-fedora38"
, ARTIFACT: "x86_64-linux-glibc"
},
{ image: "rockylinux:8"
, installCmd: "yum -y install epel-release && yum install -y --allowerasing"
, toolRequirements: "${{ needs.tool-output.outputs.rpm_tools }}"
, DISTRO: "Unknown"
, ARTIFACT: "x86_64-linux-rocky8"
, DISTRO: "Rockylinux"
, ARTIFACT: "x86_64-linux-glibc"
},
{ image: "alpine:3.20"
, installCmd: "apk update && apk add"
, toolRequirements: "${{ needs.tool-output.outputs.apk_tools }}"
, DISTRO: "Unknown"
, ARTIFACT: "x86_64-linux-unknown"
},
{ image: "alpine:3.12"
, installCmd: "apk update && apk add"
, toolRequirements: "${{ needs.tool-output.outputs.apk_tools }}"
, DISTRO: "Unknown"
, ARTIFACT: "x86_64-linux-alpine312"
{ image: "rockylinux:9"
, installCmd: "yum -y install epel-release && yum install -y --allowerasing"
, toolRequirements: "${{ needs.tool-output.outputs.rpm_tools }}"
, DISTRO: "Rockylinux"
, ARTIFACT: "x86_64-linux-glibc"
},
{ image: "alpine:3.20"
, installCmd: "apk update && apk add"
, toolRequirements: "${{ needs.tool-output.outputs.apk_tools }}"
, DISTRO: "Alpine"
, ARTIFACT: "x86_64-linux-musl-static"
},
{ image: "ghcr.io/void-linux/void-glibc:latest"
, installCmd: "xbps-install -Suy xbps && xbps-install -Sy"
, toolRequirements: "${{ needs.tool-output.outputs.xbps_tools }}"
, DISTRO: "Unknown"
, ARTIFACT: "x86_64-linux-alpine320"
, ARTIFACT: "x86_64-linux-musl-static"
}
]
container:
Expand Down
Loading