oven-sh / bun

Incredibly fast JavaScript runtime, bundler, test runner, and package manager – all in one
https://bun.sh
Other
71.81k stars 2.56k forks source link

zeromq module not working #8498

Open scottstanfield opened 5 months ago

scottstanfield commented 5 months ago

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 commented 5 months ago

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

nk1tz commented 5 months ago

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.

grrowl commented 5 months ago

~seems to work after bun upgrade --canary~

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

nk1tz commented 4 months ago

~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 zeromq@6.0.0-beta.19 --verbose shows a successful run of zeromq's post-install script.

nk1tz commented 3 months ago

Just tested on bun 1.0.30 Confirmed still a bug.

alexgraul commented 3 weeks ago

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
Jarred-Sumner commented 3 weeks ago

@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

alexgraul commented 3 weeks ago

Understood, thankyou for the tracking issue link!

vitch commented 3 weeks ago

I notice that zeromq has an implementation in zig.

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

grrowl commented 2 weeks ago

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";