fix: use absolute paths in libffi.gyp for Windows build#4
Open
watkinspd wants to merge 1 commit into
Open
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes Windows native module build failures caused by relative paths in the
preprocess_asmaction indeps/libffi/libffi.gyp.Problem
The
preprocess_asmrule action referencespreprocess_asm.cmd,include, andconfig/<OS>/<arch>using relative paths. These are relative todeps/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-napiin 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 thecallprefix which is unnecessary when using absolute paths.Note
A similar but incomplete fix was attempted in node-ffi-napi#293, which only changed
calltocmd /cwithout fixing the underlying relative path issue.Test plan