Skip to content

Commit 4619397

Browse files
fix: pin musl 1.2.5 for DNS fixes (openai#6189)
## Summary musl 1.2.5 includes [several fixes to DNS over TCP](https://www.openwall.com/lists/musl/2024/03/01/2), which appears to be the root cause of openai#6116. This approach is a bit janky, but according to codex: > On the Ubuntu 24.04 runners we use, apt-cache policy musl-tools shows only the distro build (1.2.4-2ubuntu2)" We should build with this version and confirm. ## Testing - [ ] TODO: test and see if this fixes Azure issues
1 parent 6d9ddc2 commit 4619397

File tree

3 files changed

+55
-12
lines changed

3 files changed

+55
-12
lines changed
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Setup musl 1.2.5 toolchain
2+
description: Install musl 1.2.5 from source and configure the linker for the requested target.
3+
inputs:
4+
target:
5+
description: Cargo target triple that requires musl (e.g., x86_64-unknown-linux-musl).
6+
required: true
7+
runs:
8+
using: composite
9+
steps:
10+
- name: Install musl 1.2.5
11+
shell: bash
12+
env:
13+
MUSL_VERSION: 1.2.5
14+
MUSL_PREFIX: /opt/musl-1.2.5
15+
DEBIAN_FRONTEND: noninteractive
16+
run: |
17+
set -euo pipefail
18+
sudo apt-get -y update -o Acquire::Retries=3
19+
sudo apt-get -y install --no-install-recommends build-essential curl pkg-config
20+
21+
curl -sSfL --retry 3 --retry-delay 1 "https://musl.libc.org/releases/musl-${MUSL_VERSION}.tar.gz" -o /tmp/musl.tar.gz
22+
tar -xf /tmp/musl.tar.gz -C /tmp
23+
24+
pushd "/tmp/musl-${MUSL_VERSION}"
25+
./configure --prefix="${MUSL_PREFIX}"
26+
make -j"$(nproc)"
27+
sudo make install
28+
popd
29+
30+
echo "${MUSL_PREFIX}/bin" >> "$GITHUB_PATH"
31+
musl_gcc="${MUSL_PREFIX}/bin/musl-gcc"
32+
"${musl_gcc}" --version
33+
34+
case "${{ inputs.target }}" in
35+
x86_64-unknown-linux-musl)
36+
echo "CC_x86_64_unknown_linux_musl=${musl_gcc}" >> "$GITHUB_ENV"
37+
echo "CARGO_TARGET_X86_64_UNKNOWN_LINUX_MUSL_LINKER=${musl_gcc}" >> "$GITHUB_ENV"
38+
;;
39+
aarch64-unknown-linux-musl)
40+
echo "CC_aarch64_unknown_linux_musl=${musl_gcc}" >> "$GITHUB_ENV"
41+
echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER=${musl_gcc}" >> "$GITHUB_ENV"
42+
;;
43+
*)
44+
echo "Unsupported musl target '${{ inputs.target }}'" >&2
45+
exit 1
46+
;;
47+
esac

.github/workflows/rust-ci.yml

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -217,14 +217,10 @@ jobs:
217217
key: apt-${{ matrix.runner }}-${{ matrix.target }}-v1
218218

219219
- if: ${{ matrix.target == 'x86_64-unknown-linux-musl' || matrix.target == 'aarch64-unknown-linux-musl'}}
220-
name: Install musl build tools
221-
env:
222-
DEBIAN_FRONTEND: noninteractive
223-
shell: bash
224-
run: |
225-
set -euo pipefail
226-
sudo apt-get -y update -o Acquire::Retries=3
227-
sudo apt-get -y install --no-install-recommends musl-tools pkg-config
220+
name: Setup musl 1.2.5 toolchain
221+
uses: ./.github/actions/setup-musl-1_2_5
222+
with:
223+
target: ${{ matrix.target }}
228224

229225
- name: Install cargo-chef
230226
if: ${{ matrix.profile == 'release' }}

.github/workflows/rust-release.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,10 @@ jobs:
9292
key: cargo-${{ matrix.runner }}-${{ matrix.target }}-release-${{ hashFiles('**/Cargo.lock') }}
9393

9494
- if: ${{ matrix.target == 'x86_64-unknown-linux-musl' || matrix.target == 'aarch64-unknown-linux-musl'}}
95-
name: Install musl build tools
96-
run: |
97-
sudo apt-get update
98-
sudo apt-get install -y musl-tools pkg-config
95+
name: Setup musl 1.2.5 toolchain
96+
uses: ./.github/actions/setup-musl-1_2_5
97+
with:
98+
target: ${{ matrix.target }}
9999

100100
- name: Cargo build
101101
run: cargo build --target ${{ matrix.target }} --release --bin codex --bin codex-responses-api-proxy

0 commit comments

Comments
 (0)