Permalink
Browse files

now compiles and runs with node 0.8.8

  • Loading branch information...
1 parent 6ac9d51 commit c5cac4b01499e49e58a78595e6accba93a9df91e Romain Bossart committed Sep 3, 2012
Showing with 63 additions and 9 deletions.
  1. +1 −0 mnm.js
  2. +5 −7 src/connection.cpp
  3. +0 −2 src/oracle_bindings.cpp
  4. +57 −0 wscript
View
1 mnm.js
@@ -1,6 +1,7 @@
#!/usr/bin/env node
var path = require('path');
+var fs = require('fs');
var Builder = require('mnm');
var builder = new Builder();
View
@@ -5,6 +5,7 @@
#include "rollbackBaton.h"
#include "outParam.h"
#include <vector>
+#include <node_version.h>
Persistent<FunctionTemplate> Connection::constructorTemplate;
@@ -63,7 +64,6 @@ Handle<Value> Connection::Execute(const Arguments& args) {
uv_work_t* req = new uv_work_t();
req->data = baton;
uv_queue_work(uv_default_loop(), req, EIO_Execute, EIO_AfterExecute);
- uv_ref(uv_default_loop());
connection->Ref();
@@ -96,7 +96,6 @@ Handle<Value> Connection::Commit(const Arguments& args) {
uv_work_t* req = new uv_work_t();
req->data = baton;
uv_queue_work(uv_default_loop(), req, EIO_Commit, EIO_AfterCommit);
- uv_ref(uv_default_loop());
connection->Ref();
@@ -122,8 +121,7 @@ Handle<Value> Connection::Rollback(const Arguments& args) {
uv_work_t* req = new uv_work_t();
req->data = baton;
uv_queue_work(uv_default_loop(), req, EIO_Rollback, EIO_AfterRollback);
- uv_ref(uv_default_loop());
-
+
connection->Ref();
return Undefined();
@@ -262,7 +260,7 @@ void Connection::EIO_Commit(uv_work_t* req) {
void Connection::EIO_AfterCommit(uv_work_t* req) {
CommitBaton* baton = static_cast<CommitBaton*>(req->data);
- uv_unref(uv_default_loop());
+
baton->connection->Unref();
Handle<Value> argv[2];
@@ -280,7 +278,7 @@ void Connection::EIO_Rollback(uv_work_t* req) {
void Connection::EIO_AfterRollback(uv_work_t* req) {
RollbackBaton* baton = static_cast<RollbackBaton*>(req->data);
- uv_unref(uv_default_loop());
+
baton->connection->Unref();
Handle<Value> argv[2];
@@ -442,7 +440,7 @@ Local<Array> Connection::CreateV8ArrayFromRows(ExecuteBaton* baton) {
void Connection::EIO_AfterExecute(uv_work_t* req) {
ExecuteBaton* baton = static_cast<ExecuteBaton*>(req->data);
- uv_unref(uv_default_loop());
+
baton->connection->Unref();
try {
View
@@ -71,7 +71,6 @@ Handle<Value> OracleClient::Connect(const Arguments& args) {
uv_work_t* req = new uv_work_t();
req->data = baton;
uv_queue_work(uv_default_loop(), req, EIO_Connect, EIO_AfterConnect);
- uv_ref(uv_default_loop());
return Undefined();
}
@@ -93,7 +92,6 @@ void OracleClient::EIO_Connect(uv_work_t* req) {
void OracleClient::EIO_AfterConnect(uv_work_t* req) {
HandleScope scope;
connect_baton_t* baton = static_cast<connect_baton_t*>(req->data);
- uv_unref(uv_default_loop());
baton->client->Unref();
Handle<Value> argv[2];
View
57 wscript
@@ -0,0 +1,57 @@
+import Options, Utils
+from os import unlink, symlink, chdir, environ
+from os.path import exists
+
+srcdir = "."
+blddir = "build"
+VERSION = "0.2.3"
+
+def set_options(opt):
+ opt.tool_options("compiler_cxx")
+ opt.add_option('--debug', action='store_true', help='Run tests with nodeunit_g')
+ opt.add_option('--warn', action='store_true', help='Enable extra -W* compiler flags')
+
+def configure(conf):
+ conf.check_tool("compiler_cxx")
+ conf.check_tool("node_addon")
+
+ # Enables all the warnings that are easy to avoid
+ conf.env.append_unique('CXXFLAGS', ["-Wall"])
+ if Options.options.warn:
+ # Extra warnings
+ conf.env.append_unique('CXXFLAGS', ["-Wextra"])
+ # Extra warnings, gcc 4.4
+ conf.env.append_unique('CXXFLAGS', ["-Wconversion", "-Wshadow", "-Wsign-conversion", "-Wunreachable-code", "-Wredundant-decls", "-Wcast-qual"])
+
+ oci_include = environ.get("OCI_INCLUDE_DIR", "/usr/local/include/oracle/latest/client")
+ if oci_include:
+ conf.env.append_unique('CXXFLAGS', [ '-I' + oci_include ])
+
+ oci_lib = environ.get("OCI_LIB_DIR", "/usr/local/lib/oracle/latest/client/lib")
+ if oci_lib:
+ conf.env.append_unique('LINKFLAGS', [ '-L' + oci_lib ])
+
+ conf.env.append_unique('LINKFLAGS', ['-locci', '-lclntsh', '-lnnz10'])
+ conf.check(header_name="occi.h", errmsg="Missing include files for OCI", mandatory=True)
+ conf.check_cxx(lib="occi", errmsg="Missing libocci", mandatory=True)
+
+def build(bld):
+ obj = bld.new_task_gen("cxx", "shlib", "node_addon")
+ obj.target = "oracle_bindings"
+ obj.source = "src/connection.cpp src/executeBaton.cpp src/oracle_bindings.cpp src/outParam.cpp"
+ obj.includes = "src/"
+
+def test(tst):
+ test_binary = 'nodeunit'
+ if Options.options.debug:
+ test_binary = 'nodeunit_g'
+
+ Utils.exec_command(test_binary + ' tests.js')
+
+def lint(lnt):
+ # Bindings C++ source code
+ print("Run CPPLint:")
+ Utils.exec_command('cpplint --filter=-whitespace/line_length ./lib/node-db/*.h ./lib/node-db/*.cc ./src/*.h ./src/*.cc')
+ # Bindings javascript code, and tools
+ print("Run Nodelint for sources:")
+ Utils.exec_command('nodelint ./package.json ./db-drizzle.js')

3 comments on commit c5cac4b

Contributor

bosr commented on c5cac4b Sep 4, 2012

This wscript is actually not needed. I just added it for the pleasure of seeing node-waf configure && node-waf build print green lines in the terminal :). I forgot to mention it in the pull request.

cannot npm install oracle on centos 5.8

80 verbose linkBins oracle@0.1.3
81 verbose linkMans oracle@0.1.3
82 verbose rebuildBundles oracle@0.1.3
83 info install oracle@0.1.3
84 verbose unsafe-perm in lifecycle false
85 silly exec sh "-c" "node mnm.js build"
86 silly sh,-c,node mnm.js build,/home/liyusen/node/node_modules/oracle spawning
87 info oracle@0.1.3 Failed to exec install script
88 info /home/liyusen/node/node_modules/oracle unbuild
89 verbose from cache /home/liyusen/node/node_modules/oracle/package.json
90 info preuninstall oracle@0.1.3
91 info uninstall oracle@0.1.3
92 verbose true,/home/liyusen/node/node_modules,/home/liyusen/node/node_modules
unbuild oracle@0.1.3
93 info postuninstall oracle@0.1.3
94 error oracle@0.1.3 install: node mnm.js build
94 error sh "-c" "node mnm.js build" failed with 1
95 error Failed at the oracle@0.1.3 install script.
95 error This is most likely a problem with the oracle package,
95 error not with npm itself.
95 error Tell the author that this fails on your system:
95 error node mnm.js build
95 error You can get their info via:
95 error npm owner ls oracle
95 error There is likely additional logging output above.
96 error System Linux 2.6.18-308.13.1.el5
97 error command "/usr/local/bin/node" "/usr/local/bin/npm" "install" "oracle"
98 error cwd /home/liyusen/node
99 error node -v v0.8.8
100 error npm -v 1.1.59
101 error code ELIFECYCLE
102 verbose exit [ 1, true ]
[root@jw4 node]#

Contributor

bosr replied Sep 4, 2012

Could you please provide the npm-debug.log file?
Also, are you sure your env vars are correctly set? (sorry to ask, but we were many to get caught)
I had this compile and run on Debian this morning again. It can compile on OSX, but not run (the famous 64bits problem in Lion with Oracle)

Please sign in to comment.