Skip to content

Commit 2a53c9f

Browse files
committed
setup-build-env: use gcc-14 and llvm-20 by default
1 parent be750c4 commit 2a53c9f

File tree

4 files changed

+41
-46
lines changed

4 files changed

+41
-46
lines changed

setup-build-env/action.yml

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@ inputs:
1212
llvm-version:
1313
description: 'llvm version'
1414
required: false
15-
default: '16'
15+
default: '20'
16+
gcc-version:
17+
required: false
18+
default: '14'
1619
arch:
1720
description: 'arch'
1821
required: true
@@ -21,27 +24,27 @@ runs:
2124
steps:
2225
- name: Setup environment
2326
shell: bash
27+
env:
28+
GCC_VERSION: ${{ inputs.gcc-version }}
2429
run: |
25-
echo "::group::Setup"
26-
sudo apt-get update
27-
sudo apt-get install -y cmake flex bison build-essential libssl-dev ncurses-dev xz-utils bc rsync libguestfs-tools qemu-kvm qemu-utils zstd libzstd-dev binutils-dev elfutils libcap-dev libelf-dev libdw-dev python3-docutils texinfo libpcap-dev pkg-config
28-
echo "::endgroup::"
30+
sudo ${GITHUB_ACTION_PATH}/install_packages.sh
2931
- name: Install clang
3032
shell: bash
33+
env:
34+
LLVM_VERSION: ${{ inputs.llvm-version }}
3135
run: |
32-
export LLVM_VERSION=${{ inputs.llvm-version }}
33-
${GITHUB_ACTION_PATH}/install_clang.sh
36+
sudo ${GITHUB_ACTION_PATH}/install_clang.sh
3437
- name: Install pahole
3538
shell: bash
39+
env:
40+
PAHOLE_BRANCH: ${{ inputs.pahole }}
41+
PAHOLE_ORIGIN: ${{ inputs.pahole-origin }}
3642
run: |
37-
export PAHOLE_BRANCH=${{ inputs.pahole }}
38-
export PAHOLE_ORIGIN=${{ inputs.pahole-origin }}
3943
${GITHUB_ACTION_PATH}/build_pahole.sh
40-
- name: set pahole location
41-
shell: bash
42-
run: |
4344
echo "LD_LIBRARY_PATH=${LD_LIBRARY_PATH:-}:/usr/local/lib" >> $GITHUB_ENV
4445
- name: Install cross compilation toolchain
4546
shell: bash
47+
env:
48+
GCC_VERSION: ${{ inputs.gcc-version }}
4649
run: |
47-
${GITHUB_ACTION_PATH}/install_cross_compilation_toolchain.sh ${{ inputs.arch }}
50+
sudo ${GITHUB_ACTION_PATH}/install_cross_compilation_toolchain.sh ${{ inputs.arch }}

setup-build-env/install_clang.sh

Lines changed: 4 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,7 @@
11
#!/bin/bash
22
set -eu
33

4-
source $(cd $(dirname $0) && pwd)/../helpers.sh
5-
6-
# Install required packages
7-
foldable start install_clang "Installing Clang/LLVM"
8-
sudo apt-get update
9-
sudo apt-get install -y g++ libelf-dev
10-
11-
if [[ "${LLVM_VERSION}" == $(llvm_latest_version) ]] ; then
12-
REPO_DISTRO_SUFFIX=""
13-
else
14-
REPO_DISTRO_SUFFIX="-${LLVM_VERSION}"
15-
fi
16-
17-
DISTRIB_CODENAME=$(distrib_codename)
18-
19-
echo "deb https://apt.llvm.org/${DISTRIB_CODENAME}/ llvm-toolchain-${DISTRIB_CODENAME}${REPO_DISTRO_SUFFIX} main" | sudo tee /etc/apt/sources.list.d/llvm.list
20-
n=0
21-
while [ $n -lt 5 ]; do
22-
set +e && \
23-
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - && \
24-
sudo apt-get update && \
25-
sudo apt-get install -y clang-${LLVM_VERSION} lld-${LLVM_VERSION} llvm-${LLVM_VERSION} && \
26-
set -e && \
27-
break
28-
n=$(($n + 1))
29-
done
30-
if [ $n -ge 5 ] ; then
31-
echo "clang install failed"
32-
exit 1
33-
fi
34-
foldable end install_clang
4+
# Assume sudo in this script
5+
curl -O https://apt.llvm.org/llvm.sh
6+
chmod +x llvm.sh
7+
./llvm.sh ${LLVM_VERSION}

setup-build-env/install_cross_compilation_toolchain.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ source /etc/os-release
2020
DEB_ARCH="$(platform_to_deb_arch "${TARGET_ARCH}")"
2121
DEB_HOST_ARCH="$(dpkg --print-architecture)"
2222
UBUNTU_CODENAME=${VERSION_CODENAME:-noble}
23+
GCC_VERSION=${GCC_VERSION:-14}
2324

2425
cat <<EOF | sudo tee /etc/apt/sources.list.d/ubuntu.sources
2526
Types: deb
@@ -52,8 +53,8 @@ sudo apt-get update -y
5253
sudo apt-get install -y \
5354
"crossbuild-essential-${DEB_ARCH}" \
5455
"binutils-${TARGET_ARCH}-linux-gnu" \
55-
"gcc-${TARGET_ARCH}-linux-gnu" \
56-
"g++-${TARGET_ARCH}-linux-gnu" \
56+
"gcc-${GCC_VERSION}-${TARGET_ARCH}-linux-gnu" \
57+
"g++-${GCC_VERSION}-${TARGET_ARCH}-linux-gnu" \
5758
"linux-libc-dev:${DEB_ARCH}" \
5859
"libelf-dev:${DEB_ARCH}" \
5960
"libssl-dev:${DEB_ARCH}" \
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/bin/bash
2+
3+
set -euo pipefail
4+
5+
GCC_VERSION=${GCC_VERSION:-14}
6+
7+
# Assume sudo in this script
8+
apt-get update -y
9+
DEBIAN_FRONTEND=noninteractive apt-get install -y tzdata
10+
apt-get install -y \
11+
bc binutils-dev bison build-essential cmake curl elfutils flex \
12+
libcap-dev libdw-dev libelf-dev libguestfs-tools libpcap-dev \
13+
libssl-dev libzstd-dev ncurses-dev pkg-config python3-docutils \
14+
qemu-kvm qemu-utils rsync texinfo xz-utils zstd
15+
16+
apt-get install -y gcc-${GCC_VERSION} g++-${GCC_VERSION}
17+
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${GCC_VERSION} 10
18+
update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-${GCC_VERSION} 10

0 commit comments

Comments
 (0)