Floby / node-libspotify

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

npm install OSX Mountain Lion fails #34

Closed ls12styler closed 11 years ago

ls12styler commented 11 years ago

Hi,

I don't know if I'm doing something wrong, but running npm install after cloning fails. The output I get is as follows:

node-libspotify git:(master)# npm install                                                                                                                                                        [3/314]

> libspotify@0.2.2 install /Users/me/Github/node-libspotify
> node-gyp configure build

  SOLINK_MODULE(target) Release/spotify.node
ld: library not found for -lspotify
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [Release/spotify.node] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:256:23)
gyp ERR! stack     at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:754:12)
gyp ERR! System Darwin 12.2.0
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "build"
gyp ERR! cwd /Users/me/Github/node-libspotify
gyp ERR! node -v v0.10.0
gyp ERR! node-gyp -v v0.8.5
gyp ERR! not ok
npm ERR! libspotify@0.2.2 install: `node-gyp configure build`
npm ERR! `sh "-c" "node-gyp configure build"` failed with 1
npm ERR!
npm ERR! Failed at the libspotify@0.2.2 install script.
npm ERR! This is most likely a problem with the libspotify package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp configure build
npm ERR! You can get their info via:
npm ERR!     npm owner ls libspotify
npm ERR! There is likely additional logging output above.

npm ERR! System Darwin 12.2.0
npm ERR! command "/usr/local/bin/node" "/usr/local/bin/npm" "install"
npm ERR! cwd /Users/me/Github/node-libspotify
npm ERR! node -v v0.10.0
npm ERR! npm -v 1.2.14
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR!     /Users/me/Github/node-libspotify/npm-debug.log
npm ERR! not ok code 0

I'm guessing the error is "ld: library not found for -lspotify". However, I don't quite know what means. And I thought I'd managed to get libspotify installed. Could someone please inform me how check if it is?

Thanks

Floby commented 11 years ago

Hello, the error seems to appear with your linker (which seems to be ld). I have never built this library on MacOS (or never anything else for that matter) so I won't be of much help. Make sure you installed the right libspotify version and installed it system-wide. If you just installed it, maybe your linker must update its cache. On my Ubuntu it's done with running ldconfig, you could try that.

If you find a way to make installation of this module seamless on MacOS, please let me know so that I can include it.

I have plan to make npm install download this in the future and link locally, but I'm not there yet.

ls12styler commented 11 years ago

It seems that installing libspotify via homebrew solved the above problem. It installed the latest version too! So I would recommend that for any users attempting to install on OS X.

After trying to run npm install again, everything seemed to be OK, however I got some warnings generated:

*snip*
npm http 304 https://registry.npmjs.org/uglify-js

