Nathan, 

I have a question about node-gyp.  I have a native library that I'm 
building a node binding for.  that library (freeling) has been 
built separately and in the build directory has an include and lib folders 
with the headers and .so files.
I built my module (the node binding to freeling), everything compiles fine 
but when I try to require the module in node I get the following error:
> require('./freeling')
Error: libfreeling-3.0-alfa1.so: cannot open shared object file: No such 
file or directory
    at Object..node (module.js:476:11)
    at Module.load (module.js:352:32)
    at Function._load (module.js:310:12)
    at Module.require (module.js:358:17)
    at require (module.js:374:17)
    at repl:1:2
    at REPLServer.eval (repl.js:85:21)
    at Interface.<anonymous> (repl.js:202:12)
    at Interface.emit (events.js:67:17)
    at Interface._onLine (readline.js:169:10)

Here is my binding.gyp file:

{
  'targets': [
    {
      'target_name': 'freeling',
      'type': 'loadable_module',
      'product_extension': 'node',
      'product_prefix': '',
      'include_dirs': ['/home/roy/freeling/free3/include'],
      'libraries': [
      '/home/roy/freeling/free3/lib/libfreeling.so',
      '/home/roy/freeling/free3/lib/libfreeling-3.0-alfa1.so'
      ],
      'sources': ['freeling.cc', 'freeling_tokenizer.cc']
    }
  ]
}

I'm not sure I'm doing this correctly.  Basically, I need to link by module 
to the freeling headers and object files so it recognizes the freeling 
classes and functions I'll be calling from within my module.

Thanks,
Roy

On Wednesday, March 28, 2012 12:38:29 AM UTC-4, rhasson wrote:
>
> Never mind, I found the problem.
>
> In my .cc file I was declaring the function as GetWString() instead of 
> FreeLingTokenizer::GetWString().  After adding the scope it was ok.  Now I 
> have another bug but I'll spare you my debugging unless I get stuck.
>
> Thank you, switching to 0.7.6 and node-gyp was a great idea, at least now 
> I get real error messages that I can debug.
>
> Roy
>
> On Wednesday, March 28, 2012 12:29:48 AM UTC-4, rhasson wrote:
>>
>> Ok, so I installed 0.7.6 and compiled with node-gyp fine and this time a 
>> little more details but I'm not sure how to resolve this issue.
>>
>> > process.version
>> 'v0.7.6'
>> > l = require('./freeling.node')
>> Error: /home/roy/freeling/node_bind/build/Debug/freeling.node: undefined 
>> symbol: _ZN17FreeLingTokenizer10GetWStringEN2v86HandleINS0_6StringEEE
>>     at Object..node (module.js:476:11)
>>     at Module.load (module.js:352:32)
>>     at Function._load (module.js:310:12)
>>     at Module.require (module.js:358:17)
>>     at require (module.js:374:17)
>>     at repl:1:6
>>     at REPLServer.eval (repl.js:85:21)
>>     at Interface.<anonymous> (repl.js:202:12)
>>     at Interface.emit (events.js:67:17)
>>     at Interface._onLine (readline.js:169:10)
>>
>> Inside my class declaration under private I have this:
>>  static std::wstring GetWString(v8::Handle<v8::String> str);
>>
>> Then in my .cc file I have the actual function:
>> // Convert a V8 string to a wide string.
>> std::wstring GetWString(v8::Handle<v8::String> str) {
>>   v8::HandleScope scope;
>>
>>   uint16_t* buf = new uint16_t[str->Length()+1];
>>   str->Write(buf);
>>   std::wstring value = reinterpret_cast<wchar_t*>(buf);
>>   delete [] buf;
>>   
>>   return value;
>> }
>>
>> I'm not sure why the error is "undefined symbol".
>>
>> Thanks,
>> Roy
>>
>> On Monday, March 26, 2012 5:30:29 PM UTC-4, SteveCronin wrote:
>>>
>>> I'm getting an error when I 'require' a module I have built.
>>>
>>> Is this a 32/64bit issue?  If so how do I best correct for future node 
>>> compatibility?
>>>
>>> node 0.6.13 on Mac OS X 10.7.3
>>>
>>> I'm still using node-waf to manually compile modules -- is that the 
>>> problem?
>>> Here's the wscript:
>>> srcdir = '.'
>>> blddir = 'build'
>>> VERSION = '1.0.0'
>>> APPNAME = 'XYZ-ABC-utils'
>>>
>>> def set_options(opt):
>>>     opt.tool_options('compiler_cxx')
>>>
>>> def configure(conf):
>>>     conf.check_tool('compiler_cxx')
>>>     conf.check_tool('node_addon')
>>>
>>> def build(bld):
>>>     obj = bld.new_task_gen('cxx', 'shlib', 'node_addon')
>>>     obj.source = 'node-ABC-support.cc', 'ABC1-support.cc', 
>>> 'ABC2-support.cc',  'ABC3-support.cc'
>>>     obj.libpath = [ bld.path.abspath() ]
>>>     obj.lib = 'GHJ.o'
>>>     bld.env.append_value('LINKFLAGS', '-lcrypto -lssl -lz'.split())
>>>     obj.target = 'XYZ-ABC-utils'
>>>
>>> Even if I add this line to the script I still get the same errors:
>>>
>>>     obj.cxxflags = ["-g", "-D_FILE_OFFSET_BITS=64", 
>>> "-D_LARGEFILE_SOURCE"]
>>>
>>
>> On Monday, March 26, 2012 5:30:29 PM UTC-4, SteveCronin wrote:
>>>
>>> I'm getting an error when I 'require' a module I have built.
>>>
>>> Is this a 32/64bit issue?  If so how do I best correct for future node 
>>> compatibility?
>>>
>>> node 0.6.13 on Mac OS X 10.7.3
>>>
>>> I'm still using node-waf to manually compile modules -- is that the 
>>> problem?
>>> Here's the wscript:
>>> srcdir = '.'
>>> blddir = 'build'
>>> VERSION = '1.0.0'
>>> APPNAME = 'XYZ-ABC-utils'
>>>
>>> def set_options(opt):
>>>     opt.tool_options('compiler_cxx')
>>>
>>> def configure(conf):
>>>     conf.check_tool('compiler_cxx')
>>>     conf.check_tool('node_addon')
>>>
>>> def build(bld):
>>>     obj = bld.new_task_gen('cxx', 'shlib', 'node_addon')
>>>     obj.source = 'node-ABC-support.cc', 'ABC1-support.cc', 
>>> 'ABC2-support.cc',  'ABC3-support.cc'
>>>     obj.libpath = [ bld.path.abspath() ]
>>>     obj.lib = 'GHJ.o'
>>>     bld.env.append_value('LINKFLAGS', '-lcrypto -lssl -lz'.split())
>>>     obj.target = 'XYZ-ABC-utils'
>>>
>>> Even if I add this line to the script I still get the same errors:
>>>
>>>     obj.cxxflags = ["-g", "-D_FILE_OFFSET_BITS=64", 
>>> "-D_LARGEFILE_SOURCE"]
>>>
>>

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply via email to