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

Build error with electron on windows environment #862

Closed
lealhugui opened this issue Feb 26, 2018 · 27 comments
Closed

Build error with electron on windows environment #862

lealhugui opened this issue Feb 26, 2018 · 27 comments

Comments

@lealhugui
Copy link

I'm trying to build a electron bundled app that uses oracledb connections.
No problem with the instalation or the use on "pure node" mode. But when I try to rebuild the dependency tree with electron-rebuild (mainly because I use other libs that need node-ffi) I get a build error on oracledb headers.

  1. What is your Node.js version?
    Run at: Mon Feb 26 2018 17:31:45 GMT-0300
    Node.js version: v8.9.3 (win32 x64)
    Node-oracledb version: 2.1.2
    Oracle Client library version: 12.2.0.1.0

  2. What is your node-oracledb version?
    2.1.1

  3. What is your Oracle client (e.g. Instant Client) version? Is it 64-bit or 32-bit? How was it installed? Where is it installed?
    InstantClient 12.2, 64Bit on windows, installed from zip on C:\instantclient_12_2_64.

  4. What is your Oracle Database version?
    Not relevant for this issue.

  5. What is your OS and version?
    Windows 10

  6. What is your compiler version? For example, with GCC, run gcc --version
    MSBuild 14.0

  7. What Oracle environment variables did you set? How exactly did you set them?
    Only isntant client on path: C:\instantclient_12_2_64.

  8. What is the PATH environment variable (on Windows) or LD_LIBRARY_PATH (on Linux) set to? On macOS, what is in ~/lib?
    C:\instantclient_12_2_64.

  9. What error(s) you are seeing?
    On gist: Oracledb error on electron-rebuild

@cjbj
Copy link
Member

cjbj commented Feb 27, 2018

Is the right version of NAN installed?

Stepping back a bit, are you able to use the pre-built binaries?

@lealhugui
Copy link
Author

lealhugui commented Feb 27, 2018

@cjbj

Is the right version of NAN installed?

NAN is a dep of oracledb? Should I install it through NPM?

Stepping back a bit, are you able to use the pre-built binaries?

If I run the app without electron environment, the binaries work just fine (was able to connect and query on different databases)

@cjbj
Copy link
Member

cjbj commented Feb 28, 2018

@lealhugui what's the version of NAN that is being used? Can you work out why there is even a build being kicked off - the normal 'npm install oracledb' can't fallback to building. Have you updated electron?

@lealhugui
Copy link
Author

@cjbj
NAN version is 2.8.0 (already tested on 2.7 and 2.9 too)
The trigger for the build is a manual call for "electron-rebuild", wich is needed (almost) each time a new dep is added.

@cjbj
Copy link
Member

cjbj commented Mar 2, 2018

How have you set the dependency for oracledb? Why isn't the package.json 'install' script target being executed (to download a pre-built binary)?

@lealhugui
Copy link
Author

The dependency was a added through a npm install, and that went just fine.

@cjbj
Copy link
Member

cjbj commented Mar 2, 2018

Can you explain more so I can try to help? What install options?

@lealhugui
Copy link
Author

The error doesn't occurr during the instalation of the module.

The module is installed correctly, and works fine while the app is executed outside electron environment.
The problem occurs if I try to rebuild the app to bundle with electron; for that, I use electron-rebuild (because the app have some native modules), and is during the execution of electron-rebuild, that the build of node-oracledb fails, throwing the above mentioned error stack.

@cjbj
Copy link
Member

cjbj commented Mar 2, 2018

That's too generic; I can't offer any new guesses. Can you share exact details about what you are entering where, and the commands you are running?

Other people seem to be use Electron without an issue.

@lealhugui
Copy link
Author

Yes I Can.
Just created a clean repo that reproduce the error.
Clone, npm install, and run the electron-rebuild rebuild command, and you should see the error (the full step-by-step is in the repo readme).

@cjbj
Copy link
Member

cjbj commented Mar 6, 2018

Maybe electron or something is ignoring the install script in package.json. Try creating your own oracledb bundle without the binding.gyp file and using that as a target in your package.json.

@lealhugui
Copy link
Author

Can you tell me how to do that?

@cjbj
Copy link
Member

cjbj commented Mar 7, 2018

  1. To create your own npm packages you can do:

    • download a ZIP or clone the source code of node-oracledb

    • remove binding.gyp

    • run 'npm pack'

    • use something similar to this in your config file:

    "dependencies": {
    "oracledb" : "file:/Users/cjones/oracledb-2.1.2-dev.tgz"
    },

  2. Regarding your testcase, I ran this on macOS:
    ./node_modules/.bin/electron-rebuild rebuild --target=1.8.2 --runtime=electron
    and it finished with:
    ✔ Rebuild Complete

@lealhugui
Copy link
Author

My environment is windows, so that must be the real differnce.
Will try the custom package aproach, and as soon as I get some conclusion, I report back.

@lealhugui
Copy link
Author

lealhugui commented Mar 8, 2018

@cjbj
2 situations:

  1. Downloaded the ZIP of the source, removed binding.gyp, and installed. That way I was able to correctly run electron-rebuild, but when I try to require the oracle module/open connection, I get Error: NJS-045: cannot load the oracledb add-on binary for Node.js 7.9.0 (win32, x64). I noticed that because I dont have binding.gyp BEFORE the npm install, it doesn't execute the build step on the install and dont create the ./node_modules/oracledb/build/* subfolders;

  2. Installed from npm default repository (npm install oracledb --save) , and after the install, removed binding.gyp. It makes the electron-rebuild pass, but when I try to require the oracledb module/open connection, I get:
    Cannot load C:\myproj\node_modules\oracledb\build\Release\oracledb.node A dynamic link library (DLL) initialization routine failed. \\?\C:\myproj\node_modules\oracledb\build\Release\oracledb.node

@cjbj
Copy link
Member

cjbj commented Mar 8, 2018

It seems in your case the package.json install script target isn't being invoked. I don't have more guesses on why. I assume the target was invoked for me when I tried your testcase, since your testcase didn't fail for me.

Got another platform you can test on? A different environment e.g. with or without globally installed modules?

@lealhugui
Copy link
Author

lealhugui commented Mar 8, 2018 via email

@cjbj
Copy link
Member

cjbj commented Mar 8, 2018

@kwent did you face something similar with electron on Windows?

@kwent
Copy link

kwent commented Mar 8, 2018

@lealhugui Could you try using that PR ? #851

@lealhugui
Copy link
Author

lealhugui commented Mar 8, 2018 via email

@lealhugui
Copy link
Author

Got an error during npm install. Pasted on this gist

@kwent
Copy link

kwent commented Mar 9, 2018

@lealhugui you need to clone using --recursive to include submodules.

git clone --recursive git://github.com/username/repository.git

@anthony-tuininga
Copy link
Member

The other option (if you've already cloned) is to run these commands in the directory you cloned:

git submodule init
git submodule update

@lealhugui
Copy link
Author

@lealhugui
Copy link
Author

@cjbj @kwent
Any new ideas?

@cjbj
Copy link
Member

cjbj commented Mar 21, 2018

@lealhugui not from me, sorry.

@cjbj
Copy link
Member

cjbj commented May 16, 2018

Closing - no activity.

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

No branches or pull requests

4 participants