mariano/node-db-oracle — Issue #24: Unable to load shared library after compile (Ubuntu and Mac OS X)
Author: drudge
Created: 2011-12-28 15:13:20+00:00
State: open

I have been trying to get this library working for a while now. I've attempted on Node 0.4.x as well as 0.6.x with no success. I can get the module built, however trying to use it yields an error message stating it can't load the shared library. Any assistance would be greatly appreciated.

My /opt/instantclient directory structure:

```
# ls -lah /opt/instantclient/
total 169M
drwxr-xr-x 3 drudge drudge 4.0K Dec 28 17:51 .
drwxr-xr-x 3 drudge drudge 4.0K Dec 28 17:33 ..
-rw-r--r-- 1 drudge drudge 437 Dec 28 17:33 BASIC_README
-rwxr-xr-x 1 drudge drudge 22K Dec 28 17:33 adrci
-rwxr-xr-x 1 drudge drudge 38K Dec 28 17:33 genezi
lrwxrwxrwx 1 drudge drudge 17 Dec 28 17:51 libclntsh.so -> libclntsh.so.11.1
-rwxr-xr-x 1 drudge drudge 42M Dec 28 17:33 libclntsh.so.11.1
-r-xr-xr-x 1 drudge drudge 6.8M Dec 28 17:33 libnnz11.so
lrwxrwxrwx 1 drudge drudge 15 Dec 28 17:46 libocci.so -> libocci.so.11.1
-rwxr-xr-x 1 drudge drudge 1.8M Dec 28 17:33 libocci.so.11.1
-rwxr-xr-x 1 drudge drudge 113M Dec 28 17:33 libociei.so
-r-xr-xr-x 1 drudge drudge 149K Dec 28 17:33 libocijdbc11.so
-r--r--r-- 1 drudge drudge 2.0M Dec 28 17:33 ojdbc5.jar
-r--r--r-- 1 drudge drudge 2.6M Dec 28 17:33 ojdbc6.jar
drwxrwxr-x 4 drudge drudge 4.0K Sep 19 03:12 sdk
-rwxr-xr-x 1 drudge drudge 157K Dec 28 17:33 uidrvci
-rw-r--r-- 1 drudge drudge 66K Dec 28 17:33 xstreams.jar
```

Installation via npm:

```
# export OCI_LIB_DIR=/opt/instantclient
# export OCI_INCLUDE_DIR=/opt/instantclient/sdk/include/
# npm install db-oracle
npm http GET https://registry.npmjs.org/db-oracle
npm http 304 https://registry.npmjs.org/db-oracle

> db-oracle@0.2.2 install /home/drudge/test/node_modules/db-oracle
> node-waf configure build

Checking for program g++ or c++ : /usr/bin/g++
Checking for program cpp : /usr/bin/cpp
Checking for program ar : /usr/bin/ar
Checking for program ranlib : /usr/bin/ranlib
Checking for g++ : ok
Checking for node path : not found
Checking for node prefix : ok /usr/local
Checking for header occi.h : yes
Checking for library occi : yes
'configure' finished successfully (0.492s)
Waf: Entering directory `/home/drudge/test/node_modules/db-oracle/build'
[ 1/12] cxx: lib/node-db/binding.cc -> build/Release/lib/node-db/binding_1.o
[ 2/12] cxx: lib/node-db/connection.cc -> build/Release/lib/node-db/connection_1.o
[ 3/12] cxx: lib/node-db/events.cc -> build/Release/lib/node-db/events_1.o
[ 4/12] cxx: lib/node-db/exception.cc -> build/Release/lib/node-db/exception_1.o
[ 5/12] cxx: lib/node-db/query.cc -> build/Release/lib/node-db/query_1.o
[ 6/12] cxx: lib/node-db/result.cc -> build/Release/lib/node-db/result_1.o
[ 7/12] cxx: src/connection.cc -> build/Release/src/connection_1.o
[ 8/12] cxx: src/oracle.cc -> build/Release/src/oracle_1.o
[ 9/12] cxx: src/query.cc -> build/Release/src/query_1.o
[10/12] cxx: src/result.cc -> build/Release/src/result_1.o
[11/12] cxx: src/oracle_bindings.cc -> build/Release/src/oracle_bindings_1.o
[12/12] cxx_link: build/Release/lib/node-db/binding_1.o build/Release/lib/node-db/connection_1.o build/Release/lib/node-db/events_1.o build/Release/lib/node-db/exception_1.o build/Release/lib/node-db/query_1.o build/Release/lib/node-db/result_1.o build/Release/src/connection_1.o build/Release/src/oracle_1.o build/Release/src/query_1.o build/Release/src/result_1.o build/Release/src/oracle_bindings_1.o -> build/Release/oracle_bindings.node
Waf: Leaving directory `/home/drudge/test/node_modules/db-oracle/build'
'build' finished successfully (4.173s)
```

My test code (test.js):

``` javascript
var oracle = require('db-oracle');
new oracle.Database({
hostname: 'localhost',
user: 'drudge',
password: 'password',
database: 'node'
}).connect(function(error) {
if (error) {
return console.log("CONNECTION ERROR: " + error);
}

this.query().select('*').from('users').execute(function(error, rows) {
if (error) {
return console.log('ERROR: ' + error);
}
console.log(rows.length + ' ROWS');
});
});
```

And the error:

```
# node test.js

node.js:201
throw e; // process.nextTick error, or 'error' event on first tick
^
Error: Unable to load shared library /home/drudge/test/node_modules/db-oracle/build/Release/oracle_bindings.node
at Object..node (module.js:463:11)
at Module.load (module.js:351:31)
at Function._load (module.js:310:12)
at Module.require (module.js:357:17)
at require (module.js:368:17)
at Object. (/home/drudge/test/node_modules/db-oracle/db-oracle.js:18:15)
at Module._compile (module.js:432:26)
at Object..js (module.js:450:10)
at Module.load (module.js:351:31)
at Function._load (module.js:310:12)
```

Versions:

* Ubuntu: 10.04 LTS (32-bit)
* Node: 0.6.6
* NPM: 1.1.0-beta-4
* Oracle Instant Client & SDK: 11.2.0.3.0