Skip to content

Action command gets added .. for Windows #2692

Open
@tdewolff

Description

@tdewolff

With node v18.4.0 and node-gyp v9.0.0 on windows-latest of GitHub's CI (actions).

With a binding.gyp of contents

{
    "targets": [{
        "target_name": "minify",
        "product_extension": "node",
        "type": "<(library)",
        "cflags": ["-Wall"],
        "sources": ["minify.c"],
        "libraries": ["../minify.a"],
        "actions": [{
            "action_name": "build_go",
            "message": "Building Go library...",
            "inputs": ["minify.go", "minify.c"],
            "outputs": ["minify.a"],
            "action": ["make", "compile"]
        }],
    }],
}

where Makefile is in the same directory as binding.gyp. This works fine for Linux and MacOS, but fails on Windows as it seems to prepend .. to the second argument of action, resulting in calling make ../compile.

Full output:

gyp info it worked if it ends with ok
gyp info using node-gyp@9.0.0
gyp info using node@18.4.0 | win32 | x64
gyp info find Python using Python version 3.9.13 found at "C:\hostedtoolcache\windows\Python\3.9.13\x64\python3.exe"
gyp http GET https://nodejs.org/download/release/v18.4.0/node-v18.4.0-headers.tar.gz
gyp http 200 https://nodejs.org/download/release/v18.4.0/node-v18.4.0-headers.tar.gz
gyp http GET https://nodejs.org/download/release/v18.4.0/SHASUMS256.txt
gyp http GET https://nodejs.org/download/release/v18.4.0/win-x86/node.lib
gyp http GET https://nodejs.org/download/release/v18.4.0/win-x64/node.lib
gyp http GET https://nodejs.org/download/release/v18.4.0/win-arm64/node.lib
gyp http 200 https://nodejs.org/download/release/v18.4.0/SHASUMS256.txt
gyp http 200 https://nodejs.org/download/release/v18.4.0/win-x86/node.lib
gyp http 200 https://nodejs.org/download/release/v18.4.0/win-x64/node.lib
gyp http 404 https://nodejs.org/download/release/v18.4.0/win-arm64/node.lib
gyp info find VS using VS2022 (17.2.32616.157) found at:
gyp info find VS "C:\Program Files\Microsoft Visual Studio\2022\Enterprise"
gyp info find VS run with --verbose for detailed information
gyp info spawn C:\hostedtoolcache\windows\Python\3.9.13\x64\python3.exe
gyp info spawn args [
gyp info spawn args 'C:\hostedtoolcache\windows\node\18.4.0\x64\node_modules\npm\node_modules\node-gyp\gyp\gyp_main.py',
gyp info spawn args 'binding.gyp',
gyp info spawn args '-f',
gyp info spawn args 'msvs',
gyp info spawn args '-I',
gyp info spawn args 'D:\a\minify\minify\bindings\js\build\config.gypi',
gyp info spawn args '-I',
gyp info spawn args 'C:\hostedtoolcache\windows\node\18.4.0\x64\node_modules\npm\node_modules\node-gyp\addon.gypi',
gyp info spawn args '-I',
gyp info spawn args 'C:\Users\runneradmin\AppData\Local\node-gyp\Cache\18.4.0\include\node\common.gypi',
gyp info spawn args '-Dlibrary=shared_library',
gyp info spawn args '-Dvisibility=default',
gyp info spawn args '-Dnode_root_dir=C:\Users\runneradmin\AppData\Local\node-gyp\Cache\18.4.0',
gyp info spawn args '-Dnode_gyp_dir=C:\hostedtoolcache\windows\node\18.4.0\x64\node_modules\npm\node_modules\node-gyp',
gyp info spawn args '-Dnode_lib_file=C:\\Users\\runneradmin\\AppData\\Local\\node-gyp\\Cache\\18.4.0\\<(target_arch)\\node.lib',
gyp info spawn args '-Dmodule_root_dir=D:\a\minify\minify\bindings\js',
gyp info spawn args '-Dnode_engine=v8',
gyp info spawn args '--depth=.',
gyp info spawn args '--no-parallel',
gyp info spawn args '--generator-output',
gyp info spawn args 'D:\a\minify\minify\bindings\js\build',
gyp info spawn args '-Goutput_dir=.'
gyp info spawn args ]
gyp info spawn C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\MSBuild.exe
gyp info spawn args [
gyp info spawn args 'build/binding.sln',
gyp info spawn args '/clp:Verbosity=minimal',
gyp info spawn args '/nologo',
gyp info spawn args '/p:Configuration=Release;Platform=x64'
gyp info spawn args ]
Building the projects in this solution one at a time. To enable parallel build, please add the "-m" switch.
Building Go library...
mingw32-make: *** No rule to make target '../compile'. Stop.
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(245,5): error MSB8066: Custom build for '..\minify.go' exited with code 2. [D:\a\minify\minify\bindings\js\build\minify.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\MSBuild.exe failed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (C:\hostedtoolcache\windows\node\18.4.0\x64\node_modules\npm\node_modules\node-gyp\lib\build.js:194:23)
gyp ERR! stack at ChildProcess.emit (node:events:537:28)
gyp ERR! stack at ChildProcess._handle.onexit (node:internal/child_process:291:12)
gyp ERR! System Windows_NT 10.0.20348
gyp ERR! command "C:\hostedtoolcache\windows\node\18.4.0\x64\node.exe" "C:\hostedtoolcache\windows\node\18.4.0\x64\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "rebuild"
gyp ERR! cwd D:\a\minify\minify\bindings\js
gyp ERR! node -v v18.4.0
gyp ERR! node-gyp -v v9.0.0
gyp ERR! not ok
npm ERR! code 1
npm ERR! path D:\a\minify\minify\bindings\js
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c node-gyp-build

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions