Skip to content

fix: use absolute paths in libffi.gyp for Windows build#4

Open
watkinspd wants to merge 1 commit into
2060-io:masterfrom
watkinspd:fix/windows-libffi-gyp-paths
Open

fix: use absolute paths in libffi.gyp for Windows build#4
watkinspd wants to merge 1 commit into
2060-io:masterfrom
watkinspd:fix/windows-libffi-gyp-paths

Conversation

@watkinspd

Copy link
Copy Markdown

Summary

Fixes Windows native module build failures caused by relative paths in the preprocess_asm action in deps/libffi/libffi.gyp.

Problem

The preprocess_asm rule action references preprocess_asm.cmd, include, and config/<OS>/<arch> using relative paths. These are relative to deps/libffi/, but when node-gyp executes the action, the working directory is the project root — so all three paths fail to resolve on Windows.

This affects anyone using @2060.io/ffi-napi in a Node.js project on Windows (e.g., projects depending on @hyperledger/anoncreds-nodejs, @openwallet-foundation/askar-nodejs, or @hyperledger/indy-vdr-nodejs).

Fix

Prefix all three paths with <(module_root_dir)/deps/libffi/ so they resolve correctly regardless of working directory. Also removes the call prefix which is unnecessary when using absolute paths.

Note

A similar but incomplete fix was attempted in node-ffi-napi#293, which only changed call to cmd /c without fixing the underlying relative path issue.

Test plan

  • Tested on Windows 11 with Node.js — native modules compile successfully
  • Used in production in a project depending on @hyperledger/anoncreds-nodejs, @openwallet-foundation/askar-nodejs, and @hyperledger/indy-vdr-nodejs

The preprocess_asm action uses relative paths for the command,
include directory, and config directory. When node-gyp runs the
build, the working directory is the project root, not deps/libffi/,
so these paths don't resolve on Windows.

Use <(module_root_dir)/deps/libffi/ prefix for all three paths
to make them work regardless of working directory.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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