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

symbol lookup error: BN_new on electron project #117

Open
pc-magas opened this issue Jan 21, 2019 · 0 comments
Open

symbol lookup error: BN_new on electron project #117

pc-magas opened this issue Jan 21, 2019 · 0 comments

Comments

@pc-magas
Copy link

pc-magas commented Jan 21, 2019

I managed to install the library to my project like that:

npm install bignum
./node_modules/.bin/electron-rebuild

But when I try to launch my electron application to a Ubuntu 16.04Lts machine even though I managed to make run without issues during the execution I get the following error:

symbol lookup error: /home/pcmagas/Kwdikas/master_thesis/custom_xmpp/node_modules/bignum/build/Release/bignum.node: undefined symbol: BN_new

I also tried to reinstall all the libraries as well via the following command set:

rm -rf ./node-modules
npm install
./node_modules/.bin/electron-rebuild

But I still get the error do you know why?

The error can be reproduced into he following code:

const { app, BrowserWindow, ipcMain } = require('electron');
const bignum = require('bignum');

// Keep a global reference of the window object, if you don't, the window will
// be closed automatically when the JavaScript object is garbage collected.
let mainWindow;

const bignumValue = bignum("FFA122310DC", 16);


const createWindow = () => {
  // Create the browser window.
  mainWindow = new BrowserWindow({
      globals:{
          num: bignumValue.toString()
      }
  });
  mainWindow.setMenu(null);
  mainWindow.maximize();


  // and load the index.html of the app.
  mainWindow.loadURL(`file:https://${__dirname}/index.html`);

  mainWindow.on('closed', () => {
    mainWindow = null;
  });
};

// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
// Some APIs can only be used after this event occurs.
app.on('ready', createWindow);

app.on('before-quit', () => {
  if (xmpp) {
    xmpp.disconnect();
  }
});

// Quit when all windows are closed.
app.on('window-all-closed', () => {
  // On OS X it is common for applications and their menu bar
  // to stay active until the user quits explicitly with Cmd + Q
  if (process.platform !== 'darwin') {
    app.quit();
  }
});

app.on('activate', () => {
  // On OS X it's common to re-create a window in the app when the
  // dock icon is clicked and there are no other windows open.
  if (mainWindow === null) {
    createWindow();
  }
});

process.on('unhandledRejection', (reason, p) => {
  console.error('Possibly Unhandled Rejection at: Promise ', p, ' reason: ', reason);
});

process.on('SIGINT', () => {
  if (xmpp) {
    xmpp.disconnect();
  }
  process.exit(0);
});

But a native nodejs code runs without errors for example this piece of code:

const bignum = require('bignum');
const big = bignum('AAFCD11234334BBAAFD',16);
console.log(big.toString());

Outputs the following sucessfully:

50466621672219557473021

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