Skip to content

Node 13 on MacOS cannot dyld to /usr/local/lib #32740

Open
@josephg

Description

@josephg
  • Version: v13.12.0
  • Platform: MacOS
  • Subsystem: Native modules

I'm running into an issue where node 13 cannot dyld to a binary in /usr/local/lib.

Context: I'm maintaining the nodejs foundationdb bindings. The way the native module works is nodejs loads a local napi module, which in turn looks for a dynamic library (libfdb_c.dylib on macos). This is normally added by the fdb installer into /usr/local/lib.

This works fine under node 8 through to node 12, but under node 13 dyld can't find the dynamic library when it loads the native module.

Weirdly it works in my CI environment in travisci, which confuses me greatly.

I can't find the code in nodejs which manages DYLD search paths (or where / how that might have changed in node 13). I can probably manually bisect node 13 versions using nvm if need be, but I'm hoping some other people have some ideas of things to try.

And it starts working again if I manually add DYLD_LIBRARY_PATH=/usr/local/lib to my environment. But I'd really rather avoid requiring that my users do that too.

$ node
Welcome to Node.js v13.12.0.
Type ".help" for more information.
> require('foundationdb')
Could not load native module. Make sure the foundationdb client is installed and
(on windows) in your PATH. https://www.foundationdb.org/download/
Uncaught:
Error: dlopen(/Users/josephg/temp/node_modules/foundationdb/prebuilds/darwin-x64/node.napi.node, 1): Library not loaded: libfdb_c.dylib
  Referenced from: /Users/josephg/temp/node_modules/foundationdb/prebuilds/darwin-x64/node.napi.node
  Reason: image not found
    at Object.Module._extensions..node (internal/modules/cjs/loader.js:1197:18)
    at Module.load (internal/modules/cjs/loader.js:996:32)
    at Function.Module._load (internal/modules/cjs/loader.js:896:14)
    at Module.require (internal/modules/cjs/loader.js:1036:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at load (/Users/josephg/temp/node_modules/node-gyp-build/index.js:21:10)

Metadata

Metadata

Assignees

No one assigned

    Labels

    addonsIssues and PRs related to native addons.macosIssues and PRs related to the macOS platform / OSX.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions