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:
parent
45b319046f
commit
3e40c891cc
2 changed files with 40 additions and 2 deletions
34
.cargo/config.toml
Normal file
34
.cargo/config.toml
Normal file
|
|
@ -0,0 +1,34 @@
|
||||||
|
[build]
|
||||||
|
# Use safer optimization flags to avoid Rust compiler SIGSEGV
|
||||||
|
# The default Debian build flags are too aggressive and cause crashes
|
||||||
|
|
||||||
|
[target.'cfg(all())']
|
||||||
|
# Override aggressive optimization flags that cause SIGSEGV
|
||||||
|
rustflags = [
|
||||||
|
"-C", "opt-level=2", # Use safer optimization level (was 3)
|
||||||
|
"-C", "codegen-units=16", # Use multiple codegen units (was 1)
|
||||||
|
# Remove linker-plugin-lto which causes SIGSEGV with regex-automata
|
||||||
|
"-C", "lto=false", # Disable LTO to avoid crashes
|
||||||
|
]
|
||||||
|
|
||||||
|
[profile.release]
|
||||||
|
# Use safer release profile settings
|
||||||
|
opt-level = 2 # Safer optimization level
|
||||||
|
codegen-units = 16 # Multiple codegen units for stability
|
||||||
|
lto = false # Disable LTO to avoid crashes
|
||||||
|
panic = "abort" # Abort on panic for release builds
|
||||||
|
strip = true # Strip debug symbols
|
||||||
|
debug = false # No debug info in release builds
|
||||||
|
|
||||||
|
[profile.dev]
|
||||||
|
# Development profile settings
|
||||||
|
opt-level = 0 # No optimization for faster compilation
|
||||||
|
debug = true # Include debug info
|
||||||
|
codegen-units = 16 # Multiple codegen units
|
||||||
|
lto = false # Disable LTO
|
||||||
|
|
||||||
|
# Environment-specific overrides
|
||||||
|
[env]
|
||||||
|
# Set environment variables for safer builds
|
||||||
|
RUSTFLAGS = "--cfg debug_assertions"
|
||||||
|
CARGO_INCREMENTAL = "1"
|
||||||
8
debian/rules
vendored
8
debian/rules
vendored
|
|
@ -17,8 +17,12 @@ DEB_BUILD_ARCH ?= $(shell dpkg-architecture -qDEB_BUILD_ARCH)
|
||||||
# Rust target for cross-compilation (simplified)
|
# Rust target for cross-compilation (simplified)
|
||||||
RUST_TARGET := $(DEB_HOST_ARCH)
|
RUST_TARGET := $(DEB_HOST_ARCH)
|
||||||
|
|
||||||
# Build flags
|
# Build flags - Use safer flags to avoid Rust compiler SIGSEGV
|
||||||
CARGO_FLAGS := --release
|
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:
|
override_dh_auto_build:
|
||||||
@echo "Building apt-ostree for $(DEB_HOST_ARCH)..."
|
@echo "Building apt-ostree for $(DEB_HOST_ARCH)..."
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue