Node-gyp and custom dependency / library / header install path

元气小坏坏 提交于 2021-02-09 12:25:27

问题


I have a build environment in which my libraries (and headers) are installed to a custom location. When installing a package from npm, modules that use node-gyp fail because they cannot find the libraries (or headers) I've installed. How can I make node-gyp aware of my custom install location (linux)?


回答1:


If you set CXXFLAGS and LDFLAGS before npm install <pkg> in the same line, it seems to work:

$ CXXFLAGS=-I/path/to/include LDFLAGS=-L/path/to/lib npm install <pkg>

Alternatively you can export the flags prior to the npm install

$ export CXXFLAGS=-I/path/to/include
$ export LDFLAGS=-L/path/to/lib
$ npm install <native-package>


来源:https://stackoverflow.com/questions/29832321/node-gyp-and-custom-dependency-library-header-install-path

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!