Node-oracledb: Installing node-oracledb 1.6 on Mojave

Created on 9 Dec 2018  路  3Comments  路  Source: oracle/node-oracledb

For quite some time I've been using a version of this script to install node-oracledb 1.6 on my Mac. Now with Mojave, this script is no longer working.

https://blogs.oracle.com/opal/installing-node-oracledb-on-os-x-with-oracle-instant-client-11204
https://gist.github.com/brandonaaskov/978bfd5711a64df22be6

The script succeeds until the npm install oracledb line.

Answers to questions:

  1. What is your Node.js version: use console.log(process.version)? Is it 64-bit or 32-bit: use console.log(process.arch)?
  node -v: v4.8.7 (x64)
  npm -v 2.15.11
  1. What is your node-oracledb version: use console.log(oracledb.versionString)?
1.6
  1. What exact command caused the problem (e.g. what command did you try to install with)? Who were you logged in as?
npm install oracledb within shell script linked above.

logged in as administrator.
  1. What error(s) you are seeing?
warning: include path for stdlibc++ headers not found; pass '-std=libc++' on the command line to use the
      libc++ standard library instead [-Wstdlibcxx-not-found]
In file included from ../src/njs/src/njsOracle.cpp:53:
In file included from ../src/njs/src/njsOracle.h:56:
../node_modules/nan/nan.h:50:10: fatal error: 'algorithm' file not found
#include <algorithm>
  1. What OS (and version) is Node.js executing on: use console.log(process.platform)?
darwin, mac OS 10.14.2
  1. What is your Oracle client (e.g. Instant Client) version: use console.log(oracledb.oracleClientVersionString)? Is it 64-bit or 32-bit? How was it installed? Where is it installed?
x64.  
instantclient-sdk-macos.x64-11.2.0.4.0.zip
instantclient-basic-macos.x64-11.2.0.4.0.zip

from here:

https://www.oracle.com/technetwork/topics/intel-macsoft-096467.html
  1. What is your Oracle Database version: use console.log(connection.oracleServerVersionString)?
11.2 (I believe).
  1. What is the PATH environment variable (on Windows) or LD_LIBRARY_PATH (on Linux) set to? On macOS, what is in ~/lib?
No such file or directory on macOS.
  1. What Oracle environment variables did you set? How exactly did you set them?
Per the script above, only.
  1. Do you have a small, single Node.js script that immediately runs to show us the problem?
The shell script above.

Is there a way to pass '-std=libc++' to npm within that shell script? Nothing I've tried is working.

Thank you!

install & configuration

Most helpful comment

Try setting these before installing:

export CXXFLAGS="-mmacosx-version-min=10.9"
export LDFLAGS="-mmacosx-version-min=10.9"

For me on High Sierra: with these set:

$ otool -L node_modules/oracledb/build/Release/oracledb.node 
node_modules/oracledb/build/Release/oracledb.node:
    @rpath/libclntsh.dylib.12.1 (compatibility version 0.0.0, current version 0.0.0)
    /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 400.9.0)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.50.4)

The default without them set:

$ otool -L node_modules/oracledb/build/Release/oracledb.node 
node_modules/oracledb/build/Release/oracledb.node:
    @rpath/libclntsh.dylib.12.1 (compatibility version 0.0.0, current version 0.0.0)
    /usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 104.1.0)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.50.4)
    /usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 795.0.0)

With later versions of node (or node-gyp), libc++ seems to have become used by default.

All 3 comments

Try setting these before installing:

export CXXFLAGS="-mmacosx-version-min=10.9"
export LDFLAGS="-mmacosx-version-min=10.9"

For me on High Sierra: with these set:

$ otool -L node_modules/oracledb/build/Release/oracledb.node 
node_modules/oracledb/build/Release/oracledb.node:
    @rpath/libclntsh.dylib.12.1 (compatibility version 0.0.0, current version 0.0.0)
    /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 400.9.0)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.50.4)

The default without them set:

$ otool -L node_modules/oracledb/build/Release/oracledb.node 
node_modules/oracledb/build/Release/oracledb.node:
    @rpath/libclntsh.dylib.12.1 (compatibility version 0.0.0, current version 0.0.0)
    /usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 104.1.0)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.50.4)
    /usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 795.0.0)

With later versions of node (or node-gyp), libc++ seems to have become used by default.

Wow, today I learned that those flags start with "mmac...", not "mac...".

I inserted those before the npm install oracledb line, and it's building now! Thank you!

Great! I'll close this.

Was this page helpful?
0 / 5 - 0 ratings