2014-02-25 145 views
1

我正在嘗試運行spotify示例。我已經完全編譯了它們,但是我什麼都不能運行。當做./jukebox.o它只是說「不能執行二進制文件」。我如何運行這些示例?運行libspotify示例

這是我得到時,我的確讓:

libspotify /例子$使LIBSPOTIFY_PATH = ../../../.. 了在點唱機spshell localfiles;做成-C $ a LIBSPOTIFY_PATH =「/ home/alexander/slask/libspotify-12.1.51-Linux-x86_64-release」all;完成 make [1]:進入目錄/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 '[email protected]@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]:進入目錄/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 '[email protected]@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]:進入目錄/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'

+0

您正在使用什麼操作系統,以及您如何構建示例? 「jukebox.o」聽起來像一個目標文件,而不是一個可執行文件,所以你可能已經編譯了它,但沒有鏈接它。 – Weeble

+0

我使用Makefile編譯它。運行Ubuntu 64bit。 – AlexanderNajafi

回答

0

您必須使該文件成爲可執行文件。

嘗試搭配chmod U + X jukebox.o,如果不工作,你應該嘗試編譯它像GCC jukebox.c -o點唱機

0

在Linux上,你已經成功運行了生成文件後,你的共享/ DOC/libspotify /例子/點唱機目錄應該是這樣的:

[email protected]:~/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 

可執行文件是一個名爲 「jukebox」。所以運行「./jukebox/jukebox」。如果該文件不存在,則構建過程可能失敗。當您運行「make」時是否有任何消息或警告?

+0

謝謝。我沒有收到點唱機文件。我用我運行make時得到的消息解決了這個問題。 – AlexanderNajafi

3

我在64位Ubuntu上有類似的問題。在examples/common.mk中編輯LDLIBS行如下所示:

LDLIBS += -lspotify -lpthread -ldl 
+0

這固定在我的archlinux x86_64框上。 –