Floby / node-libspotify

Node bindings for the libspotify C library
projects.flo.by/node-libspotify/
102 stars 66 forks source link

problems with compiling during npm install #19

Closed tonyd256 closed 11 years ago

tonyd256 commented 11 years ago

I'm trying to setup a nodejs server with libspotify on a raspberrypi. I have libspotify v12.1.103beta installed to work with the hard float version of Raspbian (latest). I ran 'make install' in libspotify then tried to run 'npm install' on my project to compile node-libspotify and I get this error:

libspotify@0.2.1 install /home/pi/app/node_modules/libspotify node-gyp configure build

make: Entering directory /home/pi/app/node_modules/libspotify/build' CXX(target) Release/obj.target/libspotify/src/album.o CXX(target) Release/obj.target/libspotify/src/artist.o CXX(target) Release/obj.target/libspotify/src/audio.o CXX(target) Release/obj.target/libspotify/src/binding.o CXX(target) Release/obj.target/libspotify/src/link.o ../src/playlistcallbacks.cc:105:39: warning: ‘nsp_playlistcontainer_callbacks’ defined but not used [-Wunused-variable] CXX(target) Release/obj.target/libspotify/src/player.o CXX(target) Release/obj.target/libspotify/src/search.o CXX(target) Release/obj.target/libspotify/src/session.o ../src/session.cc:290:1: error: invalid conversion from ‘void (*)(sp_session*, sp_error)’ to ‘void (*)(sp_session*)’ [-fpermissive] ../src/session.cc:290:1: error: invalid conversion from ‘void (*)(sp_session*, bool)’ to ‘void (*)(sp_session*, sp_error)’ [-fpermissive] ../src/session.cc:290:1: warning: missing initializer for member ‘sp_session_callbacks::private_session_mode_changed’ [-Wmissing-field-initializers] ../src/playlistcallbacks.cc:234:30: warning: ‘nsp_playlist_callbacks’ defined but not used [-Wunused-variable] make: *** [Release/obj.target/libspotify/src/session.o] Error 1 make: Leaving directory/home/pi/app/node_modules/libspotify/build' gyp ERR! build error gyp ERR! stack Error: make failed with exit code: 2 gyp ERR! stack at ChildProcess.onExit (/opt/node/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:267:23) gyp ERR! stack at ChildProcess.EventEmitter.emit (events.js:98:17) gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:789:12) gyp ERR! System Linux 3.6.11+ gyp ERR! command "node" "/opt/node/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "build" gyp ERR! cwd /home/pi/app/node_modules/libspotify gyp ERR! node -v v0.10.11 gyp ERR! node-gyp -v v0.10.0 gyp ERR! not ok npm ERR! weird error 1 npm ERR! not ok code 0

There isn't any documentation about version 12.1.103 libspotify so I'm having trouble figuring out whats wrong. Thought you might be able to figure it out.

tonyd256 commented 11 years ago

I was able to fix it. A new callback was needed for a change made in the 103 version. You can see the fix here: https://github.com/tonyd256/node-libspotify/tree/libspotify-12.1.103

If you create a feature branch (I called mine libspotify-12.1.103) I will create a pull request for my changes to that branch. This way libspotify for the older version will still work but if someone is using 103 they can add the npm dependency with the git url as follows:

package.json:

"dependencies": { "libspotify": "git://github.com/tonyd256/node-libspotify.git#libspotify-12.1.103" }

where your username will be in place of mine once the pull request is approved

Floby commented 11 years ago

Thanks for the fix. You should discuss RPi problems with @IainCole who has his own fork of this project I believe. libspotify 12.1.51 is still the standard version for most platforms so this won't go to master until 12.1.103 or better is published for all platforms.

I'm happy to make a feature branch for it and further fix for that version. It's at lib-v12.1.103