Fix Rust compiler SIGSEGV during Debian builds

- Add .cargo/config.toml with safer optimization flags
- Override aggressive Debian build flags that cause crashes
- Change opt-level from 3 to 2 for stability
- Disable LTO (Link Time Optimization) to prevent crashes
- Use multiple codegen units (16) instead of single unit (1)
- Update debian/rules to respect safer Cargo configuration
- Fixes regex-automata compilation crashes in CI/CD
- Project now builds successfully with safer optimization settings
This commit is contained in:
robojerk 2025-08-18 12:14:48 -07:00
parent 45b319046f
commit 3e40c891cc
2 changed files with 40 additions and 2 deletions

8
debian/rules vendored
View file

@ -17,8 +17,12 @@ DEB_BUILD_ARCH ?= $(shell dpkg-architecture -qDEB_BUILD_ARCH)
# Rust target for cross-compilation (simplified)
RUST_TARGET := $(DEB_HOST_ARCH)
# Build flags
CARGO_FLAGS := --release
# Build flags - Use safer flags to avoid Rust compiler SIGSEGV
CARGO_FLAGS := --release --config .cargo/config.toml
# Environment variables for safer builds
export RUSTFLAGS = -C opt-level=2 -C codegen-units=16 -C lto=false
export CARGO_INCREMENTAL = 1
override_dh_auto_build:
@echo "Building apt-ostree for $(DEB_HOST_ARCH)..."