{"action":"created","issue":{"url":"https://api.github.com/repos/nodejs/node-v0.x-archive/issues/25627","labels_url":"https://api.github.com/repos/nodejs/node-v0.x-archive/issues/25627/labels{/name}","comments_url":"https://api.github.com/repos/nodejs/node-v0.x-archive/issues/25627/comments","events_url":"https://api.github.com/repos/nodejs/node-v0.x-archive/issues/25627/events","html_url":"https://github.com/nodejs/node-v0.x-archive/issues/25627","id":93010305,"number":25627,"title":"Include LD_LIBRARY_PATH with all compiled modules","user":{"login":"piranna","id":532414,"avatar_url":"https://avatars.githubusercontent.com/u/532414?v=3","gravatar_id":"","url":"https://api.github.com/users/piranna","html_url":"https://github.com/piranna","followers_url":"https://api.github.com/users/piranna/followers","following_url":"https://api.github.com/users/piranna/following{/other_user}","gists_url":"https://api.github.com/users/piranna/gists{/gist_id}","starred_url":"https://api.github.com/users/piranna/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/piranna/subscriptions","organizations_url":"https://api.github.com/users/piranna/orgs","repos_url":"https://api.github.com/users/piranna/repos","events_url":"https://api.github.com/users/piranna/events{/privacy}","received_events_url":"https://api.github.com/users/piranna/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2015-07-04T12:58:38Z","updated_at":"2016-01-19T15:28:28Z","closed_at":"2016-01-19T10:16:18Z","body":"Or something similar :-)\r\n\r\nAfter adapting node-canvas to be able to compile it as a [statically linked dynamic library](https://github.com/Automattic/node-canvas/issues/551), that seems [it's the recomended way to create compiled modules](https://n8.io/converting-a-c-library-to-gyp/) so they don't depend on globally installed dynamic libraries, I've found that some complex libraries like node-canvas can have several fairly big libraries like Cairo, libpng... that are complex to compile and otherwise would be shared with other modules, specially now with npm@3 having a flat depencies tree. That's why I think this library depencies (cairo, libpng, libjpeg-turbo and so) could be moved to their own modules and node-canvas (and others) use them as dependencies). With Javascript modules this is easy since it's already managed by ```require()```... problem here is that a compiled module is using another compiled module.\r\n\r\nThe solution I'm proposing here is that since the compiled modules (the .node files) are .so files with a different extension, Node.js would update the LD_LIBRARY_PATH to include the location of the .node files of its dependencies (somewhat related to https://github.com/npm/npm/issues/6437), or maybe simpler ```require()``` itself could navigate over the node_modules folders of the project searching for these dependencies (probably defined on the package.json in a sharedDependencies or dynamicDependencies or similar?) so all the modules symbols can be loaded just before the module itself gets loaded. This way the modules gets simpler and easier to test, compile and distribute, and make installations faster."},"comment":{"url":"https://api.github.com/repos/nodejs/node-v0.x-archive/issues/comments/172888357","html_url":"https://github.com/nodejs/node-v0.x-archive/issues/25627#issuecomment-172888357","issue_url":"https://api.github.com/repos/nodejs/node-v0.x-archive/issues/25627","id":172888357,"user":{"login":"bnoordhuis","id":275871,"avatar_url":"https://avatars.githubusercontent.com/u/275871?v=3","gravatar_id":"","url":"https://api.github.com/users/bnoordhuis","html_url":"https://github.com/bnoordhuis","followers_url":"https://api.github.com/users/bnoordhuis/followers","following_url":"https://api.github.com/users/bnoordhuis/following{/other_user}","gists_url":"https://api.github.com/users/bnoordhuis/gists{/gist_id}","starred_url":"https://api.github.com/users/bnoordhuis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bnoordhuis/subscriptions","organizations_url":"https://api.github.com/users/bnoordhuis/orgs","repos_url":"https://api.github.com/users/bnoordhuis/repos","events_url":"https://api.github.com/users/bnoordhuis/events{/privacy}","received_events_url":"https://api.github.com/users/bnoordhuis/received_events","type":"User","site_admin":false},"created_at":"2016-01-19T15:28:28Z","updated_at":"2016-01-19T15:28:28Z","body":"@piranna Why would `-rpath` not work for your use case?"}}