> libspotify@0.2.2 install /Users/me/Github/node-libspotify
> node-gyp configure 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
In file included from ../src/link.cc:21:
../src/playlistcallbacks.cc:105:39: warning: unused variable 'nsp_playlistcontainer_callbacks' [-Wunused-variable]
static sp_playlistcontainer_callbacks nsp_playlistcontainer_callbacks = {
                                      ^
1 warning generated.
  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
In file included from ../src/session.cc:20:
../src/playlistcallbacks.cc:234:30: warning: unused variable 'nsp_playlist_callbacks' [-Wunused-variable]
static sp_playlist_callbacks nsp_playlist_callbacks = {
                             ^
1 warning generated.
  CXX(target) Release/obj.target/libspotify/src/track.o
  CXX(target) Release/obj.target/libspotify/src/playlist.o
In file included from ../src/playlist.cc:20:
../src/playlistcallbacks.cc:105:39: warning: unused variable 'nsp_playlistcontainer_callbacks' [-Wunused-variable]
static sp_playlistcontainer_callbacks nsp_playlistcontainer_callbacks = {
                                      ^
1 warning generated.
  SOLINK_MODULE(target) Release/spotify.node
  SOLINK_MODULE(target) Release/spotify.node: Finished
bindings@1.1.1 node_modules/bindings

format@0.1.4 node_modules/format

colors@0.6.2 node_modules/colors

i@0.3.2 node_modules/i

backoff@2.0.0 node_modules/backoff

trycatch@0.2.13 node_modules/trycatch
├── hookit@0.0.5
└── colors@0.5.1

nodeunit@0.7.4 node_modules/nodeunit
└── tap@0.4.4 (deep-equal@0.0.0, buffer-equal@0.0.0, slide@1.1.5, mkdirp@0.3.5, nopt@2.1.2, glob@3.2.6, difflet@0.2.6, runforcover@0.0.2)

Similar warnings are generated when running npm test, too, although tests seem to pass:

npm test

> libspotify@0.2.2 pretest /Users/me/Github/node-libspotify
> rm -rf /tmp/node-libspotify 2>/dev/null ; node-gyp clean >/dev/null && node-gyp configure --debug  >/dev/null && node-gyp build >/dev/null

In file included from ../src/link.cc:21:
../src/playlistcallbacks.cc:105:39: warning: unused variable 'nsp_playlistcontainer_callbacks' [-Wunused-variable]
static sp_playlistcontainer_callbacks nsp_playlistcontainer_callbacks = {
                                      ^
1 warning generated.
In file included from ../src/session.cc:20:
../src/playlistcallbacks.cc:234:30: warning: unused variable 'nsp_playlist_callbacks' [-Wunused-variable]
static sp_playlist_callbacks nsp_playlist_callbacks = {
                             ^
1 warning generated.
In file included from ../src/playlist.cc:20:
../src/playlistcallbacks.cc:105:39: warning: unused variable 'nsp_playlistcontainer_callbacks' [-Wunused-variable]
static sp_playlistcontainer_callbacks nsp_playlistcontainer_callbacks = {
                                      ^
1 warning generated.

> libspotify@0.2.2 test /Users/me/Github/node-libspotify
> nodeunit test/test-*

test-000-config.js
✔ testInstanciatingSessionWithNoArgumentThrows
Floby commented 11 years ago

yes, these are the exact same warnings because npm test rebuilds the binary addon in debug mode. These are benine warnings (unsuned variables) but they should be addressed soon.

Please let me know how node-libspotify goes on MacOS. =)

ls12styler commented 11 years ago

Ah ok - thanks.

I'm sure I'll keep you updated on how it's going!

TiernanKennedy commented 10 years ago

@Floby I am getting the same warnings when I try to push to Heroku (NB for my personal use - I'm aware that it uses my personal Spotify Key etc).

Do you know why? I'm new to Node and webDev so maybe this is a basic environments question. Appreciate any feedback!

Floby commented 10 years ago

You need to get the actual library from https://developer.spotify.com/technologies/libspotify/ and install it on your machine. Hopefully it should be as simple as

tar xzf <downloaded-tarball>
cd libspotify
./configure
sudo make install

On 9 January 2014 16:42, Tiernan Kennedy notifications@github.com wrote:

@Floby https://github.com/Floby I am getting the same warnings when I try to push to Heroku (NB for my personal use - I'm aware that it uses my personal Spotify Key etc).

Do you know why? I'm new to Node and webDev so maybe this is a basic environments question. Appreciate any feedback!

— Reply to this email directly or view it on GitHubhttps://github.com/Floby/node-libspotify/issues/34#issuecomment-31944013 .

TiernanKennedy commented 10 years ago

Hey thanks for the quick response - I can actually run the library on my local machine - it's when I push to Heroku to host remotely I have a problem.

I'm thinking that I need to install Libspotify on the remote server?

Floby commented 10 years ago

You're absolutely right. Along with your app key.

On 9 January 2014 17:05, Tiernan Kennedy notifications@github.com wrote:

Hey thanks for the quick response - I can actually run the library on my local machine - it's when I push to Heroku to host remotely I have a problem.

I'm thinking that I need to install Libspotify on the remote server?

— Reply to this email directly or view it on GitHubhttps://github.com/Floby/node-libspotify/issues/34#issuecomment-31946772 .

TiernanKennedy commented 10 years ago

OK thanks @Floby! If anyone has any insight on how to achieve that on Heroku I'm all ears!

I'll report back if I find anything

ls12styler commented 10 years ago

I'm not familiar with heroku. However, it seems to be just a virtual server provider?

If so, do you have CLI access?

TiernanKennedy commented 10 years ago

Yeah @ls12styler exactly - it's handles Rails & Node apps pretty well with minimum setup.

From what I can tell there is some CLI access: https://devcenter.heroku.com/categories/command-line