bun icon indicating copy to clipboard operation
bun copied to clipboard

zeromq module not working

Open scottstanfield opened this issue 1 year ago • 4 comments

What version of Bun is running?

1.0.26

What platform is your computer?

Darwin 22.6.0 arm64 arm

What steps can reproduce the bug?

bun init
bun add zeromq
echo "require('zeromq')" > index.ts
bun index.ts

What is the expected behavior?

Expecting zeromq module to load (and no output).

What do you see instead?

dyld[19197]: missing symbol called
zsh: killed     bun index.ts

Additional information

Works in node (v21). This appears to be a regression as the same issue was marked closed in #6313

~/code/rs/rtfd/bunbug ❯ node
Welcome to Node.js v21.6.1.
Type ".help" for more information.
> require("zeromq");
{
  capability: [Getter],
  context: [Getter],
  curveKeyPair: [Getter],
  version: [Getter],
  Context: [Getter],
  Socket: [Getter],
  Observer: [Getter],
  Proxy: [Getter],
  Pair: [class Pair extends Socket],
  Publisher: [class Publisher extends Socket],
  Subscriber: [class Subscriber extends Socket],
  Request: [class Request extends Socket],
  Reply: [class Reply extends Socket],
  Dealer: [class Dealer extends Socket],
  Router: [class Router extends Socket],
  Pull: [class Pull extends Socket],
  Push: [class Push extends Socket],
  XPublisher: [class XPublisher extends Socket],
  XSubscriber: [class XSubscriber extends Socket],
  Stream: [class Stream extends Socket]
}
>

scottstanfield avatar Jan 26 '24 05:01 scottstanfield

Also tested with bun v1.0.17 (went back to binary chop to a version that works, but no luck yet).

scottstanfield avatar Jan 27 '24 20:01 scottstanfield

Can confirm this is still an issue.

bun -v 1.0.25 "zeromq": "6.0.0-beta.19"

dyld[28564]: missing symbol called
[1]    28564 killed     bun run index.ts

I have a minimal bug reproduction repo here: https://github.com/nk1tz/bun-zeromq-bug-repro which also includes a macOS crash report.

I also included a docker-compose way of running which has a different failure mode (I don't know if related) in case that's helpful.

The zeromq install script appears to run successfully during bun i --verbose, I don't see any obvious errors there.

nk1tz avatar Jan 31 '24 13:01 nk1tz

~seems to work after bun upgrade --canary~

my bad, can install on canary but it doesn't work at runtime

grrowl avatar Feb 05 '24 06:02 grrowl

~seems to work after bun upgrade --canary~

my bad, can install on canary but it doesn't work at runtime

Correct, this is a runtime error. bun i [email protected] --verbose shows a successful run of zeromq's post-install script.

nk1tz avatar Feb 09 '24 23:02 nk1tz

Just tested on bun 1.0.30 Confirmed still a bug.

nk1tz avatar Mar 09 '24 18:03 nk1tz

Definitely still broken as of 1.1.12 albeit with a very slightly different error, is this likely to get resolved any time soon or should we be looking for another way forward?

dyld[66065]: missing symbol called
[1]    66065 abort      bun run test.ts

alexgraul avatar Jun 10 '24 12:06 alexgraul

@alexgraul its the same error

The issue is that zeromq uses V8 or libuv symbols which we haven't implemented yet. The tracking issue for this is #4290

Jarred-Sumner avatar Jun 10 '24 12:06 Jarred-Sumner

Understood, thankyou for the tracking issue link!

alexgraul avatar Jun 10 '24 12:06 alexgraul

I notice that zeromq has an implementation in zig.

Would this be at all useful as a way to support zeromq in bun?

vitch avatar Jun 11 '24 12:06 vitch

Would this be at all useful as a way to support zeromq in bun?

You may be interested in tr1ckydev/hyperimport: ⚡ Import c, rust, zig etc. files in your TypeScript code and more. which allows you to import { add } from "./add.zig";

grrowl avatar Jun 20 '24 03:06 grrowl

We are tracking this in #4290

Please follow along there

Jarred-Sumner avatar Aug 08 '24 20:08 Jarred-Sumner