1

I am trying to run the spotify examples. I have sucecsfully compiled them but I cannot run anything. When i.e. do ./jukebox.o it just says "cannot execute binary file". How do I run the examples?

This is what I got when i did make:

libspotify/examples$ make LIBSPOTIFY_PATH=../../../.. for a in jukebox spshell localfiles; do make -C $a LIBSPOTIFY_PATH="/home/alexander/slask/libspotify-12.1.51-Linux-x86_64-release" all; done make[1]: Entering directory /home/alexander/slask/libspotify-12.1.51-Linux-x86_64-release/share/doc/libspotify/examples/jukebox' cc -I/usr/include/alsa -I/home/alexander/slask/libspotify-12.1.51-Linux-x86_64-release/include -Wall -Wl,-rpath,/home/alexander/slask/libspotify-12.1.51-Linux-x86_64-release/lib -L/home/alexander/slask/libspotify-12.1.51-Linux-x86_64-release/lib jukebox.o appkey.o alsa-audio.o audio.o -o jukebox -lasound -lspotify /usr/bin/ld: alsa-audio.o: undefined reference to symbol 'pthread_create@@GLIBC_2.2.5' /lib/x86_64-linux-gnu/libpthread.so.0: error adding symbols: DSO missing from command line collect2: error: ld returned 1 exit status make[1]: *** [jukebox] Error 1 make[1]: Leaving directory/home/alexander/slask/libspotify-12.1.51-Linux-x86_64-release/share/doc/libspotify/examples/jukebox' make[1]: Entering directory /home/alexander/slask/libspotify-12.1.51-Linux-x86_64-release/share/doc/libspotify/examples/spshell' cc -I/home/alexander/slask/libspotify-12.1.51-Linux-x86_64-release/include -Wall -Wl,-rpath,/home/alexander/slask/libspotify-12.1.51-Linux-x86_64-release/lib -L/home/alexander/slask/libspotify-12.1.51-Linux-x86_64-release/lib spshell.o spshell_posix.o appkey.o cmd.o browse.o search.o toplist.o inbox.o star.o playlist.o test.o -lreadline -lspotify -o spshell /usr/bin/ld: spshell_posix.o: undefined reference to symbol 'pthread_create@@GLIBC_2.2.5' /lib/x86_64-linux-gnu/libpthread.so.0: error adding symbols: DSO missing from command line collect2: error: ld returned 1 exit status make[1]: *** [spshell] Error 1 make[1]: Leaving directory/home/alexander/slask/libspotify-12.1.51-Linux-x86_64-release/share/doc/libspotify/examples/spshell' make[1]: Entering directory /home/alexander/slask/libspotify-12.1.51-Linux-x86_64-release/share/doc/libspotify/examples/localfiles' make[1]: Leaving directory/home/alexander/slask/libspotify-12.1.51-Linux-x86_64-release/share/doc/libspotify/examples/localfiles'

AlexanderNajafi
  • 1,631
  • 2
  • 25
  • 39
  • What operating system are you using, and how did you go about building the examples? "jukebox.o" sounds like an object file, not an executable, so it's possible you've compiled it but not linked it. – Weeble Feb 25 '14 at 22:53
  • I compiled it using the Makefile. Running Ubuntu 64bit. – AlexanderNajafi Feb 26 '14 at 07:03

3 Answers3

3

I had a similar problem on 64-Bit Ubuntu. Edit the LDLIBS line in examples/common.mk to read as follows

LDLIBS  += -lspotify -lpthread -ldl
0

You have to make the file executable.

Try chmod u+x jukebox.o and if that doesn't work, you should try compiling it like gcc jukebox.c -o jukebox

0

On Linux, after you've successfully run the makefile, your share/doc/libspotify/examples/jukebox directory should look like this:

weeble@mylaptop:~/prj/libspotify/libspotify-12.1.51-Linux-i686-release/share/doc/libspotify/examples$ ls -l jukebox/
total 140
-rw-r--r-- 1 weeble weeble  5588 Jun 13  2012 alsa-audio.c
-rw-r--r-- 1 weeble weeble  5392 Feb 26 09:25 alsa-audio.o
-rw-r--r-- 1 weeble weeble   856 Feb 26 09:26 appkey.o
-rw-r--r-- 1 weeble weeble  1840 Jun 13  2012 audio.c
-rw-r--r-- 1 weeble weeble  1828 Jun 13  2012 audio.h
-rw-r--r-- 1 weeble weeble  1400 Feb 26 09:25 audio.o
-rw-r--r-- 1 weeble weeble  1718 Jun 13  2012 dummy-audio.c
-rwxr-xr-x 1 weeble weeble 21865 Feb 26 09:26 jukebox
-rw-r--r-- 1 weeble weeble 15156 Jun 13  2012 jukebox.c
-rw-r--r-- 1 weeble weeble  9116 Feb 26 09:19 jukebox.o
-rw-r--r-- 1 weeble weeble  1051 Jun 13  2012 Makefile
-rw-r--r-- 1 weeble weeble  4469 Jun 13  2012 openal-audio.c
drwxr-xr-x 3 weeble weeble  4096 Jun 13  2012 osx
-rw-r--r-- 1 weeble weeble  3378 Jun 13  2012 osx-audio.c
-rw-r--r-- 1 weeble weeble  8860 Jun 13  2012 playtrack.c
-rw-r--r-- 1 weeble weeble 18990 Jun 13  2012 queue.h

The executable file is the one called "jukebox". So run "./jukebox/jukebox". If that file isn't there, perhaps the build process failed. Were there any messages or warnings when you ran "make"?

Weeble
  • 17,058
  • 3
  • 60
  • 75