zeromq / zeromq.js

:zap: Node.js bindings to the ØMQ library
http://zeromq.github.io/zeromq.js/
MIT License
1.48k stars 212 forks source link

Releasing v6.0.0 #529

Closed aminya closed 2 months ago

aminya commented 1 year ago

I'd like to explain the project's status and track the remaining issues for v6.0.0.

The latest beta builds without any issues, and prebuilt binaries for many platforms are provided.

The normal unit tests pass locally (pnpm run test.skip_gc_tests)

Some of the GC tests for some protocols fail (pnpm run test). However, I don't think these GC tests are crucial for functionality since the tests try to rely on GC's unpredictable behaviour.

If there is an issue that actually blocks us from releasing v6.0.0 please leave a comment.

ni-mkrieg commented 1 year ago

this is a blocker for us on MacOS: https://github.com/zeromq/zeromq.js/issues/530

ni-mkrieg commented 1 year ago

thanks, @aminya, will this be tagged as beta.11?

aminya commented 1 year ago

@ni-mkrieg This is fixed as of https://github.com/zeromq/zeromq.js/releases/tag/v6.0.0-beta.11

ni-mkrieg commented 1 year ago

thanks, yes would be great if you could prevent the whole rebuild, it is not running for a good while and then I get this error on x64 Mac.

ld: library not found for -lsodium
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [Release/zeromq.node] Error 1
rm 7722eaf02fcc073df28ffd1fa831e71544edfd42.intermediate
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/Users/markus.krieg/.nvm/versions/node/v16.13.0/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (node:events:390:28)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12)
gyp ERR! System Darwin 20.6.0
gyp ERR! command "/Users/markus.krieg/.nvm/versions/node/v16.13.0/bin/node" "/Users/markus.krieg/.nvm/versions/node/v16.13.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/markus.krieg/git/native-access/node_modules/zeromq
ni-mkrieg commented 1 year ago

on arm64 / M1 I get this error right away:

