title: Undefined symbol in native NodeJS module
body: <p>I'm building a native C++ nodejs module. I have developed it in windows and now I want to run it on linux. The compiler finishes successfully. But when I run
  <code>require('smartparser')</code>, I'm getting the following error:</p>
  
  <pre><code>var a = require('smartparser')
  Error: .../node_modules/smartparser/build/Release/smartparser.node: undefined symbol: _ZN2v86String9NewSymbolEPKci
  at Module.load (module.js:356:32)
  </code></pre>
  
  <p>I'm using Debian <code>(Arch: i386)</code> with <code>GCC-4.7</code>.</p>
  
  <p>Node version: <code>v0.11.3-pre</code></p>
  
  <p>NPM version: <code>1.3.10</code></p>
  
  <p>I'm also getting the following warning: </p>
  
  <pre><code>make: warning:  Clock skew detected.  Your build may be incomplete.
  </code></pre>
  
  <p>But after little researched, I found out this is caused by wrong local time.</p>
  
  <p><strong>EDIT2: Code</strong></p>
  
  <pre><code>{
    "author": "deepsy@gmail.com",
    "targets": [
      {
        "target_name": "smartparser",
        "sources": [ "lib/handler.cpp", "lib/analyzer.cpp", "lib/parser.cpp" ],
            "cflags": [
                "-std=c++11"
            ]
  
      }
    ]
  }
  </code></pre>
  
  <p>Cpp</p>
  
  <pre><code>Handle&lt;Value&gt; parseHandler(const Arguments&amp; args) {
      HandleScope scope;
  
      bool validArguments = 
          args[0]-&gt;IsString() &amp;&amp;
          args[1]-&gt;IsString() &amp;&amp; 
          args[2]-&gt;IsNumber() &amp;&amp; 
          args[3]-&gt;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&lt;Array&gt; nodes = Parser(std::string(*String::Utf8Value(args[0]-&gt;ToString())),
                                  std::string(*String::Utf8Value(args[1]-&gt;ToString())), 
                                  int(args[2]-&gt;Int32Value()));
  
      const unsigned argc = 2;
      Local&lt;Value&gt; argv[argc] = {
          Local&lt;Value&gt;::New(Null()),
          nodes
      };
  
      Local&lt;Function&gt; callback = Local&lt;Function&gt;::Cast(args[3]);
  
      callback-&gt;Call(Context::GetCurrent()-&gt;Global(), argc, argv);
  
      return Undefined();
  }
  
  Local&lt;Array&gt; Parser(std::string input, std::string title, int sentenceLimit)
  {
      Local&lt;Array&gt; nodes = Array::New();
      Local&lt;Object&gt; 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('&lt;', pos)) != std::string::npos) {
          pos++;
          switch (tagID = tagDetect(&amp;input[pos])) {
  
          case Tags::Closing:
  
              // determine what kind of closing tag is
              tagID = tagDetect(&amp;input[pos + 1]);
  
              // Is this the closure of the last tag
              if (tagID == lastTag &amp;&amp; (pos - openPos &gt; 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-&gt;Set(tag_symbol, Integer::New(lastTag));
                  node_obj-&gt;Set(data_symbol, String::New(
                      analyzer.getSummary(title,
                                          input.substr(openPos + (lastTag &gt; 1 ? 3 : 2), pos - openPos - (lastTag &gt; 1 ? 3 : 2) - 1),
                                          sentenceLimit).c_str()));
  
                  nodes-&gt;Set(id++, node_obj);
                  lastAppended = lastTag;
                  continue;
              }
  
              // Clear useless tags
              input.erase(pos - 1, input.find('&gt;', 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('&gt;', pos - 1) - pos + 2);
              break;
          }
      }
  
      // Remove last element from array if its heading elements
      if (lastTag == Tags::Heading) {
          nodes-&gt;Delete(id - 1);
      }
  
      return nodes;
  }
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/NLTtd.png" alt="enter image description here"></p>