Skip to content

fix: write the FFI headers to the profile directory under Cargo 1.100 - #5898

Merged
QuantumExplorer merged 1 commit into
v5.1-devfrom
claude/ffi-headers-cargo-build-layout
Nov 12, 2026
Merged

QuantumExplorer merged 1 commit into
v5.1-devfrom
claude/ffi-headers-cargo-build-layout

Conversation

@QuantumExplorer

@QuantumExplorer QuantumExplorer commented Nov 12, 2026 •

Copy link
Copy Markdown
Member

Basic explanation

What this does: Fixes the Swift SDK build, which fails on every branch since Rust 1.100.0 came out on 12 November. Three build scripts write the C headers that the Swift and C++ SDKs include. They found the directory to write to by counting folders up from where Cargo runs them, and Cargo 1.100 added a folder, so the headers went to the wrong place. The scripts now look for the folder by name.

Value: The "Swift SDK build" check passes again for every open pull request and for v5.1-dev. Anyone building the iOS framework or the C++ SDK locally with Rust 1.100 or later gets working headers too.

Risks: Low. Only three build scripts change, and no shipped code. The headers land in the same place as before under the pinned toolchain, which I checked. The one case the new lookup would get wrong is a package named build, which none of these is.

Issue being fixed or feature implemented

swift-sdk-build.yml installs the stable toolchain. On 12 November stable moved from 1.99.1 to 1.100.0, and the job began to fail on v5.1-dev and on every pull request with:

Missing header: target/aarch64-apple-ios-sim/dev-ios/include/rs-sdk-ffi/rs-sdk-ffi.h
  → ensure 'rs-sdk-ffi' is a dependency of rs-unified-sdk-ffi

Cargo 1.100 changed where a build script's OUT_DIR sits:

up to 1.99 : target/<profile>/build/<package>-<hash>/out
from 1.100 : target/<profile>/build/<package>/<hash>/out

The build scripts took OUT_DIR's third ancestor as target/<profile>. Under the new layout that is target/<profile>/build, so the header was written to target/<profile>/build/include/..., where build_ios.sh does not look.

What was done?

packages/rs-sdk-ffi/build.rs, packages/rs-platform-wallet-ffi/build.rs and packages/rs-sdk-cxx/build.rs take the profile directory as the parent of the nearest ancestor of OUT_DIR named build, which is the same directory under both layouts.

Before, with Cargo 1.100:

target/debug/build/include/rs-sdk-ffi/rs-sdk-ffi.h

After, with Cargo 1.98.1 and with Cargo 1.100:

target/debug/include/rs-sdk-ffi/rs-sdk-ffi.h
target/debug/include/platform-wallet-ffi/platform-wallet-ffi.h
target/debug/include/dash/sdk/ffi.h

The workflow still installs stable. Pinning it to the repository's toolchain would be a separate choice; with this change the build does not depend on it.

How Has This Been Tested?

  • A probe project with a build script printing OUT_DIR confirmed the two layouts under Cargo 1.98.1 and under a 1.100 toolchain.
  • cargo check -p rs-sdk-ffi -p platform-wallet-ffi -p dash-sdk-cxx under the pinned 1.98.1 and under a 1.100 nightly (cargo 1.100.0-nightly, 2026-09-04), each into its own target directory: all headers land under target/debug/include, and nothing under target/debug/build/include.

I have no 1.100.0 stable toolchain locally, so the Swift job on this pull request is the check against the released version. I did not run build_ios.sh.

Breaking Changes

None.

Checklist:

  • I have performed a self-review of my own code
  • My Rust, FFI, WASM, Swift or Kotlin changes follow the coding conventions
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have added "!" to the title and described breaking changes in the corresponding section if my code contains any
  • I have made corresponding changes to the documentation if needed
  • If I added or changed GroveDB structure, I described it in the area's structure.rs, regenerated grovedb-structure.json, and checked the structure viewer link posted on this pull request
  • If I added or changed a system contract's document schemas, I checked the contract viewer link posted on this pull request

For repository code-owners and collaborators only

  • I have assigned this pull request to a milestone

🤖 Generated with Claude Code

PR Hygiene · 8fcbd8d

  • Bots — thepastaclaw not yet — /skip-bots proceeds without the ones not yet reported
  • Self-review — post /self-reviewed
  • Reviewer requests paused — your 5 review slots are occupied; this PR is excluded from reviewers' queues. Required approvals still count without a slot.
  • Build running
  • Approvals
    • rs-platform-wallet-ffi (packages/rs-platform-wallet-ffi/build.rs) — HashEngineering or ZocoLini or llbartekll or romchornyi
    • files with no dedicated owner — you own it
    • rust-sdk-ffi (packages/rs-sdk-ffi/build.rs) — lklimek or shumkov

When every merge requirement is met, the PR Hygiene check passes. Reviewer limits do not block merging; other required GitHub checks and protections still apply.

Cargo 1.100 puts a build script's `OUT_DIR` one level deeper:
`target/<profile>/build/<package>/<hash>/out`, where it was
`target/<profile>/build/<package>-<hash>/out`. The three build scripts that
stage headers under `target/<profile>/include` found that directory by going
three levels up from `OUT_DIR`, so under the new layout the headers landed in
`target/<profile>/build/include` and the Swift SDK build, which installs the
stable toolchain, reported `rs-sdk-ffi.h` missing.

They now take the parent of the `build` directory, which is the profile
directory under both layouts.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
@coderabbitai

coderabbitai Bot commented Nov 12, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 17 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 9d221db and 8fcbd8d.

Files selected for processing: 3

  • packages/rs-platform-wallet-ffi/build.rs
  • packages/rs-sdk-cxx/build.rs
  • packages/rs-sdk-ffi/build.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@github-actions

github-actions Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Waiting for bot review — thepastaclaw not yet. Wait for the missing reviews, or a writer can post /skip-bots to proceed without them; blocking findings still need addressing.
Full checklist in the description.

@github-actions github-actions Bot added the waiting-bots Waiting for the review bots to report on this head label Nov 12, 2026
@thepastaclaw

thepastaclaw commented Nov 12, 2026 •

Copy link
Copy Markdown
Collaborator

🔍 Review in progress — actively reviewing now (commit 8fcbd8d) · triage: low
░░░░░░░░░░░░░░░░░░░░ 1% · about 1 h 10 min left · running for 1 min
✅ triage → ⏳ Phase 1 (0/2 lanes) → ▫️ verify 1 → ▫️ gate → ▫️ Phase 2 → ▫️ verify 2 → ▫️ publish
Estimated from recent reviews of this tier · updated 19:38 UTC · live progress

@QuantumExplorer
QuantumExplorer merged commit 4e3c8f8 into v5.1-dev Nov 12, 2026
40 of 43 checks passed
@QuantumExplorer
QuantumExplorer deleted the claude/ffi-headers-cargo-build-layout branch November 12, 2026 19:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

waiting-bots Waiting for the review bots to report on this head

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants