Skip to content

The '--target_arch' parameter does not work #669

Description

@shibd

building for macOS-arm64 but attempting to link with file built for macOS-x86_64

When I execute the following command:

npx node-pre-gyp configure --target_arch="x64"

You can see that the log output is still used arm64.

node-pre-gyp info it worked if it ends with ok
node-pre-gyp info using node-pre-gyp@1.0.9
node-pre-gyp info using node@18.9.1 | darwin | arm64
gyp info it worked if it ends with ok
gyp info using node-gyp@9.1.0
gyp info using node@18.9.1 | darwin | arm64
gyp info find Python using Python version 3.10.6 found at "/opt/homebrew/opt/python@3.10/bin/python3.10"
gyp info spawn /opt/homebrew/opt/python@3.10/bin/python3.10
gyp info spawn args [
gyp info spawn args   '/opt/homebrew/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',

Then it fails when I build:

npx node-pre-gyp build --target_arch=x64

  CC(target) Release/obj.target/nothing/node_modules/node-addon-api/nothing.o
  LIBTOOL-STATIC Release/nothing.a
warning: /Library/Developer/CommandLineTools/usr/bin/libtool: archive library: Release/nothing.a the table of contents is empty (no object file members in the library define global symbols)
  SOLINK_MODULE(target) Release/Pulsar.node
ld: archive has no table of contents file '../pkg/lib/libpulsarwithdeps.a' for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [Release/Pulsar.node] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/opt/homebrew/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:201:23)
gyp ERR! stack     at ChildProcess.emit (node:events:513:28)
gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:291:12)
gyp ERR! System Darwin 21.6.0

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