本机NodeJS模块中未定义的符号 我正在构建一个本地C++ NoDEJS模块。我在windows中开发了它,现在我想在linux上运行它。编译器成功完成。但是当我跑的时候 require('smartparser'),我得到以下错误: var a = require('smartparser') Error: .../node_modules/smartparser/build/Release/smartparser.node: undefined symbol: _ZN2v86String9NewSymbolEPKci at Module.load (module.js:356:32)

本机NodeJS模块中未定义的符号 我正在构建一个本地C++ NoDEJS模块。我在windows中开发了它,现在我想在linux上运行它。编译器成功完成。但是当我跑的时候 require('smartparser'),我得到以下错误: var a = require('smartparser') Error: .../node_modules/smartparser/build/Release/smartparser.node: undefined symbol: _ZN2v86String9NewSymbolEPKci at Module.load (module.js:356:32),c++,node.js,gcc,compiler-construction,v8,C++,Node.js,Gcc,Compiler Construction,V8,我正在使用Debian(Arch:i386)和GCC-4.7 节点版本:v0.11.3-pre NPM版本:1.3.10 我还收到了以下警告: make: warning: Clock skew detected. Your build may be incomplete. 但经过很少的研究,我发现这是由错误的当地时间造成的 EDIT2:Code { "author": "deepsy@gmail.com", "targets": [ { "target_nam

我正在使用Debian
(Arch:i386)
GCC-4.7

节点版本:
v0.11.3-pre

NPM版本:
1.3.10

我还收到了以下警告:

make: warning:  Clock skew detected.  Your build may be incomplete.
但经过很少的研究,我发现这是由错误的当地时间造成的

EDIT2:Code

{
  "author": "deepsy@gmail.com",
  "targets": [
    {
      "target_name": "smartparser",
      "sources": [ "lib/handler.cpp", "lib/analyzer.cpp", "lib/parser.cpp" ],
          "cflags": [
              "-std=c++11"
          ]

    }
  ]
}
Cpp

句柄解析处理程序(常量参数和参数){
手镜镜;
布尔有效值=
args[0]->IsString()&&
args[1]>IsString()
args[2]->IsNumber()
args[3]->IsFunction();
如果(!有效期){
返回ThroweException(异常::TypeError(
String::New(“无效参数!按以下顺序传递参数:{String}text、{String}title、{int}outputlength、{function}callback.”);
}
本地节点=解析器(std::string(*string::Utf8Value(args[0]->ToString()),
std::string(*string::Utf8Value(args[1]->ToString()),
int(args[2]->Int32Value());
常量无符号argc=2;
本地argv[argc]={
Local::New(Null()),
节点
};
本地回调=Local::Cast(args[3]);
回调->调用(Context::GetCurrent()->Global(),argc,argv);
返回未定义();
}
本地解析器(std::string输入,std::string标题,int-sentenceLimit)
{
本地节点=数组::New();
局部节点_obj;
标准:尺寸\u t位置=0;
std::size\u t closePos=-1;
std::size\u t openPos=-1;
int tagID=-1;
int lastTag=-1;
int=1;
//输出数组迭代器
int id=0;
while((pos=input.find(“”,pos-1)-pos+2);
打破
//在“标记检测”对话框中设置开始标记
案例标签::段落:
案例标签::标题:
openPos=pos;
lastTag=tagID;
打破
违约:
//清除无用的标签
输入.擦除(位置-1,输入.查找('>',位置-1)-位置+2);
打破
}
}
//从数组中删除最后一个元素(如果其标题为元素)
if(lastTag==Tags::Heading){
节点->删除(id-1);
}
返回节点;
}

需要找出缺少的符号以及这些符号的定义位置(这里是您的朋友)…然后可能是链接这些符号的问题(例如静态库或*.o文件)或者在运行node.js或node.js扩展程序放置其库的位置时,使定义的共享库在LD_library_路径中可用。@Deepsy,我对另一个库也有同样的问题。找到解决方案了吗?尝试使用调试版本如何?我想它应该保留符号。
Handle<Value> parseHandler(const Arguments& args) {
    HandleScope scope;

    bool validArguments = 
        args[0]->IsString() &&
        args[1]->IsString() && 
        args[2]->IsNumber() && 
        args[3]->IsFunction();

    if (!validArguments) {
        return ThrowException(Exception::TypeError(
            String::New("Invalid arguments! Pass the arguments in the following order: {string} text, {string} title, {int} outputlength, {function} callback.")));
    }

    Local<Array> nodes = Parser(std::string(*String::Utf8Value(args[0]->ToString())),
                                std::string(*String::Utf8Value(args[1]->ToString())), 
                                int(args[2]->Int32Value()));

    const unsigned argc = 2;
    Local<Value> argv[argc] = {
        Local<Value>::New(Null()),
        nodes
    };

    Local<Function> callback = Local<Function>::Cast(args[3]);

    callback->Call(Context::GetCurrent()->Global(), argc, argv);

    return Undefined();
}

Local<Array> Parser(std::string input, std::string title, int sentenceLimit)
{
    Local<Array> nodes = Array::New();
    Local<Object> node_obj;

    std::size_t pos = 0;
    std::size_t closePos = -1;
    std::size_t openPos = -1;

    int tagID = -1;
    int lastTag = -1;
    int lastAppended = -1;

    // Output array iterator
    int id = 0;

    while ((pos = input.find('<', pos)) != std::string::npos) {
        pos++;
        switch (tagID = tagDetect(&input[pos])) {

        case Tags::Closing:

            // determine what kind of closing tag is
            tagID = tagDetect(&input[pos + 1]);

            // Is this the closure of the last tag
            if (tagID == lastTag && (pos - openPos > MIN_TEXT_LENGTH || lastTag != Tags::Paragraph)) {

                // If two tags of same kind are used in sequence skip second
                if (lastAppended == lastTag) {
                    continue;
                }

                // Create new object in the array
                // Example:
                //     { tag: 2, content: "Some content" }
                node_obj = Object::New();
                node_obj->Set(tag_symbol, Integer::New(lastTag));
                node_obj->Set(data_symbol, String::New(
                    analyzer.getSummary(title,
                                        input.substr(openPos + (lastTag > 1 ? 3 : 2), pos - openPos - (lastTag > 1 ? 3 : 2) - 1),
                                        sentenceLimit).c_str()));

                nodes->Set(id++, node_obj);
                lastAppended = lastTag;
                continue;
            }

            // Clear useless tags
            input.erase(pos - 1, input.find('>', pos - 1) - pos + 2);
            break;

        // Sets a opening tag in the tag detect
        case Tags::Paragraph:
        case Tags::Heading:
            openPos = pos;
            lastTag = tagID;
            break;
        default:

            // Clear useless tags
            input.erase(pos - 1, input.find('>', pos - 1) - pos + 2);
            break;
        }
    }

    // Remove last element from array if its heading elements
    if (lastTag == Tags::Heading) {
        nodes->Delete(id - 1);
    }

    return nodes;
}