node-gyp: gyp ERR! cannot load shared libpython2.7.so.1.0

229 views
Skip to first unread message

deng....@gmail.com

unread,
Sep 17, 2013, 1:21:06 PM9/17/13
to nod...@googlegroups.com
Hi group:

I am trying to build the hello world c++ addon for node js. Both node.js and node-gyp seem have been installed successfully into a redhat linux. However when I ran "node-gyp configure", it gave the following error. I failed to get any insightful information by gooling as well as from the wiki page. Can you please kindly advise?

Thanks in advance.


~/examples/node.js/my_node_addon-1[13:14]% node-gyp configure
gyp info it worked if it ends with ok
gyp info using node-gyp\@0.10.10
gyp info using node\@0.10.18 | linux | x64
gyp ERR! configure error
gyp ERR! stack Error: Command failed: python: error while loading shared libraries: libpython2.7.so.1.0: cannot open shared object file: No such file or directory
gyp ERR! stack
gyp ERR! stack     at ChildProcess.exithandler (child_process.js:637:15)
gyp ERR! stack     at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack     at maybeClose (child_process.js:735:16)
gyp ERR! stack     at Socket.<anonymous> (child_process.js:948:11)
gyp ERR! stack     at Socket.EventEmitter.emit (events.js:95:17)
gyp ERR! stack     at Pipe.close (net.js:466:12)
gyp ERR! System Linux 2.6.18-194.32.1.el5
gyp ERR! command "node" "/work/dengf/conf/bin/node-gyp" "configure"
gyp ERR! cwd /home/dengf/examples/node.js/my_node_addon
gyp ERR! node -v v0.10.18
gyp ERR! node-gyp -v v0.10.10
gyp ERR! not ok

But when I run python alone it loads the shared lib just fine:
~/examples/node.js/my_node_addon-1[13:14]% python -V
Python 2.7.3

Jose Luis Rivas

unread,
Sep 17, 2013, 4:40:48 PM9/17/13
to nod...@googlegroups.com
On 09/17/2013 12:51 PM, deng....@gmail.com wrote:
> ~/examples/node.js/my_node_addon-1[13:14]% node-gyp configure
> gyp info it worked if it ends with ok
> gyp info using node-gyp\@0.10.10
> gyp info using node\@0.10.18 | linux | x64
> gyp ERR! configure error
> gyp ERR! stack Error: Command failed: python: error while loading shared
> libraries: *libpython2.7.so.1.0*: cannot open shared object file: No
> such file or directory

>
> *But when I run python alone it loads the shared lib just fine:*
> ~/examples/node.js/my_node_addon-1[13:14]% python -V
> Python 2.7.3

No, the shared libraries come in a python-dev package, not the regular
executables.

Search the development libraries for python, install them and you will
not have this issue anymore.


--
Jose Luis Rivas
http://joseluisrivas.net/

deng....@gmail.com

unread,
Sep 17, 2013, 5:17:08 PM9/17/13
to nod...@googlegroups.com
Thanks Jose. 

But I built the python from source and had a customized installation. And libpython2.7.so.1.0 is presented in the following:$PYTHONPATH as well as $LD_LIBRARY_PATH. Does node or node-gyp search a rather different environment virable for shared libraries?

I also specifed the binding.gyp as below, but it seems still not picking up.

{
    'targets': [
        {
            'target_name': 'hello',
            'sources': [ 'src/hello.cc' ],
            'include_dirs': ['/path/to/my/include'],
            'link_settings': {
                'library_dirs': [
                    '/path/to/my/libpython2.7.so.1.0'
                ]
            }
        }
    ]
}
 

Feng

deng....@gmail.com

unread,
Sep 19, 2013, 8:47:17 AM9/19/13
to nod...@googlegroups.com
Hi group-
Finally, after 2 days of consecutive tracing and debugging, I had this sorted. However, I am not sure if this is due to my customized installation of Python. I updated the code below in ~node_modules/node-gyp/lib/configure.js (changed original as in commented line 93 to 94:

93     // var env = { TERM: 'dumb', PATH: process.env.PATH};
94     var env = process.env

I will truly appreciate if any node.js experts in the group can help with a rational with the above change?

Thanks again
Feng

Nathan Rajlich

unread,
Mar 4, 2014, 5:55:08 PM3/4/14
to nod...@googlegroups.com
v0.13.0 of node-gyp should have this fixed. Thanks for reporting!
Reply all
Reply to author
Forward
0 new messages