igorklopov / enclose

Compile your Node.js project into an executable
http://enclosejs.com
Other
936 stars 43 forks source link

Packaging with bindings #10

Closed oebspm closed 9 years ago

oebspm commented 9 years ago

Does enclose support packaging node modules with C bindings?

As an example, I'm using https://github.com/joeferner/node-oracle, and when I'm trying to package app, I get the following error: error Cannot find module '../build/Release/oracle_bindings' from '/node_modules/oracle/lib'

There is a file in the dirrectory: /node_modules/oracle/build/Release/oracle_bindings.node

And it's linked via the followind: var bindings = require("../build/Release/oracle_bindings");

It looks like enclose looks for something like oracle_bindings.js instead of oracle_bindings.node.

igorklopov commented 9 years ago

It took time to solve your issue. Particulary to let enclosed apps require native addons. Now please update to enclose@0.2.5 and try oracle example: https://github.com/igorklopov/enclose/tree/master/examples/45-oracle

oebspm commented 9 years ago

Thanks! I believe you have already tried this example and it's fine. So I tried to compile my project and issue with node-oracle doesn't appear anymore,

However I get some other issues with socket io:

/.../node_modules/socket.io/node_modules/engine.io/node_modules/ws/lib/Validation.js error Cannot find module '../build/default/validation' from '.../node_modules/socket.io/node_modules/engine.io/node_modules/ws/lib'

.../node_modules/socket.io/node_modules/engine.io/node_modules/ws/lib/BufferUtil.js error Cannot find module '../build/default/bufferutil' from '.../node_modules/socket.io/node_modules/engine.io/node_modules/ws/lib'

I'm currently investigating this issue as these files are really not existing in the mentioned folder even after reinstalling socket.io. And that's a bit strange, as socket.io is a very popular node module. And socket.io works fine for me when I just run it under node.

I'll let you know the results of the investigation.

igorklopov commented 9 years ago

I have fixed issue with ws package. Please update to enclose@0.2.7 and retry

oebspm commented 9 years ago

My project compiled without any errors, but with warnings. But when I try to run the application, I get the following error:

body-parser deprecated undefined extended: provide extended option _third_party_main.js:1:76 module.js:355 Module._extensions[extension](this, filename); ^ Error: dlopen(./node_modules/oracle/build/Release/oracle_bindings.node, 1): no suitable image found. Did find: ./node_modules/oracle/build/Release/oracle_bindings.node: mach-o, but wrong architecture at Error (native) at Module.load (module.js:355:32) at Function.Module._load (module.js:310:12) at Module.require (module.js:365:17) at G () at N () at c () at Object. (./node_modules/oracle/lib/oracle.js:2:16) at u () at N () logout

P.S. I'm on MacOS.

igorklopov commented 9 years ago

I see "mach-o, but wrong architecture" message. Run file ./yourapp and file ./oracle_bindings.node to ensure they are both x86 or both x86_64. Consider using -x enclose command line switch to make x64 executable.

oebspm commented 9 years ago

This is solved! Thanks!

There is still an issue, as it doesn't load Oracle client library. This library is in $ORACLE_HOME directory, but I think I know how to solve it. I'll try and will let you know as soon as I have results.

Error: dlopen(./node_modules/oracle/build/Release/oracle_bindings.node, 1): Library not loaded: /ade/b/2649109290/oracle/rdbms/lib/libocci.dylib.11.1 Referenced from: ./node_modules/oracle/build/Release/oracle_bindings.node Reason: image not found at Error (native) at Module.load (module.js:355:32) at Function.Module._load (module.js:310:12) at Module.require (module.js:365:17) at G () at N () at c () at Object. (./node_modules/oracle/lib/oracle.js:2:16) at u () at N () logout