Skip to content

fix(railgun): declare libc open as variadic (rustc 1.99 CI build break) - #827

Open
fivetide wants to merge 1 commit into
warpfront:betafrom
fivetide:fix/railgun-open-variadic
Open

fivetide wants to merge 1 commit into
warpfront:betafrom
fivetide:fix/railgun-open-variadic

Conversation

@fivetide

@fivetide fivetide commented Oct 6, 2026

Copy link
Copy Markdown
Collaborator

Summary

rustc 1.99, which CI installs through dtolnay/rust-toolchain@stable, now denies invalid_runtime_symbol_definitions: an extern declaration of a symbol the standard library itself links must match that symbol's signature. railgun's npu module declared open with a non-variadic signature, so every workspace build on beta (the build, test and clippy jobs) fails at railgun:

-        pub fn open(path: *const u8, flags: i32) -> i32;
+        pub fn open(path: *const core::ffi::c_char, flags: i32, ...) -> i32;
 ...
-        let fd = unsafe { sys::open(b"/dev/accel/accel0\0".as_ptr(), sys::O_RDWR | sys::O_CLOEXEC) };
+        let fd = unsafe { sys::open(c"/dev/accel/accel0".as_ptr(), sys::O_RDWR | sys::O_CLOEXEC) };

Evidence

  • Before (cargo +1.99.0 build --release --locked -p railgun --features npu, on beta):
    error: invalid definition of the runtime `open` symbol used by the standard library
      --> crates/railgun/src/npu/mod.rs:24:9
       = note: expected `unsafe extern "C" fn(*const i8, i32, ...) -> i32` (for the current target)
               found    `unsafe extern "C" fn(*const u8, i32) -> i32`
    
    This is the same error as the CI build job on beta 3653dd6d3 (run 37479462665).
  • After: cargo +1.99.0 and cargo +1.97.1 build --release --locked -p railgun --features npu both finish.
  • With this fix applied, the build and clippy jobs pass under 1.99.0 locally, mirroring ci.yml.

The test job still has red that doesn't come from this change: six tests in peacemaker-ir and hipfire-isa run a hardcoded /opt/rocm/core-10.0/lib/llvm/bin/llvm-mc, which a GitHub runner doesn't have. The ungated_examples ratchet also fails on beta. Neither is touched here.

Merge Danger

Door: two-way. The change touches one declaration and its single call site. The ABI is unchanged: the C open is variadic, and the old declaration simply omitted the variadic part.

Blast Radius: railgun with the npu feature only.

rustc 1.99 (CI's dtolnay/rust-toolchain@stable) denies
invalid_runtime_symbol_definitions: an extern declaration of a symbol the
standard library links must match its signature. railgun's npu module
declared open(*const u8, i32), so every CI job that builds the workspace
(build, test, clippy) fails at railgun on beta. Declare it as libc does,
open(*const c_char, i32, ...), and pass a C-string literal.

Verified: cargo +1.99.0 and +1.97.1 build --release -p railgun --features npu.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant