So I commented out everything and slowly uncommented things until I got the error. I found out that when I try to save something to my object I get the undefined symbol error. Here is my code, see the note marked with *****:
v8::Handle<v8::Value> FreeLingTokenizer::New(const v8::Arguments& args) { v8::HandleScope scope; v8::Handle<v8::String> dir = args[0]->IsUndefined() ? v8::String::New("/usr/local/share/FreeLing/en/") : args[0]->ToString(); FreeLingTokenizer* obj = new FreeLingTokenizer(); v8::Handle<v8::String> file = v8::String::New("tokenizer.dat"); obj->path = v8::String::Concat(dir, file); ***** When I leave this in, i get the error. when I comment this line out, it works ****** obj->Wrap(args.This()); return args.This(); } As a side note, in order to build my project and link to the shared library, I had to set the LD_LIBRARY_PATH environment variable to the directory where the shared library I was linking to resides, then it works. Roy On Friday, March 30, 2012 5:35:29 PM UTC-4, Nathan Rajlich wrote: > > Perhaps use a fully qualified reference to your class > (FreeLingTokenizer::FreeLingTokenizer) > ? I'm not really sure without seeing your code. > > On Fri, Mar 30, 2012 at 2:31 PM, rhasson <> wrote: > >> Nathan, >> >> Thanks for the help. I was finally able to link my static library with >> my module but now I'm again getting an undefined symbol error but this time >> on my own module's methods. >> I can't seem to get away from this problem. >> >> [root@localdev Release]# ldd freeling.node >> linux-gate.so.1 => (0x00a4e000) >> libfreeling-3.0-alfa1.so => /home/roy/freeling/free3/lib/ >> libfreeling-3.0-alfa1.so (0x00b6b000) >> libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00542000) >> libm.so.6 => /lib/libm.so.6 (0x00110000) >> libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x0092b000) >> libpthread.so.0 => /lib/libpthread.so.0 (0x0013a000) >> libc.so.6 => /lib/libc.so.6 (0x0023b000) >> libboost_regex.so.1.44.0 => /usr/lib/libboost_regex.so.1.44.0 (0x0042d000) >> libboost_filesystem.so.1.44.0 => /usr/lib/libboost_filesystem.so.1.44.0 >> (0x00155000) >> /lib/ld-linux.so.2 (0x0021c000) >> libicuuc.so.44 => /usr/lib/libicuuc.so.44 (0x00631000) >> libicui18n.so.44 => /usr/lib/libicui18n.so.44 (0xb7533000) >> libboost_system.so.1.44.0 => /usr/lib/libboost_system.so.1.44.0 >> (0x00ab0000) >> libicudata.so.44 => /usr/lib/libicudata.so.44 (0xb66f5000) >> libdl.so.2 => /lib/libdl.so.2 (0x00207000) >> [root@localdev Release]# node >> > require('./freeling') >> Error: /home/roy/freeling/node_bind/build/Release/freeling.node: >> undefined symbol: _ZN17FreeLingTokenizer2tkE >> 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) >> > >> >> FreeLingTokenizer is my class, but I'm not sure why now it can't find its >> symbols. >> >> 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'], >> 'conditions': [ >> ['OS=="linux"', { >> 'libraries': ['/home/roy/freeling/free3/lib/libfreeling.so'], >> }], >> ], >> 'sources': ['freeling.cc', 'freeling_tokenizer.cc', 'freeling.h', >> 'freeling_tokenizer.h'], >> }, >> ], >> } >> >> >> On Thursday, March 29, 2012 2:55:43 PM UTC-4, Nathan Rajlich wrote: >> >>> Here's how node-ffi is doing it: https://github.com/** >>> rbranson/node-ffi/blob/master/**binding.gyp#L25-27<https://github.com/rbranson/node-ffi/blob/master/binding.gyp#L25-27> >>> >>> On Thu, Mar 29, 2012 at 10:54 AM, rhasson <> wrote: >>> >>>> If I was to get a static version of the library, how would I configure >>>> the binding.gyp to take advantage of it? >>>> >>>> >>>> On Thursday, March 29, 2012 1:48:55 PM UTC-4, Nathan Rajlich wrote: >>>> >>>>> All my experience has been with static compiled modules. That's what >>>>> I'm doing with node-ffi. If libfreeling offers precompiled static >>>>> versions >>>>> of the library for you to use, I would suggest going that route. Another >>>>> such option is bundling libfreeling in your repo and compiling it during >>>>> your module's build (by converting it to gyp; this is sometimes easy, >>>>> sometimes hard/impossible). >>>>> >>>>> On Thu, Mar 29, 2012 at 9:15 AM, rhasson <> wrote: >>>>> >>>>>> yes I did. I placed in the same directory as my library .cc files, I >>>>>> placed it in the freeling.node directory. >>>>>> >>>>>> I'm suspicious to how I'm setting up my binding.gyp file. I can't >>>>>> figure out how to tell in my binding.gyp file that I need my library to >>>>>> link with an external .so file. Can you provide a sample .gyp file that >>>>>> show that? >>>>>> >>>>>> This is what I have but it still doesn't like >>>>>> libfreeling-3.0-alfa1.so properly. >>>>>> >>>>>> { >>>>>> 'targets': [ >>>>>> { >>>>>> 'target_name': 'freeling', >>>>>> 'type': 'loadable_module', >>>>>> 'product_extension': 'node', >>>>>> 'product_prefix': '', >>>>>> 'include_dirs': ['/home/roy/freeling/free3/**inc**lude'], >>>>>> 'link_settings': { >>>>>> 'libraries': ['libfreeling-3.0-alfa1.so'], >>>>>> 'library_dirs': ['/home/roy/freeling/free3/**lib**'], >>>>>> }, >>>>>> 'sources': ['freeling.cc', 'freeling_tokenizer.cc'], >>>>>> }, >>>>>> ], >>>>>> } >>>>>> >>>>>> >>>>>> On Thursday, March 29, 2012 11:43:24 AM UTC-4, Nathan Rajlich wrote: >>>>>>> >>>>>>> >>>>>>> libfreeling-3.0-alfa1.so => not found >>>>>>>> >>>>>>> >>>>>>> So that needs to be fixed :p >>>>>>> >>>>>>> Did you try placing libfreeling-3.0-alfa1.so in the same directory >>>>>>> as freeling.node? >>>>>>> >>>>>> -- >>>>>> Job Board: http://jobs.nodejs.org/ >>>>>> Posting guidelines: https://github.com/joyent/**node** >>>>>> /wiki/Mailing-List-**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+unsubscribe@**googlegroup**s.com<nodejs%2bunsubscr...@googlegroups.com> >>>>>> For more options, visit this group at >>>>>> http://groups.google.com/**group**/nodejs?hl=en?hl=en<http://groups.google.com/group/nodejs?hl=en?hl=en> >>>>>> >>>>> >>>>> -- >>>> Job Board: http://jobs.nodejs.org/ >>>> Posting guidelines: https://github.com/joyent/**node/wiki/Mailing-List- >>>> **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+unsubscribe@**googlegroups.com<nodejs%2bunsubscr...@googlegroups.com> >>>> For more options, visit this group at >>>> http://groups.google.com/**group/nodejs?hl=en?hl=en<http://groups.google.com/group/nodejs?hl=en?hl=en> >>>> >>> >>> -- >> 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 >> > > -- 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