Skip to content

MSYS2-MinGW64: make failed error while doing npm install #52

@aamirglb

Description

@aamirglb

Hi,
I compiled the libpostal C library using MSYS2 on Windows 11, using GCC 14.2.0. After that I cloned the node-postal and updated the binding.gyp file for MSYS2-MinGW64 as follows:

{
    "targets": [
        {
            "target_name": "expand",
            "sources": [
                "src/expand.cc"
            ],
            "libraries": [
                "-lpostal", "-L/mingw64/lib"
            ],
            "include_dirs": [
                "<!(node -e \"require('nan')\")",
                "/mingw64/include",
            ]
        },
        {
            "target_name": "parser",
            "sources": [
                "src/parser.cc"
            ],
            "libraries": [
                "-lpostal", "-L/mingw64/lib"
            ],
            "include_dirs": [
                "<!(node -e \"require('nan')\")",
                "/mingw64/include",
            ]
        }
    ]
}

When I try to install node-postal using npm install, I get the following error:

gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
make: Entering directory '/c/temp/postal-test/node-postal/build'
expand.target.mk:89: *** target pattern contains no '%'.  Stop.
make: Leaving directory '/c/temp/postal-test/node-postal/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.<anonymous> (C:\temp\postal-test\msys64\mingw64\lib\node_modules\npm\node_modules\node-gyp\lib\build.js:216:23)
gyp ERR! stack at ChildProcess.emit (node:events:513:28)
gyp ERR! stack at ChildProcess._handle.onexit (node:internal/child_process:294:12)
gyp ERR! System MINGW32_NT-10.0 10.0.22631
gyp ERR! command "C:\\temp\\postal-test\\msys64\\mingw64\\bin\\node.exe" "C:\\temp\\postal-test\\msys64\\mingw64\\lib\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\temp\postal-test\node-postal
gyp ERR! node -v v23.5.0
gyp ERR! node-gyp -v v11.0.0
gyp ERR! not ok

Following lines in auto generated expand.target.mk are causing this error:

$(OBJS): TOOLSET := $(TOOLSET)
$(OBJS): GYP_CFLAGS := $(DEFS_$(BUILDTYPE)) $(INCS_$(BUILDTYPE))  $(CFLAGS_$(BUILDTYPE)) $(CFLAGS_C_$(BUILDTYPE))
$(OBJS): GYP_CXXFLAGS := $(DEFS_$(BUILDTYPE)) $(INCS_$(BUILDTYPE))  $(CFLAGS_$(BUILDTYPE)) $(CFLAGS_CC_$(BUILDTYPE))

How can I fix this error?
Thanks in advance

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions