Re: [nodejs] Re: Examples of C++ modules, for Node.js

2012-04-24 Thread Ben Noordhuis
On Tue, Apr 24, 2012 at 06:11, rhasson rhas...@gmail.com wrote: I found out that for Solaris ELF executables you can pass a -R/path/to/lib argument which will record the path and library name into the executable which will allow it to find it at runtime without needing to update the

[nodejs] Re: Examples of C++ modules, for Node.js

2012-04-23 Thread rhasson
I found out that I needed to set up my LD_LIBRARY_PATH env variable otherwise it will not find the path to the shared library. set it up like this: export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/path/to/hdf5/lib Then rebuild the project. Once rebuilt type: ldd build/Release/hdf5.node (or whatever

[nodejs] Re: Examples of C++ modules, for Node.js

2012-04-23 Thread Ryan Cole
Roy, I notice you mentioned this early in the email chain. I should have tried it earlier. It fixes the issue. I wonder why the ldflags in binding.gyp does not properly set this up, in my case? Or, is LD_LIBRARY_PATH just another required step no matter what? Also, I did not know about the ldd

[nodejs] Re: Examples of C++ modules, for Node.js

2012-04-23 Thread rhasson
I'm using node-gyp and ldflags didn't work for me either. Maybe Nathan has an idea, but I found out that I needed to set the LD_LIBRARY_PATH otherwise my shared library wouldn't link. On Monday, April 23, 2012 11:21:06 AM UTC-4, Ryan Cole wrote: Roy, I notice you mentioned this early in

Re: [nodejs] Re: Examples of C++ modules, for Node.js

2012-04-23 Thread Ben Noordhuis
On Tue, Apr 24, 2012 at 04:46, rhasson rhas...@gmail.com wrote: I'm using node-gyp and ldflags didn't work for me either.  Maybe Nathan has an idea, but I found out that I needed to set the LD_LIBRARY_PATH otherwise my shared library wouldn't link. The ldflags setting is what is passed to the

Re: [nodejs] Re: Examples of C++ modules, for Node.js

2012-04-23 Thread rhasson
ok that makes sense. So the question is, once gyp compiled and the linker linked the shared library into the .node module using ldflags. How do you require the module without needing to set the LD_LIBRARY_PATH ? Now if I set the LD_LIBRARY_PATH I can require the module and it works. But if

Re: [nodejs] Re: Examples of C++ modules, for Node.js

2012-04-23 Thread Ben Noordhuis
On Tue, Apr 24, 2012 at 05:23, rhasson rhas...@gmail.com wrote: ok that makes sense.  So the question is, once gyp compiled and the linker linked the shared library into the .node module using ldflags.  How do you require the module without needing to set the LD_LIBRARY_PATH ? You don't*. The

Re: [nodejs] Re: Examples of C++ modules, for Node.js

2012-04-23 Thread rhasson
Ben, When I get rid of LD_LIBRARY_PATH and include the ldflags and libraries lines in by binding.gyp file the shared library is not linked as shown by ldd. If I set the LD_LIBRARY_PATH then it links it correctly. Is ldflags not parsed correctly? Here is my gyp file: { 'targets': [ {

Re: [nodejs] Re: Examples of C++ modules, for Node.js

2012-04-23 Thread Ben Noordhuis
On Tue, Apr 24, 2012 at 05:45, rhasson rhas...@gmail.com wrote: Ben, When I get rid of LD_LIBRARY_PATH and include the ldflags and libraries lines in by binding.gyp file the shared library is not linked as shown by ldd.  If I set the LD_LIBRARY_PATH then it links it correctly. Is ldflags

Re: [nodejs] Re: Examples of C++ modules, for Node.js

2012-04-23 Thread rhasson
I found out that for Solaris ELF executables you can pass a -R/path/to/lib argument which will record the path and library name into the executable which will allow it to find it at runtime without needing to update the LD_LIBRARY_PATH. Is there an equivalent argument for Linux? On Monday,

Re: [nodejs] Re: Examples of C++ modules, for Node.js

2012-04-23 Thread rhasson
I found out that for Solaris ELF executables you can pass a -R/path/to/lib argument which will record the path and library name into the executable which will allow it to find it at runtime without needing to update the LD_LIBRARY_PATH. Is there an equivalent argument for Linux? On Monday,

[nodejs] Re: Examples of C++ modules, for Node.js

2012-04-22 Thread pconstr
Hi Ryan, I found this (http://kkaefer.github.com/node-cpp-modules/) presentation helpful to get started with c++ modules. It includes good examples (https://github.com/kkaefer/node-cpp- modules) but covers building with node-waf only, not gyp. -Carlos On Apr 22, 4:50 am, Ryan r...@rycole.com

[nodejs] Re: Examples of C++ modules, for Node.js

2012-04-22 Thread rhasson
Just to add to Nathan's comments, you're missing a libraries that points to the the HDF5 shared library that was compiled separately. for example: 'libraries': ['/home/user/hdf5/lib/hdf5.so'] Also, I noticed that when compiling with node-gyp (which I love btw) you need to set LD_LIBRARY_PATH

[nodejs] Re: Examples of C++ modules, for Node.js

2012-04-22 Thread Ryan Cole
Oh, wow. I did not have email notifications enabled for responses, so I did not expect to sign in and see so many helpful responses. Thank you for these. I'm going over them now and will apply this insight to what I'm doing. Also, per Nathan's suggestion, I think I will update from node 0.6.7

[nodejs] Re: Examples of C++ modules, for Node.js

2012-04-22 Thread andrew morton
I've also been working my way up that learning curve. One problem is that there's a lot of dated examples that kept leading me a stray. It took me way too long to find this and I hadn't seen it mentioned yet but the docs included with Node are really good: http://nodejs.org/api/addons.html

[nodejs] Re: Examples of C++ modules, for Node.js

2012-04-22 Thread Ryan Cole
Is there no way to specify the library search path from within the binding.gyp file? I'm just trying to see if it's possible to make `node-gyp configure` spit `-L/usr/local/hdf5/lib` out into the Makefile, or whatever it builds. I'll be searching the docs, but I haven't run across it yet. I'll

Re: [nodejs] Re: Examples of C++ modules, for Node.js

2012-04-22 Thread Ben Noordhuis
On Mon, Apr 23, 2012 at 05:12, Ryan Cole r...@rycole.com wrote: Is there no way to specify the library search path from within the binding.gyp file? I'm just trying to see if it's possible to make `node-gyp configure` spit `-L/usr/local/hdf5/lib` out into the Makefile, or whatever it builds.

[nodejs] Re: Examples of C++ modules, for Node.js

2012-04-22 Thread Ryan Cole
I have adjusted the binding.gyp file to include the linker settings required for including the HDF5 libs I need. I believe that the current gyp file mirrors a Makefile that I am able to get working, for HDF5's stand alone compile. The only difference is that you're supposed to run the HDF5

[nodejs] Re: Examples of C++ modules, for Node.js

2012-04-21 Thread Marco Rogers
Here are the slides from my nodeconf talk last year. Not much about building properly, but some approachable info about how a native module works in node. Hope it helps. http://marcorogers.com/nodeconf-2011/node_addons_presentation.html :Marco On Saturday, April 21, 2012 6:50:49 PM UTC-7,