Search code examples
node.jsdockeroracle11gglibcnode-oracledb

symbol not found errors with glibc


Recently, I started working with Docker to run my Node project and wanted to add the Oracle instant client driver. As far as I know Oracle instant client driver is compiled against glibc library while my Docker images which is Alpine based includes musl library.

So I needed a way to include the glibc libraries and I stumbled upon docker-glibc-builder which packages the glibc libraries as a compressed package.

After including the glibc library into the container I started noticing the following errors when ever my Node project would call the Oracle the instant driver.

Error: Error relocating /opt/oracle/drivers/instantclient/libclntsh.so.11.1: getcontext: symbol not found
    at Error (native)
    at Object.Module._extensions..node (module.js:568:18)
    at Module.load (module.js:458:32)
    at tryModuleLoad (module.js:417:12)
    at Function.Module._load (module.js:409:3)
    at Module.require (module.js:468:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (node_modules/oracledb/lib/oracledb.js:32:19)
    at Module._compile (module.js:541:32)
    at Object.Module._extensions..js (module.js:550:10)
    at Module.load (module.js:458:32)
    at tryModuleLoad (module.js:417:12)
    at Function.Module._load (module.js:409:3)
    at Module.require (module.js:468:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (node_modules/oracledb/index.js:1:80)

Anyone run into such an error ?


Solution

  • So I needed a way to include the glibc libraries

    Note that you can not mix and match two separate libc libraries in a single process. You must choose one or the other. Further, you must build against the same library you are going to use at runtime (merely including runtime packages in your Docker image is not sufficient).

    According to musl wiki, musl does not provide getcontext. The error you get is consistent with you continuing to use musl, and not glibc.