Question

I am really new to node.js and node-gyp, but i want to build a module from a wscript. As far as I know I would need node-waf to build the module directly, but since this is no longer supported, I would like to create a bindings.gyp from wscript.

My wscript:

import Options

def set_options(opt):
    opt.tool_options("compiler_cxx")

def configure(conf):
    conf.check_tool("compiler_cxx")
    conf.check_tool("node_addon")
    conf.env.append_value('LINKFLAGS', ['-l:ail.so', 'L/.../src/',])

def build(bld):
    obj = bld.new_task_gen("cxx", "shlib", "node_addon")
    obj.target = "AIL"
    obj.source = ["AIL.cc","reader.cc"]

and my attempt at creating binding.gyp

{
    "targets" : [
        {
        "target_name": "AIL",
        "sources": ["AIL.cc", "reader.cc", "ailreader/src/ali.h"]
        }
    ]
} 

The module will build, but when I run it, it gives symbol lookup errors.

Was it helpful?

Solution

I was missing libraries. The following binding.gyp file worked:

{
    "targets" : [
        {
            "target_name": "AIL",
            "sources": ["AIL.cc", "reader.cc"],
            "link_settings" : {
                "libraries":['-l:/path/to/lib/ail.so'],
            }
        }

    ]
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top