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

[docs] Electron apps - undefined symbol __cxa_pure_virtual #394

Closed
mitchhentges opened this issue Feb 4, 2019 · 20 comments · Fixed by #435
Closed

[docs] Electron apps - undefined symbol __cxa_pure_virtual #394

mitchhentges opened this issue Feb 4, 2019 · 20 comments · Fixed by #435

Comments

@mitchhentges
Copy link

Hey, I'm learning how to set up neon here, and I'm running into an issue where, upon launching electron, I get the error: undefined symbol: __cxa_pure_virtual.

FWIW, I followed the documentation here.
I found #194, but I've interpreted it as the ticket for integrating with electron-rebuild, and that the electron-build-env process was already functional? 🤔 😄

To reproduce:

  1. git clone https://github.com/electron/electron-quick-start
  2. cd electron-quick-start
  3. npm i neon-hello
  4. npm i electron-build-env neon-cli --save-dev
  5. $(npm bin)/neon build neon-hello
  6. Edit main.js, adding require('neon-hello') to the top
  7. npm start
$ npm start                                         

> electron-quick-start@1.0.0 start /home/mitch/dev/electron-quick-start
> electron .

App threw an error during load
Error: /home/mitch/dev/electron-quick-start/node_modules/neon-hello/native/index.node: undefined symbol: __cxa_pure_virtual
    at process.module.(anonymous function) [as dlopen] (ELECTRON_ASAR.js:160:31)
    at Object.Module._extensions..node (internal/modules/cjs/loader.js:722:18)
    at Object.module.(anonymous function) [as .node] (ELECTRON_ASAR.js:160:31)
    at Module.load (internal/modules/cjs/loader.js:602:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:541:12)
    at Function.Module._load (internal/modules/cjs/loader.js:533:3)
    at Module.require (internal/modules/cjs/loader.js:640:17)
    at require (internal/modules/cjs/helpers.js:20:18)
    at Object.<anonymous> (/home/mitch/dev/electron-quick-start/node_modules/neon-hello/lib/index.js:1:168)
    at Object.<anonymous> (/home/mitch/dev/electron-quick-start/node_modules/neon-hello/lib/index.js:5:3)
A JavaScript error occurred in the main process
Uncaught Exception:
Error: /home/mitch/dev/electron-quick-start/node_modules/neon-hello/native/index.node: undefined symbol: __cxa_pure_virtual
    at process.module.(anonymous function) [as dlopen] (ELECTRON_ASAR.js:160:31)
    at Object.Module._extensions..node (internal/modules/cjs/loader.js:722:18)
    at Object.module.(anonymous function) [as .node] (ELECTRON_ASAR.js:160:31)
    at Module.load (internal/modules/cjs/loader.js:602:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:541:12)
    at Function.Module._load (internal/modules/cjs/loader.js:533:3)
    at Module.require (internal/modules/cjs/loader.js:640:17)
    at require (internal/modules/cjs/helpers.js:20:18)
    at Object.<anonymous> (/home/mitch/dev/electron-quick-start/node_modules/neon-hello/lib/index.js:1:168)
    at Object.<anonymous> (/home/mitch/dev/electron-quick-start/node_modules/neon-hello/lib/index.js:5:3)
@amilajack
Copy link
Member

Does the example work for you?

@mitchhentges
Copy link
Author

mitchhentges commented Feb 4, 2019

Hmm, I'm able to reproduce the problem in the example, too 🤔

2019-02-03-214548_511x81_scrot

node --version: v11.9.0
npm --version: 6.7.0

