charto / nbind

:sparkles: Magical headers that make your C++ library accessible from JavaScript :rocket:
MIT License
1.98k stars 120 forks source link

nbind.init() throwing SIGSEGV #86

Open JoeyAndres opened 7 years ago

JoeyAndres commented 7 years ago

So I have the following binding.gyp:

{
    "targets": [
        {
            "includes": [
            "auto.gypi"
            ],
            "sources": [
            "node-adapter/cxx/src/*.cpp"
            ],
            "include_dirs": [
                        "build", "node-adapter/cxx/include"
                     ],
                    "libraries": [
                        "-lrl",
                         "-lentailmentsearch",

                        "-L/usr/local/lib/x86_64-linux-gnu",
                        "-lcassandra"
                     ],
                    "cflags": [ "-std=c++11" ]
        }
    ],
    "includes": [
        "auto-top.gypi"
    ]
}

The first sign of problem happens after I compile this in which I get the following:

Error: libcassandra.so.2: 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 initNode (/home/jandres/Dev/analytic-engine-rl/node_modules/nbind/dist/nbind.js:141:15) at /home/jandres/Dev/analytic-engine-rl/node_modules/nbind/dist/nbind.js:115:13 at findCompiledModule (/home/jandres/Dev/analytic-engine-rl/node_modules/nbind/dist/nbind.js:79:13)

Which does not makes sense given that I supplied the path already for my cassandra installation directory.

Furthermore, if I run export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib/x86_64-linux-gnu prior to running the NodeJS javascript file, I finally get the SIGSEGV, which occurs precisely during nbind.init().

I would appreciate any help I can get. I would gladly work with someone on this.

jjrv commented 7 years ago

Try to compile for debugging (see the debugging section in the readme) and GDB should help find out which line is crashing.

The -L flag might work better in ldflags, or OTHER_LDFLAGS inside xcode_settings if you're on OS X.