-- Configuring incomplete, errors occurred!
See also "/Users/markus.krieg/git/native-access/node_modules/zeromq/build/libzmq-staging/build/CMakeFiles/CMakeOutput.log".
cmake --build ./build --config Release --target install
make[1]: Makefile: No such file or directory
make[1]: *** No rule to make target `Makefile'.  Stop.
  TOUCH Release/obj.target/libzmq.stamp
  CXX(target) Release/obj.target/zeromq/src/context.o
In file included from ../src/context.cc:2:
In file included from ../src/context.h:4:
../src/prefix.h:7:10: fatal error: 'zmq.h' file not found
#include <zmq.h>
         ^~~~~~~
1 error generated.
make: *** [Release/obj.target/zeromq/src/context.o] Error 1
rm 7722eaf02fcc073df28ffd1fa831e71544edfd42.intermediate
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/opt/homebrew/Cellar/node@14/14.20.0/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (events.js:400:28)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:285:12)
gyp ERR! System Darwin 21.5.0
gyp ERR! command "/opt/homebrew/Cellar/node@14/14.20.0/bin/node" "/opt/homebrew/Cellar/node@14/14.20.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/markus.krieg/git/native-access/node_modules/zeromq
aminya commented 1 year ago

This issue can be fixed by installing sodium

brew install libsodium gnutls

Could you install zeromq with npm i --verbose. node-gyp-build doesn't give the reason why the prebuild is not picked up. https://github.com/prebuild/node-gyp-build/issues/54

ni-mkrieg commented 1 year ago

Good news, with sodium installed it did not rebuild on x64 at all any more, testing on arm64 now. I hope sodium is preinstalled on Github servers!

aminya commented 1 year ago

I am working on the node-gyp-build's preinstall logic: https://github.com/prebuild/node-gyp-build/pull/55

Hopefully, that is merged soon, and you will not need to do a rebuild!

ni-mkrieg commented 1 year ago

That would be very cool, even after installing sodium on M1 it is currently still rebuilding indeed. So sodium installed prevented rebuild on x64 but not arm64. Actually I am not 100% sure the brew install for libsodium worked on arm, still getting this line:

ld: library not found for -lsodium

The yarn install --verbose did not contain much useful information either.

verbose 53.652263084 Error: /Users/markus/git/native-access/node_modules/zeromq: Command failed.
Exit code: 1
Command: (shx test -f ./script/build.js || run-s build.js) && node-gyp-build
Arguments: 
Directory: /Users/markus/git/native-access/node_modules/zeromq
Output:
dyld[91022]: missing symbol called

Downloading libzmq source from https://github.com/zeromq/libzmq/releases/download/v4.3.4/zeromq-4.3.4.tar.gz
Building libzmq Release
ni-mkrieg commented 1 year ago

Okay so an x64 this is the reason why it rebuilds, I believe because it cannot find libsodium that is needed by your precompiled binary? That would also explain why it does not recompile after I install libsodium via homebrew. Is there a way for you to compile that lib into your prebuilt binary and not dynamically link to it?

Or could you replace libsodium all together with something that is already preinstalled during CI? Does not make sense for you either to spend all this time brew installing it during every CI build...

verbose 108.080591296 Error: /Users/markus/git/native-access/node_modules/zeromq: Command failed.
Exit code: 1
Command: (shx test -f ./script/build.js || run-s build.js) && node-gyp-build
Arguments: 
Directory: /Users/markus/git/native-access/node_modules/zeromq
Output:
node:internal/modules/cjs/loader:1183
  return process.dlopen(module, path.toNamespacedPath(filename));
                 ^

Error: dlopen(/Users/markus/git/native-access/node_modules/zeromq/prebuilds/darwin-x64/node.napi.glibc.node, 1): Library not loaded: /usr/local/opt/libsodium/lib/libsodium.23.dylib
  Referenced from: /Users/markus/git/native-access/node_modules/zeromq/prebuilds/darwin-x64/node.napi.glibc.node
  Reason: image not found
    at Object.Module._extensions..node (node:internal/modules/cjs/loader:1183:18)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at load (/Users/markus/git/native-access/node_modules/node-gyp-build/index.js:22:10)
    at Object.<anonymous> (/Users/markus/git/native-access/node_modules/node-gyp-build/build-test.js:19:19)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Module.load (node:internal/modules/cjs/loader:981:32) {
  code: 'ERR_DLOPEN_FAILED'
}
aminya commented 1 year ago

libsodium is preinstalled on the GitHub runners, and it is very small. I am not sure where you are running this. GitHub doesn't offer an Arm runner. Please contact your CI engineer.

ni-mkrieg commented 1 year ago

all good if we do not have to rebuild, was more worried about your own CI.yml file having to do this for each build:

- name: Install Mac-OS Dependencies
        if: contains(matrix.os, 'macos')
        run: |
          brew install libsodium gnutls

were you able to avoid the rebuild on Mac x64 and arm64 - ideally without us having to install libsodium? it worked fine without libsodium installed in beta.6 for Mac x64...

aminya commented 1 year ago

That snippet is just to declare the dependencies to be more accurate. In practice it does nothing because it is already installed: https://github.com/zeromq/zeromq.js/actions/runs/3483046346/jobs/5826083947#step:7:11

You will need the libsodium dynamic library in either case during runtime. Without that library, the connections will not be secure.

Regarding the rebuild, I am still handling the external node-gyp-build issues. Please stay tuned.

bfan1256 commented 1 year ago

I have done brew install and ran a verbose and can see that libsodium is found But it just happens at the final linking step that it just can't find -lsodium

I'm on M1 Mac ARM (osx64)

ld: library not found for -lsodium
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [Release/zeromq.node] Error 1
rm 7722eaf02fcc073df28ffd1fa831e71544edfd42.intermediate
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (node:events:390:28)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12)
gyp ERR! System Darwin 21.6.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/weigfan/code/shade-cinema/shade-plugin/node_modules/zeromq
td-krzysiek commented 1 year ago

Hello,

Exactly the same issue here on M1, this is after brew reinstall libsodium gnutls. Full log:

2022-11-22T11_35_47_985Z-debug-0.log

td-krzysiek commented 1 year ago

Hi,

I actually added one line to fix this

link_directories(${SODIUM_LIBRARY_DIRS})

below this line: https://github.com/zeromq/libzmq/blob/edfbb1ced652a93fd39c38338be9eb0f444f6e41/CMakeLists.txt#L269 node_modules/zeromq/build/libzmq/zeromq-4.3.2/CMakeLists.txt

and then to rebuild:

cd node_modules/zeromq
../.bin/node-gyp-build
aminya commented 1 year ago

@td-krzysiek could you make a pull request in that repository?

td-krzysiek commented 1 year ago

Done & looking forward for the V6 release 👍

DonJayamanne commented 1 year ago

Hi, Thank you for looking into releasing a new version. I'm one of the engineers working on the Jupyter extension for VS Code This package is used to communicate with Jupyter kernels (python kernels) over zmq

We found that the package fails in some cases which you may be aware of You have requested this new version to be tested here https://github.com/microsoft/vscode-jupyter/issues/10386#issuecomment-1315042452

I'll test this and get back to you with a confirmation. Again thanks for your contribution to this project

aminya commented 1 year ago

Done & looking forward for the V6 release 👍

The fix is merged! Now on master.

bfan1256 commented 1 year ago

Awesome! We want to start testing this integration. Could you push up an NPM release?

aminya commented 1 year ago

v6.0.0-beta.12 is released with the latest changes! P.S: Resolved the fixed comments.

bfan1256 commented 1 year ago

Looks like I'm still getting the same issue with the -LSodium

  TOUCH Release/obj.target/libzmq.stamp
  CXX(target) Release/obj.target/zeromq/src/context.o
  CXX(target) Release/obj.target/zeromq/src/incoming_msg.o
  CXX(target) Release/obj.target/zeromq/src/module.o
  CXX(target) Release/obj.target/zeromq/src/observer.o
  CXX(target) Release/obj.target/zeromq/src/outgoing_msg.o
  CXX(target) Release/obj.target/zeromq/src/proxy.o
  CXX(target) Release/obj.target/zeromq/src/socket.o
  SOLINK_MODULE(target) Release/zeromq.node
ld: library not found for -lsodium
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [Release/zeromq.node] Error 1
rm 7722eaf02fcc073df28ffd1fa831e71544edfd42.intermediate
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (node:events:390:28)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12)
gyp ERR! System Darwin 21.6.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/weigfan/code/shade-cinema/shade-plugin/node_modules/zeromq
td-krzysiek commented 1 year ago

Yep, I confirm this, the problem is that zeromq.js is compiling node_modules/zeromq/build/libzmq/zeromq-4.3.2 which isn't master but exact 4.3.2 release and link_libraries line is missing there.

EDIT: actually please ignore above, I had a local copy of zeromq which was misleading. Indeed it is compiling latest version and I still get sodium linking error. I'll look into this later today.

aminya commented 1 year ago

Ok, try v6.0.0-beta.13. I forked node-gyp-build, and published my fixes. This should skip rebuilding, and if it does, it will give a clear message on the reason for rebuilding.

bfan1256 commented 1 year ago

New Error.

Looks like it's related to something like this

verbose 6.1542075 Error: /Users/weigfan/code/shade-cinema/shade-plugin/node_modules/zeromq: Command failed.
Exit code: 127
Command: (shx test -f ./script/build.js || run-s build.js) && node-gyp-build
Arguments: 
Directory: /Users/weigfan/code/shade-cinema/shade-plugin/node_modules/zeromq
Output:
env: node\r: No such file or directory
    at ProcessTermError.ExtendableBuiltin (/Users/weigfan/.yarn/lib/cli.js:721:66)
    at ProcessTermError.MessageError (/Users/weigfan/.yarn/lib/cli.js:750:123)
    at new ProcessTermError (/Users/weigfan/.yarn/lib/cli.js:790:113)
    at ChildProcess.<anonymous> (/Users/weigfan/.yarn/lib/cli.js:25787:17)
    at ChildProcess.emit (node:events:390:28)
    at maybeClose (node:internal/child_process:1064:16)
    at Socket.<anonymous> (node:internal/child_process:450:11)
    at Socket.emit (node:events:390:28)
    at Pipe.<anonymous> (node:net:687:12)
error /Users/weigfan/code/shade-cinema/shade-plugin/node_modules/zeromq: Command failed.
td-krzysiek commented 1 year ago

https://github.com/zeromq/zeromq.js/blob/master/binding.gyp#L86

I replaced it with '<!@(pkg-config libsodium --libs)',, and it seems to work now. Tested with 6.0.0-beta.12 for now, haven't tried beta.13 yet.

EDIT: beta.13 gives the same issue with sodium ld: library not found for -lsodium, this fixes build for beta.13:

wget $(npm view zeromq dist.tarball)
tar -xzf zeromq-6.0.0-beta.13.tgz
cd package
vim binding.gyp /* modify as mentioned above */
npm i --verbose
aminya commented 1 year ago

Please test v6.0.0-beta.14. It should give more information on the reason for the rebuild.

Y-qwq commented 1 year ago

Please test v6.0.0-beta.14. It should give more information on the reason for the rebuild.

I have the following errors when installing beta.14 in MacOS(12.6 M1)

MacBook Air (M1, 2020)

install$ (shx test -f ./script/build.js || run-s build.js) && cross-env npm_config_build_from_source=true node-gyp-build
│ dyld[72929]: missing symbol called
└─ Failed in 233ms
aminya commented 1 year ago

Maybe we should include the libsodium.dyld in the package too so you don't have to install it manually.

kavsingh commented 1 year ago

am seeing similar to https://github.com/zeromq/zeromq.js/issues/529#issuecomment-1328701248 when installing on an m1 MacBook pro 2020, macos 13.0.1

via yarn

❯ yarn                
yarn install v1.22.19
[1/5] 🔍  Validating package.json...
[2/5] 🔍  Resolving packages...
[3/5] 🚚  Fetching packages...
[4/5] 🔗  Linking dependencies...
[5/5] 🔨  Building fresh packages...
error /<path to project>/node_modules/zeromq: Command failed.
Exit code: 1
Command: (shx test -f ./script/build.js || run-s build.js) && cross-env npm_config_build_from_source=true node-gyp-build
Arguments: 
Directory: /<path to project>/node_modules/zeromq
Output:
dyld[44504]: missing symbol called
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

via npm

❯ rm -rf node_modules/ && npm i 
npm ERR! code 1
npm ERR! path /<path to project>/node_modules/zeromq
npm ERR! command failed
npm ERR! command sh -c (shx test -f ./script/build.js || run-s build.js) && cross-env npm_config_build_from_source=true node-gyp-build
npm ERR! dyld[44714]: missing symbol called

npm ERR! A complete log of this run can be found in:
npm ERR!     /<user dir>/.npm/_logs/2022-11-28T19_33_05_054Z-debug-0.log

libsodium is also installed on the machine via brew

❯ brew info libsodium   
==> libsodium: stable 1.0.18 (bottled), HEAD
NaCl networking and cryptography library
https://libsodium.org/
/opt/homebrew/Cellar/libsodium/1.0.18_1 (73 files, 778.0KB) *
  Poured from bottle on 2022-11-28 at 20:32:01
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/libsodium.rb
License: ISC
==> Options
--HEAD
        Install HEAD version
==> Analytics
install: 106,038 (30 days), 328,370 (90 days), 1,317,655 (365 days)
install-on-request: 1,394 (30 days), 4,407 (90 days), 21,084 (365 days)
build-error: 2 (30 days)

❯ node --version
v16.15.0

You will need the libsodium dynamic library in either case during runtime

To clarify, would this mean if deploying an app that depends on zeromq.js to end users, we need to ensure the libsodium dynamic library is present on the end user machine as well / package the dynamic lib in our application resources manually when building? if so

Maybe we should include the libsodium.dyld in the package too

would be great 🙏

aminya commented 1 year ago

It seems that these errors only happen on Arm macOS. Can someone confirm that by testing it on macOS x86?

To clarify, would this mean if deploying an app that depends on zeromq.js to end users, we need to ensure the libsodium dynamic library is present on the end user machine as well / package the dynamic lib in our application resources manually when building?

Yes, that's the case. Either zeromq.js or you should bundle the required dyld file. It would be easier if zeromq.js does this.

kavsingh commented 1 year ago

@aminya errors do not occur and installation is successful on x86 Intel MacBook pro 2020, macOS 13.0 👍 looks like failures on Arm M1 macs only note this is just installing and running via node, have not tried any electron bundling etc.

❯ yarn
yarn install v1.22.19
[1/5] 🔍  Validating package.json...
[2/5] 🔍  Resolving packages...
[3/5] 🚚  Fetching packages...
[4/5] 🔗  Linking dependencies...
[5/5] 🔨  Building fresh packages...
✨  Done in 14.95s.
❯ brew info libsodium
==> libsodium: stable 1.0.18 (bottled), HEAD
NaCl networking and cryptography library
https://libsodium.org/
/usr/local/Cellar/libsodium/1.0.18_1 (73 files, 1MB) *
  Poured from bottle on 2020-11-24 at 21:29:14
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/libsodium.rb
License: ISC
==> Options
--HEAD
        Install HEAD version
==> Analytics
install: 109,598 (30 days), 327,918 (90 days), 1,319,730 (365 days)
install-on-request: 1,467 (30 days), 4,409 (90 days), 21,065 (365 days)
build-error: 2 (30 days)
aminya commented 1 year ago

looks like failures on Arm M1 macs only

Ok, so cross-compiling for Arm M1 from x86 doesn't seem to work properly here. Contributions are welcome!

td-krzysiek commented 1 year ago

@aminya what contribution you have in mind? Can look into this if we have something well defined.

aminya commented 1 year ago

Since no CI service provides MacOS Arm machines, the only way to build that is by cross-compiling. Please clone the repo on a x86 Mac and run

ARCH=arm64 pnpm install
ARCH=arm64 pnpm run prebuild

This should cross-compile for Arm. See if the build gives any errors or warnings, and then try to test the generated binary on an Arm machine to see if it works.

td-krzysiek commented 1 year ago

Okay, I have access to mac x86 computers at work, will be able to try this tomorrow.

Bartel-C8 commented 1 year ago

Since no CI service provides MacOS Arm machines, the only way to build that is by cross-compiling. Please clone the repo on a x86 Mac and run

ARCH=arm64 pnpm install
ARCH=arm64 pnpm run prebuild

This should cross-compile for Arm. See if the build gives any errors or warnings, and then try to test the generated binary on an Arm machine to see if it works.

Just reporting for my case on my Macbook Pro (Intel)

Called: ARCH=arm64 pnpm install

Package libsodium was not found in the pkg-config search path.
Perhaps you should add the directory containing `libsodium.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libsodium' found
gyp: Call to 'pkg-config libsodium --libs' returned exit status 1 while in binding.gyp. while trying to load binding.gyp