(holy that was a fast response! You're crazy 😄)

@Hammster
Copy link

Hammster commented Feb 7, 2019

@mitchhentges the versions for the current electron-quickstart should be the follwing, since you use node 11.9.0 could you try to use node 10.11.0 when building instead.

Electron 4.0.4
Node 10.11.0
Chromium 69.0.3497.106

@mitchhentges
Copy link
Author

mitchhentges commented Feb 11, 2019

Using nvm, I've installed node@10.11.0, but I'm still able to reproduce the issue.
I didn't need to install Chromium locally to run electron-quick-start.
I did a fresh clone of electron-quick-start - looks like they're still on electron@4.0.3

Electron 4.0.3
Node 10.11.0
Chromium N/A

Hmm 🤔

@Hammster
Copy link

@mitchhentges electron comes with a chromium to render the content, no worries. I don't have the time to test the issue currently (currently moving into a new flat) if i find some time at work i will try it though.

@theJian
Copy link
Contributor

theJian commented Mar 23, 2019

Related: neon-bindings/examples#30

@MeryllEssig
Copy link

If someone is interested, I solved the issue by doing what someone did in this post : https://users.rust-lang.org/t/neon-electron-undefined-symbol-cxa-pure-virtual/21223

#[no_mangle]
pub extern fn __cxa_pure_virtual() {
    loop{};
}

I added this piece of code in my native/src/lib.rs file, rebuilt the project, and it worked for me.

@amilajack
Copy link
Member

@theJian does neon-bindings/examples#30 resolve this issue?

@theJian
Copy link
Contributor

theJian commented Mar 31, 2019

@amilajack It doesn't.
I'm having this issue on Linux machine. The example runs well on mac os though.

@theJian
Copy link
Contributor

theJian commented Mar 31, 2019

@mitchhentges It looks like you are using Linux from your screenshot. Have you tested on other platforms?

@fominok
Copy link

fominok commented May 11, 2019

Any updates on this? Cannot run referenced example, but really interested in getting started with electron + neon

@fominok
Copy link

fominok commented May 11, 2019

Well I've tried solution with defining missing fn as suggested by @MeryllEssig but now it has undefined symbols like _ZN12v88Function3.. and so on

@stoically
Copy link
Contributor

@fominok Happened to me when I didn't build with electron-build-env - doing so resolves it for me (in combination with the workaround from @MeryllEssig).

@kjvalencik
Copy link
Member

Duplicate of #409

@kjvalencik kjvalencik marked this as a duplicate of #409 Aug 16, 2019
@kjvalencik kjvalencik reopened this Sep 8, 2019
@kjvalencik
Copy link
Member

Re-opening this issue. It is not a duplicate. It's caused by a missing .cpp(true) when building neon-runtime. It should be fixed in an upcoming PR to resolve several electron issues.

@fominok
Copy link

fominok commented Oct 30, 2019

@kjvalencik Hello, is this issue fixed? I've just downloaded examples and trying to start electron-app even with neon-cli dependency bumped to 0.3.3 and still receiving this error

@kjvalencik
Copy link
Member

Yes, it should be fixed. There is an electron test that can be used as an example. The rust neon crate needed to be bumped as well.

https://github.com/neon-bindings/neon/tree/master/test/electron

@fominok
Copy link

fominok commented Oct 31, 2019

@kjvalencik thank you for the fast reply
I've tried to build this example and have failed with 'lib/cli.js' not found error on npm i and different node versions error. I'm new to Node and build steps for this example would be very helpful for me
Had to replace node ../lib/cli.js to neon and everything goes fine, thanks!

@adityapk00
Copy link

adityapk00 commented Dec 30, 2019

Hello. I just tried this on Linux (Ubuntu 18.04), and this still fails with the same error.

I'm using the latest neon (0.3.3) and hello-neon v0.1.1

image

Edit:
Specifically, I'm trying to build this example: https://github.com/neon-bindings/examples/tree/master/electron-app

@kjvalencik
Copy link
Member

@adityapk00 That's likely an issue in the examples repo (for example, it's using an older cli version). Can you open an issue there? Thanks!

poljar added a commit to matrix-org/seshat that referenced this issue Jan 24, 2020
This was needed because of a upstream issue of neon. The issue has since
been fixed so no need for it anymore.

Upstream issue: neon-bindings/neon#394.
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

Successfully merging a pull request may close this issue.

9 participants