murat-dogan / node-datachannel

WebRTC For Node.js and Electron. libdatachannel node bindings.
Mozilla Public License 2.0
308 stars 60 forks source link

Broken on electron 28.3.2 #279

Closed mikey0000 closed 1 month ago

mikey0000 commented 3 months ago

Error: /home/michael/git/gameglass/GameGlass/hub/node_modules/node-datachannel/build/Release/node_datachannel.node: undefined symbol: _ZTVN10cxxabiv117class_type_infoE

G-Ray commented 3 months ago

Same issue with electron@31

mikey0000 commented 3 months ago

Interestingly if I rebuild it locally it works fine, it also doesn't link to as much (checked using ldd)

murat-dogan commented 3 months ago

Thanks for reporting.

I can reproduce it. But in my case it is not even packaging the .node or node-datachannel module. Am I missing something? Or Could you create a repo for testing with basics? examples/electron-demo as a template we say.

mikey0000 commented 3 months ago

Yeah I'll try get something up over the next day or so. Have to use something like weppack and node loader

murat-dogan commented 2 months ago

Thank you for the commit @leblowl

A new binary is created here. https://github.com/murat-dogan/node-datachannel/releases/tag/v0.12.0-dev

Could you please try and confirm that the problem has been solved?

For packing the electron-app with the native module, I have used webpack externals + copy plugin. Like;

    plugins: [
        new CopyPlugin({
            patterns: [{ from: 'node_modules/node-datachannel', to: 'node_modules/node-datachannel' }],
        }),
    ],

Any better ideas?

mikey0000 commented 2 months ago

I can confirm the v0.12.0-dev is working on electron, linux and mac

mikey0000 commented 2 months ago

Thank you for the commit @leblowl

A new binary is created here. https://github.com/murat-dogan/node-datachannel/releases/tag/v0.12.0-dev

Could you please try and confirm that the problem has been solved?

For packing the electron-app with the native module, I have used webpack externals + copy plugin. Like;

    plugins: [
        new CopyPlugin({
            patterns: [{ from: 'node_modules/node-datachannel', to: 'node_modules/node-datachannel' }],
        }),
    ],

Any better ideas?

This works well and works well with ASAR

{
    test: /\.node$/,
    loader: 'node-loader'
}
mikey0000 commented 2 months ago

The only other brute force thing I'm having to do for electron due to webpack being dumb is

          sed -i "s|const nodeDataChannel = require('../build/Release/node_datachannel.node');|import nodeDataChannel from '../build/Release/node_datachannel.node';|g" node_modules/node-datachannel/lib/node-datachannel.js

Then it bundles it all correctly

murat-dogan commented 2 months ago

Please check this commit for my config.

https://github.com/murat-dogan/node-datachannel/commit/c1916006da429fe5950db478ac14b06783397b79

mikey0000 commented 2 months ago

Please check this commit for my config.

c191600

I don't think that would work for my setup due to asar and just in general the way you're supposed to bundle into electron, anyway, when could I expect to see an official release with prebuilts? Sorry don't mean to sound demanding or impatient just want to set some expectations, so I know when to come check again and so on.

Thanks again for this fix and your time!

murat-dogan commented 2 months ago

I have just released v0.12.0!