libsodium is installed though via homebrew. After export PKG_CONFIG_PATH=/usr/local/Cellar/libsodium/1.0.18_1/lib/pkgconfig/ the install runs fine with following warning(!) (which I see on the github actions builds as well):

ld: warning: ignoring file /usr/local/Cellar/libsodium/1.0.18_1/lib/libsodium.dylib, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
ld: warning: ignoring file /Users/bartel/git/zeromq.js/build/libzmq/lib/libzmq.a, building for macOS-x86_64 but attempting to link with file built for macOS-arm64

So I think, in any case, this won't work on arm as libsodium and libzmq are x86_64 buids...

Same warning after running ARCH=arm64 pnpm run prebuild :

ld: warning: ignoring file /usr/local/Cellar/libsodium/1.0.18_1/lib/libsodium.dylib, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
Bartel-C8 commented 1 year ago

Update, via this (https://github.com/Homebrew/discussions/discussions/2843#discussioncomment-2026915) way, I could install the arm version of libsodium (I am on macOS Ventura)

brew fetch --force --bottle-tag=arm64_ventura libsodium
brew reinstall /Users/bartel/Library/Caches/Homebrew/downloads/3c17065fa853b7c22748466684ac78dbc5cb7c7419db975572feaa3875521288--libsodium--1.0.18_1.arm64_ventura.bottle.tar.gz

(reinstall because libsodium was already installed)

ARCH=arm64 pnpm install still gives the warnings:

ld: warning: dylib (/usr/local/Cellar/libsodium/1.0.18_1/lib/libsodium.dylib) was built for newer macOS version (13.0) than being linked (11.0)
ld: warning: ignoring file /usr/local/Cellar/libsodium/1.0.18_1/lib/libsodium.dylib, building for macOS-x86_64 but attempting to link with file built for macOS-arm64
ld: warning: ignoring file /Users/bartel/git/zeromq.js/build/libzmq/lib/libzmq.a, building for macOS-x86_64 but attempting to link with file built for macOS-arm64

But ARCH=arm64 pnpm run prebuild is successful:

  SOLINK_MODULE(target) Release/zeromq.node
ld: warning: dylib (/usr/local/Cellar/libsodium/1.0.18_1/lib/libsodium.dylib) was built for newer macOS version (13.0) than being linked (11.0)
rm 7722eaf02fcc073df28ffd1fa831e71544edfd42.intermediate
gyp info ok 

So seems in the install step the passing of ARCH is somewhere missing? I see this logging in the install case: (notice the arch=x64)

> zeromq@6.0.0-beta.14 install /Users/bartel/git/zeromq.js
> (shx test -f ./script/build.js || run-s build.js) && cross-env npm_config_build_from_source=true node-gyp-build

No native build was found for platform=darwin arch=x64 runtime=node abi=93 uv=1 libc=glibc node=16.3.0
    loaded from: /Users/bartel/git/zeromq.js

I don't have an ARM machine though to test the final result on 🙃

aminya commented 1 year ago

I have written a script that installs the Arm version of Brew on MacOS x86. Could you test to see if it works? It's a bit slow to make changes and wait for CI. https://github.com/zeromq/zeromq.js/pull/542/files

aminya commented 1 year ago

v6.0.0-beta.15 was released:

bfan1256 commented 1 year ago

I can confirm it is working with electron and next.js as well on arm :D.

Great work @aminya

Bartel-C8 commented 1 year ago

On rebuilding for Electron with an Intel Mac, I also need the (path to) libsodium, should me mention it somewhere in the documentation/README?

Package libsodium was not found in the pkg-config search path.
Perhaps you should add the directory containing `libsodium.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libsodium' found
gyp: Call to 'pkg-config libsodium --libs' returned exit status 1 while in binding.gyp. while trying to load binding.gyp
  ⨯ node-gyp failed to rebuild 'node_modules/zeromq'.
For more information, rerun with the DEBUG environment variable set to "electron-rebuild".

Error: `gyp` failed with exit code: 1

  failedTask=installAppDeps stackTrace=Error: node-gyp failed to rebuild 'node_modules/zeromq'.
For more information, rerun with the DEBUG environment variable set to "electron-rebuild".

Solution:

brew install libsodium

And

export PKG_CONFIG_PATH=/usr/local/var/homebrew/linked/libsodium/lib/pkgconfig/

Actually, it makes me wonder if I can change the compile-time checks into runtime checks, so no special build is needed for Electron... Would make things a lot easier!

Bartel-C8 commented 1 year ago

Actually, it makes me wonder if I can change the compile-time checks into runtime checks, so no special build is needed for Electron... Would make things a lot easier!

https://github.com/zeromq/zeromq.js/pull/546

DonJayamanne commented 1 year ago

Thanks, this now installs on a Mac M1, however when i test this when using in a product (Jupyter extension for VS Code used to communicate with with Python kernels over zmq) some things just don't work at all with this new build. I know thats completely useless inforomation as I'm not telling you want fails and where, but i haven't dug into this just yet. However i can confirm that the older version ^6.0.0-beta.6 works and the latest does not.

Will get you more information on what fails. Once again thanks for your effor.

Bartel-C8 commented 1 year ago

If @aminya could push a new release, it would be great if you could test that one @DonJayamanne .

The current latest beta release needs a manual rebuild for Electron(v21 and up) based applications, which VS Code is... So hopefully with my latest changes, everything runs fine again...

EDIT: It seems VSCode is using Electron v19, which is not affected... So might be another problem. Possibly the upstep of libzmq itself?

aminya commented 1 year ago

v6.0.0-beta.16 was released with fixes for Electron and the documentation.

DonJayamanne commented 1 year ago

Tried it, while this new version does not crash the runtime host as it used to in the past, it doesn't work. Once again, I haven't been able to pin point what fails and when, I will get this information some time tomorrow.

Bartel-C8 commented 1 year ago

export PKG_CONFIG_PATH=/usr/local/var/homebrew/linked/libsodium/lib/pkgconfig/

Actually this is a real pain, as exports are not being respected in the (sudo?) environment, in which my Gitlab CI runner is running...

Bartels-MacBook-Pro:zeromq.js bartel$ sudo pkg-config libsodium --libs
Package libsodium was not found in the pkg-config search path.
Perhaps you should add the directory containing `libsodium.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libsodium' found

Running without sudo works because of the PKG_CONFIG_PATH being set...

EDIT: Solved it now by export PKG_CONFIG_PATH=/usr/local/var/homebrew/linked/libsodium/lib/pkgconfig/ in my .gitlab-ci.yml file before starting the build.

aminya commented 1 year ago

Tried it, while this new version does not crash the runtime host as it used to in the past, it doesn't work. Once again, I haven't been able to pin point what fails and when, I will get this information some time tomorrow.

Please open a new issue with the reproduction and error logs. @DonJayamanne