{"action":"closed","issue":{"url":"https://api.github.com/repos/nodejs/nan/issues/621","repository_url":"https://api.github.com/repos/nodejs/nan","labels_url":"https://api.github.com/repos/nodejs/nan/issues/621/labels{/name}","comments_url":"https://api.github.com/repos/nodejs/nan/issues/621/comments","events_url":"https://api.github.com/repos/nodejs/nan/issues/621/events","html_url":"https://github.com/nodejs/nan/issues/621","id":184681133,"number":621,"title":"Library not loaded... Reason: image not found","user":{"login":"davidgatti","id":411114,"avatar_url":"https://avatars.githubusercontent.com/u/411114?v=3","gravatar_id":"","url":"https://api.github.com/users/davidgatti","html_url":"https://github.com/davidgatti","followers_url":"https://api.github.com/users/davidgatti/followers","following_url":"https://api.github.com/users/davidgatti/following{/other_user}","gists_url":"https://api.github.com/users/davidgatti/gists{/gist_id}","starred_url":"https://api.github.com/users/davidgatti/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davidgatti/subscriptions","organizations_url":"https://api.github.com/users/davidgatti/orgs","repos_url":"https://api.github.com/users/davidgatti/repos","events_url":"https://api.github.com/users/davidgatti/events{/privacy}","received_events_url":"https://api.github.com/users/davidgatti/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":9,"created_at":"2016-10-23T09:56:02Z","updated_at":"2016-10-24T17:10:03Z","closed_at":"2016-10-24T17:10:03Z","body":"Hello Epic people 😎.\r\n\r\nA while back I had to use a C library in a company project, and thanks to Nan and 1 book, and some trial and error, I managed to make it all work 👍. \r\n\r\nSince I like to write articles I decided to write down what I learned.\r\n\r\nStrangely enough, I'm having an issue making NodeJS, C++ and C work nicely together, and I'm not sure what is going on since I repeated all the steps from my work project. The only difference is that I decided to create a C library myself. When I try to run JavaScript I get the following:\r\n\r\n```\r\n> library@1.0.0 start /Users/davidgatti/Documents/GitHub/MrWhite/NodeJS-to-C-through-CPP/library\r\n> LD_LIBRARY_PATH=c_library node index.js\r\n\r\nmodule.js:583\r\n  return process.dlopen(module, path._makeLong(filename));\r\n                 ^\r\n\r\nError: dlopen(/Users/davidgatti/Documents/GitHub/MrWhite/NodeJS-to-C-through-CPP/library/build/Release/c_library.node, 1): Library not loaded: libdavid_sum.so\r\n  Referenced from: /Users/davidgatti/Documents/GitHub/MrWhite/NodeJS-to-C-through-CPP/library/build/Release/c_library.node\r\n  Reason: image not found\r\n    at Error (native)\r\n    at Object.Module._extensions..node (module.js:583:18)\r\n    at Module.load (module.js:473:32)\r\n    at tryModuleLoad (module.js:432:12)\r\n    at Function.Module._load (module.js:424:3)\r\n    at Module.require (module.js:483:17)\r\n    at require (internal/module.js:20:19)\r\n    at Object.<anonymous> (/Users/davidgatti/Documents/GitHub/MrWhite/NodeJS-to-C-through-CPP/library/index.js:6:13)\r\n    at Module._compile (module.js:556:32)\r\n    at Object.Module._extensions..js (module.js:565:10)\r\n```\r\n\r\nIf I put the `libdavid_sum.so` (copy not move), in the root directory of the project, I get this error despite keeping the paths to the library directory untouched.\r\n\r\n```\r\n> library@1.0.0 start /Users/davidgatti/Documents/GitHub/MrWhite/NodeJS-to-C-through-CPP/library\r\n> LD_LIBRARY_PATH=c_library node index.js\r\n\r\nmodule.js:583\r\n  return process.dlopen(module, path._makeLong(filename));\r\n                 ^\r\n\r\nError: Module did not self-register.\r\n    at Error (native)\r\n    at Object.Module._extensions..node (module.js:583:18)\r\n    at Module.load (module.js:473:32)\r\n    at tryModuleLoad (module.js:432:12)\r\n    at Function.Module._load (module.js:424:3)\r\n    at Module.require (module.js:483:17)\r\n    at require (internal/module.js:20:19)\r\n    at Object.<anonymous> (/Users/davidgatti/Documents/GitHub/MrWhite/NodeJS-to-C-through-CPP/library/index.js:6:13)\r\n    at Module._compile (module.js:556:32)\r\n    at Object.Module._extensions..js (module.js:565:10)\r\n```\r\n\r\n# The source code \r\n\r\nThe source code can be found [hear](https://github.com/davidgatti/NodeJS-to-C-through-CPP/tree/master/library). To make it all not work 😅, you need to:\r\n\r\n1. In the `c_library` folder type `make` to create the library and test app that shows that the library works.\r\n1. in the library folder type `npm install` \r\n1. in the library folder type `npm start` \r\n\r\n# My questions...\r\n\r\nI have no idea what I'm missing. Is there an issue locating the library? Or maybe I'm making the library the wrong way? \r\n\r\n# Tech specs\r\n\r\n- NodeJS v6.4.0\r\n- Nan: 2.4.0\r\n- node-gyp: 3.4.0"}}
{"actor":{"display_login":"davidgatti"}}