Skip to content

Commit ceede47

Browse files
committed
fix(build, ci): fix windows stack overflow and drop 32-bit support
This commit introduces a robust, code-based fix for the build-time stack overflow on windows and simplifies our build matrix by dropping support for 32-bit targets. Signed-off-by: azjezz <[email protected]>
1 parent 7964590 commit ceede47

File tree

4 files changed

+20
-34
lines changed

4 files changed

+20
-34
lines changed

.cargo/config.toml

Lines changed: 0 additions & 8 deletions
This file was deleted.

.github/workflows/cd.yml

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -67,26 +67,22 @@ jobs:
6767

6868
# Tier 1 targets:
6969

70-
## Windows MSVC: x86_64, i686
71-
- { target: i686-pc-windows-msvc, os: windows-latest, test: true }
70+
## Windows MSVC: x86_64
7271
- { target: x86_64-pc-windows-msvc, os: windows-latest, test: true }
7372
## macOS: aarch64, x86_64
7473
- { target: aarch64-apple-darwin, os: macos-latest, test: true }
7574
- { target: x86_64-apple-darwin, os: macos-latest, test: true }
76-
## Linux: aarch64, i686, x86_64
75+
## Linux: aarch64, x86_64
7776
- { target: aarch64-unknown-linux-gnu, os: ubuntu-latest, test: true, debian-package: true }
7877
- { target: aarch64-unknown-linux-musl, os: ubuntu-latest, test: true }
79-
- { target: i686-unknown-linux-gnu, os: ubuntu-latest, test: true, debian-package: true }
80-
- { target: i686-unknown-linux-musl, os: ubuntu-latest, test: true }
8178
- { target: x86_64-unknown-linux-gnu, os: ubuntu-latest, test: true, wasm: true, debian-package: true }
8279
- { target: x86_64-unknown-linux-musl, os: ubuntu-latest, test: true }
8380

8481
# Tier 2 targets:
8582

8683
# Windows MinGW: x86_64
8784
- { target: x86_64-pc-windows-gnu, os: windows-latest }
88-
# FreeBSD: x86_64, i686
89-
- { target: i686-unknown-freebsd, os: ubuntu-latest }
85+
# FreeBSD: x86_64
9086
- { target: x86_64-unknown-freebsd, os: ubuntu-latest }
9187
# Linux: arm, armv7, powerpc, powerpc64, powerpc64le, s390x
9288
- { target: arm-unknown-linux-gnueabi, os: ubuntu-latest }
@@ -121,7 +117,6 @@ jobs:
121117
case ${{ matrix.job.target }} in
122118
arm-unknown-linux-*) sudo apt-get -y install gcc-arm-linux-gnueabihf ;;
123119
aarch64-unknown-linux-gnu) sudo apt-get -y install gcc-aarch64-linux-gnu ;;
124-
i686-unknown-linux-gnu) sudo apt-get -y install gcc-multilib g++-multilib ;;
125120
arm-unknown-linux-gnueabihf) sudo apt-get -y install gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf qemu-user ;;
126121
esac
127122
@@ -149,7 +144,6 @@ jobs:
149144
IMAGE=""
150145
case ${{ matrix.job.target }} in
151146
x86_64-unknown-linux-gnu) IMAGE="quay.io/pypa/manylinux2014_x86_64" ;;
152-
i686-unknown-linux-gnu) IMAGE="quay.io/pypa/manylinux2014_i686" ;;
153147
aarch64-unknown-linux-gnu) IMAGE="quay.io/pypa/manylinux2014_aarch64" ;;
154148
powerpc64le-unknown-linux-gnu) IMAGE="quay.io/pypa/manylinux2014_ppc64le" ;;
155149
s390x-unknown-linux-gnu) IMAGE="quay.io/pypa/manylinux2014_s390x" ;;
@@ -173,7 +167,7 @@ jobs:
173167
cargo -V
174168
rustc -V
175169
176-
- name: build
170+
- name: build
177171
shell: bash
178172
run: $BUILD_CMD build --locked --release --target=${{ matrix.job.target }}
179173

@@ -199,15 +193,8 @@ jobs:
199193
echo "binary for target '${{ matrix.job.target }}' requires the following GLIBC versions:"
200194
strings "${{ steps.bin.outputs.BIN_PATH }}" | grep GLIBC_ || echo "No GLIBC version strings found."
201195
202-
- name: run tests (Windows)
203-
if: matrix.job.test && !startsWith(github.ref, 'refs/pull/') && contains(matrix.job.target, '-pc-windows-')
204-
shell: bash
205-
env:
206-
RUSTFLAGS: "-C link-arg=/STACK:8388608"
207-
run: $BUILD_CMD test --workspace --locked --target=${{ matrix.job.target }}
208-
209-
- name: run tests (non-Windows)
210-
if: matrix.job.test && !startsWith(github.ref, 'refs/pull/') && !contains(matrix.job.target, '-pc-windows-')
196+
- name: run tests
197+
if: matrix.job.test && !startsWith(github.ref, 'refs/pull/')
211198
shell: bash
212199
run: $BUILD_CMD test --workspace --locked --target=${{ matrix.job.target }}
213200

@@ -287,7 +274,6 @@ jobs:
287274
# Derive arch from target:
288275
case "$TARGET" in
289276
*x86_64*) DPKG_ARCH="amd64" ;;
290-
*i686*) DPKG_ARCH="i686" ;;
291277
*aarch64*|*arm64*) DPKG_ARCH="arm64" ;;
292278
*arm*hf*) DPKG_ARCH="armhf" ;;
293279
*arm*) DPKG_ARCH="armel" ;;

.github/workflows/ci.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,14 @@ jobs:
5555

5656
- name: cargo clippy
5757
if: matrix.os == 'macos-latest'
58-
run: cargo clippy --workspace --all-targets --all-features -- -D warnings
58+
run: cargo clippy --workspace --all-features -- -D warnings
5959

6060
- name: cargo test
61-
run: cargo test --workspace --locked --all-targets
61+
run: cargo test --workspace --locked
6262

6363
- name: cargo build
64-
if: matrix.rust == 'stable' && matrix.os == 'ubuntu-latest'
65-
run: cargo build --workspace --release --locked --all-targets
64+
if: matrix.rust == 'stable'
65+
run: cargo build --release --locked
6666

6767
- name: Install PHP
6868
if: matrix.rust == 'stable' && matrix.os == 'ubuntu-latest'

build.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,16 @@ pub fn main() -> io::Result<()> {
1212
let out_dir = std::env::var("OUT_DIR").expect("OUT_DIR environment variable not set");
1313
let prelude_file = Path::new(&out_dir).join("prelude.bin");
1414

15-
let prelude = Prelude::build();
16-
let prelude_bin = prelude.encode().expect("Failed to encode the prelude");
15+
let prelude_bin = std::thread::Builder::new()
16+
.stack_size(36 * 1024 * 1024)
17+
.name("prelude_builder".into())
18+
.spawn(|| {
19+
let prelude = Prelude::build();
20+
21+
prelude.encode().expect("Failed to encode the prelude")
22+
})?
23+
.join()
24+
.expect("Failed to join prelude thread");
1725

1826
fs::write(prelude_file, prelude_bin)?;
1927

0 commit comments

Comments
 (0)