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

node-datachannel Prebuilt Binaries Missing RTTI and Wrong Architecture #1

Open
akhileshthite opened this issue Feb 17, 2025 · 0 comments

Comments

@akhileshthite
Copy link

akhileshthite commented Feb 17, 2025

Image

We are using Electron with @libp2p/[email protected] which depends on [email protected]. We encountered two major issues:

  1. Linux:
    The native module fails with an undefined RTTI symbol error:
Error: /tmp/.org.chromium.Chromium.XXXX: undefined symbol: _ZTVN10__cxxabiv117__class_type_infoE

This appears to be due to the binary being built with RTTI disabled (likely via -fno-rtti).

  1. macOS (Intel):
    When running the app on an Intel Mac, we see:
mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64')

This indicates that the prebuilt binary is compiled for arm64 instead of x86_64.

Workaround

We were able to work around these issues locally by:

  • Patching node-datachannel:
    We modified the build configuration (in cmake/toolchain/ci.cmake) to ensure that the C++ compiler flags include -frtti (enabling RTTI).
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} $ENV{COMPILER_FLAGS} -frtti")

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} $ENV{COMPILER_FLAGS}")

  • Forcing a Rebuild from Source:
    We ran:
npm rebuild node-datachannel --build-from-source

This resulted in a freshly built node_datachannel.node with the correct RTTI support.

Why it's important?

We observed the same issues when testing with latest @ipshipyard/node-datachannel version ^0.26.4 and @libp2p/webrtc version ^5.1.0.

The current approach to work around these problems involves manually patching node-datachannel’s build configuration and explicitly rebuilding the module from source (e.g., using npm rebuild node-datachannel --build-from-source and setting npm_config_arch=x64 on Intel Macs). This process requires custom CI scripts and local workarounds, which is not ideal. Ideally, the prebuilt binaries should be compiled correctly for Electron:

RTTI Enabled: Ensuring that the module is built with RTTI support (i.e. without -fno-rtti).

PR:
p2plabsxyz/peersky-browser#18

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

No branches or pull requests

1 participant