Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cant get zeromq to work on Mac M1 #477

Closed
0xrubes opened this issue Aug 4, 2021 · 3 comments · Fixed by #522
Closed

Cant get zeromq to work on Mac M1 #477

0xrubes opened this issue Aug 4, 2021 · 3 comments · Fixed by #522
Labels

Comments

@0xrubes
Copy link

0xrubes commented Aug 4, 2021

Disclaimer: Im new to the Mac world and not too familiar with zmq. I would still appreciate help here :)
On my Macbook M1, I am not getting zmq to work. While the installation throws no errors (yarn add zeromq, yarn add zeromq@6.0.0-beta.6, also yarn add zeromq@6.0.0-beta.6 --build-from-source), it throws symbol errors when I start the application in which zeromq is used:

dyld: lazy symbol binding failed: Symbol not found: _zmq_ctx_new
  Referenced from: /Users/ruben/Work/Chrysalis_Ports/industry-marketplace/ServiceApp/server/node_modules/zeromq/build/Release/zeromq.node
  Expected in: flat namespace

dyld: Symbol not found: _zmq_ctx_new
  Referenced from: /Users/ruben/Work/Chrysalis_Ports/industry-marketplace/ServiceApp/server/node_modules/zeromq/build/Release/zeromq.node
  Expected in: flat namespace

Im doing everything in a Rosetta-Terminal btw.
I did some googling and tried npm set config arch x64 and npm config set platform Mac and rebuilt the packages, then Im getting:

internal/modules/cjs/loader.js:1131
  return process.dlopen(module, path.toNamespacedPath(filename));
                 ^

Error: dlopen(/Users/ruben/Work/Chrysalis_Ports/industry-marketplace/ServiceApp/server/node_modules/zeromq/build/Release/zeromq.node, 1): no suitable image found.  Did find:
	/Users/ruben/Work/Chrysalis_Ports/industry-marketplace/ServiceApp/server/node_modules/zeromq/build/Release/zeromq.node: mach-o, but wrong architecture
	/Users/ruben/Work/Chrysalis_Ports/industry-marketplace/ServiceApp/server/node_modules/zeromq/build/Release/zeromq.node: mach-o, but wrong architecture

Reproducing
Apple M1 Chip, Rosetta Terminal -> add latest zeromq version via yarn in existing application, start application.

Expected behavior
Smooth application start

Tested on

  • Macbook M1
  • OS: MACOS 11.2.3
  • ZeroMQ.js version: zeromq@6.0.0-beta.6
  • node version 14.17.0
@0xrubes 0xrubes added the bug label Aug 4, 2021
@alan-ws
Copy link

alan-ws commented Oct 4, 2021

Would appreciate some help with this

@Y-qwq
Copy link

Y-qwq commented Feb 18, 2022

try reinstall Node.js with an arm64 arch

@belloyang
Copy link

belloyang commented May 17, 2022

I think you will need to build zeromq for arm64 architecture. The current source code doesn't support building for arm64 directly. some modification is needed.
I was able to build zeromq.node for target darwin/arm64 successfully. This is what I did:

  1. open the file ./script/build.sh and add the line in the cmake command:
 -DCMAKE_OSX_ARCHITECTURES="arm64" \
  1. in the root directory of the repo, run command: node-gyp rebuild --arch=arm64
    zeromq.node for darwin/arm64 would be generated afterwards.
  2. run command to verify if the file is correct:
% file build/Release/zeromq.node 
build/Release/zeromq.node: Mach-O 64-bit bundle arm64

hope this help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
4 participants