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

Loading i2c.node module crashes bun with undefined symbol: _ZNK2v85Value8ToStringENS_5LocalINS_7ContextEEE #14447

Closed
SchizoDuckie opened this issue Oct 9, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@SchizoDuckie
Copy link

SchizoDuckie commented Oct 9, 2024

What version of Bun is running?

1.1.30+7996d06b8

What platform is your computer?

Linux 6.6.31+rpt-rpi-v8 aarch64 unknown

What steps can reproduce the bug?

  • install bun@latest, node@22.9.0 and node-gyp v10.2.0 on a Raspi Zero W2 on Debian Bookworm
  • start a new project
  • bun install i2c
  • cd node_modules/i2c/node_modules
  • curl -L https://github.com/oc-soft/npm-nan/archive/refs/heads/main.zip -O && unzip main.zip
  • mv nan _nan && mv npm-nan-main nan && cd ..
  • node-gyp configure && node-gyp build
  • Now the i2c.node is built, prebuilt with the .node and .o for your debugging pleasure: i2c.zip
  • Execute the adafruit-pca9685 example code:
   I2C = require('i2c'),
   let meCrash = new I2C(0x40, { device:  '/dev/i2c-1' });
  • you may need to repeat this procedure for the sleep dependency if you want to repeat this process, but that module didnt crash for me (yet).

I confirmed by running it with node@22.9.0 that this is a bun bug. This same module is loaded by node properly, which also confirms that it's not a problem with the ifdefs in the compiled module
(The exception there is expected as my test rig currently has no i2c interface soldered to it)

Image

What is the expected behavior?

There is no symbol lookup error.

What do you see instead?

bun: symbol lookup error: /home/pi/stairleds/node/node_modules/i2c/build/Release/i2c.node: undefined symbol: _ZNK2v85Value8ToStringENS_5LocalINS_7ContextEEE

Additional information

I feel like living on the edge and am trying to use Bun to run on my new Raspi Zero W 2 that upgrades my Stairleds project, since I feel this is one of the most rabbit-holey things you can try for a javascript stack, interface with hardware.

The stairleds project interfaces with native I2C bindings (a node-gyp built .node module), which required some voodoo to get working (read: raw-dog somebody's yet-unmerged PR) , which in turn uses the node-sleep native bindings for usleep.

After confirming it works by recompiling the node-gyp modules using node@22.9.0 and said node-gyp nvm hack, bun crashes with an awesome exception that warrants a bug status

@SchizoDuckie SchizoDuckie added bug Something isn't working needs triage labels Oct 9, 2024
@nektro nektro added napi Compatibility with the native layer of Node.js needs investigate Needs to be investigated to find the root cause and removed needs triage labels Oct 9, 2024
@190n
Copy link
Contributor

190n commented Oct 10, 2024

Thanks for the report -- this is because i2c uses some V8 APIs that we don't support yet. You can track our progress in #4290, and I've added i2c to the list of packages affected.

@190n
Copy link
Contributor

190n commented Oct 10, 2024

Duplicate of #4290

@190n 190n marked this as a duplicate of #4290 Oct 10, 2024
@190n 190n closed this as not planned Won't fix, can't repro, duplicate, stale Oct 10, 2024
@190n 190n removed napi Compatibility with the native layer of Node.js needs investigate Needs to be investigated to find the root cause labels Oct 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants