Error: Cannot open shared object file: No such file or directory

Viewed 3017

I was writing C++ Addon for Node.js. Tried to use sample library called libSample.so which has declaration of function printHello:

void printHello() {
    std::cout << "Hello World\n";
}

It worked fine.(Compiled using node-gyp configure build and executed node ./ )

When I tried to use another more complex library called libCore.so. The following error produced when started to execute. Compilation and configure passed find:

module.js:597
  return process.dlopen(module, path._makeLong(filename));
                 ^

Error: libPlayerCore.so: cannot open shared object file: No such file or directory
    at Error (native)
    at Object.Module._extensions..node (module.js:597:18)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/home/jasurn/CLionProjects/JsTest/hello.js:2:15)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)

some piece of usage libCore.so

    //#include <core.h> definition of core library lies in this header
    void CreateObject(const FunctionCallbackInfo<Value>& args) {
        Isolate* isolate = args.GetIsolate();
        Local<Object> obj = Object::New(isolate);
        obj->Set(String::NewFromUtf8(isolate, "msg"), args[0]->ToString());
        //usage of core library
        Core core;
        args.GetReturnValue().Set(obj);
    }

The binding.gyp file: the path is correct, because it is worked with another library :)

{
  "targets": [
    {
      "target_name": "addon",
      "sources": [ "hello.cc" ],
      "libraries": [
        "/home/jasurn/CLionProjects/JsTest/libPlayerCore/lib/libCore.so"
                ]
    }
  ]
}

I will be appreciated for answers or suggestions!

1 Answers
Related