fix(ci): resolve all build-rvf-node failures

Three fixes:

1. locking.rs: __errno_location is Linux-only; macOS uses __error().
   Split the extern "C" declarations by target_os so rvf-runtime
   compiles on both platforms.

2. build-rvf-node.yml: NAPI CLI outputs index.<platform>.node instead
   of rvf-node.<platform>.node. Added rename step after build.

3. build-rvf-node.yml: darwin builds need -undefined dynamic_lookup
   RUSTFLAGS so NAPI symbols resolve at runtime via Node.js.
   Added CARGO_TARGET_*_APPLE_DARWIN_RUSTFLAGS env vars.

Co-Authored-By: claude-flow <ruv@ruv.net>
This commit is contained in:
rUv 2026-02-16 22:39:04 +00:00
parent e782f3cdbe
commit f0de332edd
2 changed files with 27 additions and 2 deletions

View file

@ -72,10 +72,20 @@ jobs:
run: npm install -g @napi-rs/cli@^2.18.0
- name: Build rvf-node native module
shell: bash
working-directory: crates/rvf/rvf-node
run: napi build --platform --release --target ${{ matrix.settings.target }}
run: |
napi build --platform --release --target ${{ matrix.settings.target }}
# NAPI CLI may output as index.<platform>.node; rename to rvf-node.<platform>.node
BUILT=$(ls -1 *.*.node 2>/dev/null | head -1)
EXPECTED="rvf-node.${{ matrix.settings.platform }}.node"
if [ -n "$BUILT" ] && [ "$BUILT" != "$EXPECTED" ]; then
mv -v "$BUILT" "$EXPECTED"
fi
env:
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
CARGO_TARGET_AARCH64_APPLE_DARWIN_RUSTFLAGS: "-C link-arg=-undefined -C link-arg=dynamic_lookup"
CARGO_TARGET_X86_64_APPLE_DARWIN_RUSTFLAGS: "-C link-arg=-undefined -C link-arg=dynamic_lookup"
- name: List built artifacts
shell: bash

View file

@ -276,9 +276,18 @@ fn is_pid_alive(pid: u32) -> bool {
#[cfg(unix)]
extern "C" {
fn kill(pid: i32, sig: i32) -> i32;
}
#[cfg(any(target_os = "linux", target_os = "android"))]
extern "C" {
fn __errno_location() -> *mut i32;
}
#[cfg(any(target_os = "macos", target_os = "ios", target_os = "freebsd"))]
extern "C" {
fn __error() -> *mut i32;
}
/// Permission denied errno -- process exists but belongs to another user.
#[cfg(unix)]
const EPERM: i32 = 1;
@ -289,11 +298,17 @@ fn libc_kill(pid: i32, sig: i32) -> i32 {
}
/// Get a pointer to the thread-local errno value.
#[cfg(unix)]
#[cfg(any(target_os = "linux", target_os = "android"))]
fn libc_errno() -> *mut i32 {
unsafe { __errno_location() }
}
/// Get a pointer to the thread-local errno value (macOS/BSD).
#[cfg(any(target_os = "macos", target_os = "ios", target_os = "freebsd"))]
fn libc_errno() -> *mut i32 {
unsafe { __error() }
}
/// Simple CRC32 (not CRC32C) for lock file checksumming.
fn simple_crc32(data: &[u8]) -> u32 {
let mut crc: u32 = 0xFFFFFFFF;