From c43b9e7b153b2ba8e801ab13dc398c4c1fc202d7 Mon Sep 17 00:00:00 2001 From: Aleksa Sarai Date: Fri, 23 Jan 2026 01:32:09 +0100 Subject: [PATCH 1/2] build: fix Rust 1.63 builds broken by --crate-type cargo build --crate-type= was stabilised in Rust 1.64, so we need to use the old method of enabling cdylib and staticlib builds for all builds (regardless of the capi feature). This was added by 493cdb2f8e13 ("capi: make opt-in via 'capi' feature"), but the lack of a CI hook checking that the build worked meaned that we missed that this was actually broken on Rust 1.63. Debian bookworm still has Rust 1.63 and will be maintained until June 2026 (with LTS lasting until 2028). As such, we should keep our new releases supporting 1.63 until June 2026 just in case someone decides to package libpathrs for Debian oldstable. Fixes: 493cdb2f8e13 ("capi: make opt-in via 'capi' feature") Signed-off-by: Aleksa Sarai --- Cargo.toml | 2 +- Makefile | 20 ++++++++++++++------ 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index f48b32a..9e1f909 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -48,7 +48,7 @@ rust-version = "1.63" maintenance = { status = "experimental" } [lib] -# When building the CAPI, our Makefile adds --crate-type={cdylib,staticlib}. +# MSRV(1.64): Replace with --crate-type={cdy,static}lib in Makefile. crate-type = ["rlib"] [features] diff --git a/Makefile b/Makefile index 84fe948..522ecbf 100644 --- a/Makefile +++ b/Makefile @@ -48,8 +48,8 @@ CARGO_CHECK := $(call cargo_hack,$(CARGO),check) CARGO_CLIPPY := $(call cargo_hack,$(CARGO),clippy) CARGO_LLVM_COV := $(call cargo_hack,$(CARGO_NIGHTLY),llvm-cov) -RUSTC_FLAGS := --features=capi -- -C panic=abort -CARGO_FLAGS ?= +RUSTC_FLAGS := -C panic=abort +CARGO_FLAGS ?= --features=capi SRC_FILES = $(wildcard Cargo.*) $(shell find . -name '*.rs') @@ -58,21 +58,29 @@ SRC_FILES = $(wildcard Cargo.*) $(shell find . -name '*.rs') debug: target/debug target/debug: $(SRC_FILES) + # MSRV(1.64): Use cargo rustc --crate-type={cdy,static}lib. + sed -i.orig '/^crate-type/ s/=.*/= ["rlib", "cdylib", "staticlib"]/' Cargo.toml + RUSTFLAGS="$(RUSTC_FLAGS)" $(CARGO) build $(CARGO_FLAGS) + mv Cargo.toml{.orig,} # For some reason, --crate-types needs separate invocations. We can't use # #![crate_type] unfortunately, as using it with #![cfg_attr] has been # deprecated. - $(CARGO) rustc $(CARGO_FLAGS) --crate-type=cdylib $(RUSTC_FLAGS) - $(CARGO) rustc $(CARGO_FLAGS) --crate-type=staticlib $(RUSTC_FLAGS) + #$(CARGO) rustc $(CARGO_FLAGS) --crate-type=cdylib $(RUSTC_FLAGS) + #$(CARGO) rustc $(CARGO_FLAGS) --crate-type=staticlib $(RUSTC_FLAGS) .PHONY: release release: target/release target/release: $(SRC_FILES) + # MSRV(1.64): Use cargo rustc --crate-type={cdy,static}lib. + sed -i.orig '/^crate-type/ s/=.*/= ["rlib", "cdylib", "staticlib"]/' Cargo.toml + RUSTFLAGS="$(RUSTC_FLAGS)" $(CARGO) build $(CARGO_FLAGS) + mv Cargo.toml{.orig,} # For some reason, --crate-types needs separate invocations. We can't use # #![crate_type] unfortunately, as using it with #![cfg_attr] has been # deprecated. - $(CARGO) rustc $(CARGO_FLAGS) --release --crate-type=cdylib $(RUSTC_FLAGS) - $(CARGO) rustc $(CARGO_FLAGS) --release --crate-type=staticlib $(RUSTC_FLAGS) + #$(CARGO) rustc $(CARGO_FLAGS) --release --crate-type=cdylib $(RUSTC_FLAGS) + #$(CARGO) rustc $(CARGO_FLAGS) --release --crate-type=staticlib $(RUSTC_FLAGS) .PHONY: smoke-test smoke-test: From bac1c6adb74b8e41c6ecd6f7a525033fa32f03c8 Mon Sep 17 00:00:00 2001 From: Aleksa Sarai Date: Thu, 22 Jan 2026 20:13:37 +0100 Subject: [PATCH 2/2] ci: build libpathrs.so for different Rust versions We need to make sure that in addition to the actual language usage working with our MSRV (veriied with cargo check by CI) that our scripts also work with the MSRV compiler version. Signed-off-by: Aleksa Sarai --- .github/workflows/rust.yml | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 161b543..0b40325 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -23,7 +23,7 @@ on: name: rust-ci env: - RUST_MSRV: "1.63" + RUST_MSRV: &RUST_MSRV "1.63" jobs: codespell: @@ -52,7 +52,7 @@ jobs: - uses: actions/checkout@v6 - uses: dtolnay/rust-toolchain@master with: - toolchain: ${{ env.RUST_MSRV }} + toolchain: *RUST_MSRV - uses: taiki-e/install-action@cargo-hack - name: cargo check run: >- @@ -145,6 +145,23 @@ jobs: run: cargo install --force cbindgen - run: make validate-cbindgen + build: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + rust-version: + - *RUST_MSRV + - stable + - nightly + steps: + - uses: actions/checkout@v6 + - uses: dtolnay/rust-toolchain@master + with: + toolchain: ${{ matrix.rust-version }} + - run: make debug + - run: make release + rustdoc: name: cargo doc runs-on: ubuntu-latest