在Windows PC上使用MinGW32
我試圖編譯pySpotify。第一個錯誤是libspotify/api.h
丟失。我固定這通過從libspotify複製適當的文件夾到C:\MinGW\include
。但是現在dllwrap
現在與ld linking.
失敗Spotify
分發的二進制文件libspotify.dll
和libspotify.lib.
無論身在何處我把他們(pySpotify文件夾/子文件夾,臨時build文件夾/子文件夾和MinGW文件夾/子文件夾)還是什麼我他們的名字(.A ,.o & .so) it 仍顯示相同的錯誤消息。在MinGW32中使用libspotify .dll/.lib文件編譯pySpotify
相關的錯誤是:
C:\MinGW\bin\dllwrap.exe -mdll -static --output-lib build\temp.win32-2.7\Release\src\lib_spotify.a --def build\temp.win32-2.7\Release\src\_spotify.def -s build\temp.win32-2.7\Release\src\module.o build\temp.win32-2.7\Release\src\session.o build\temp.win32-2.7\Release\src\link.o build\temp.win32-2.7\Release\src\track.obuild\temp.win32-2.7\Release\src\album.o build\temp.win32-2.7\Release\src\albumbrowser.o build\temp.win32-2.7\Release\src\artist.o build\temp.win32-2.7\Release\src\artistbrowser.o build\temp.win32-2.7\Release\src\search.o build\temp.win32-2.7\Release\src\playlist.o build\temp.win32-2.7\Release\src\playlistcontainer.o build\temp.win32-2.7\Release\src\playlistfolder.o build\temp.win32-2.7\Release\src\image.o build\temp.win32-2.7\Release\src\user.o build\temp.win32-2.7\Release\src\pyspotify.o build\temp.win32-2.7\Release\src\toplistbrowser.o -LC:\Python26\libs -LC:\Python26\PCbuild -lspotify -lpython26 -lmsvcr90 -o build\lib.win32-2.7\spotify\_spotify.pyd
c:/mingw/bin/../lib/gcc/mingw32/4.7.2/../../../../mingw32/bin/ld.exe: cannot find -lspotify
collect2.exe: error: ld returned 1 exit status
dllwrap: gcc exited with status 1
error: command 'dllwrap' failed with exit status 1
您需要添加API標題中包含路徑(添加類似-I〜\ libspotify \包括您編譯器選項)和庫路徑中的共享庫(將-L〜\ libspotify \ lib添加到鏈接器選項中)。這將允許編譯器找到必要的包含文件,並使您的鏈接器找到必要的二進制對象。
然而distutils
擴展類似乎被棄用,很難找到文檔(我相信這是在自定義的編譯器選項需要去)。欣賞~
可能需要更改爲%USERPROFILE%
或類似。同樣%PYTHONPATH%\Lib\distutils\distutils.cfg
在[build]
compiler=mingw32
節以外幾乎沒有文檔。這使得編譯compile/link命令及其選項無法改變。
如何在Windows上編譯pySpotify?
編輯:
通過使用Python 2.6和複製libspotify.dll/libspotify.lib到C:\ Python26 \ PCbuild和重命名他們spotify.dll/libspotify.lib我現在得到另一個錯誤信息from ld:
C:\MinGW\bin\dllwrap.exe -mdll -static --output-lib build\temp.win32-2.6\Release\src\lib_spotify.a --def build\temp.win32-2.6\Release\src\_spotify.def -s build\temp.win32-2.6\Release\src\module.o build\temp.win32-2.6\Release\src\session.o build\temp.win32-2.6\Release\src\link.o build\temp.win32-2.6\Release\src\track.obuild\temp.win32-2.6\Release\src\album.o build\temp.win32-2.6\Release\src\albumbrowser.o build\temp.win32-2.6\Release\src\artist.o build\temp.win32-2.6\Release\src\artistbrowser.o build\temp.win32-2.6\Release\src\search.o build\temp.win32-2.6\Release\src\playlist.o build\temp.win32-2.6\Release\src\playlistcontainer.o build\temp.win32-2.6\Release\src\playlistfolder.o build\temp.win32-2.6\Release\src\image.o build\temp.win32-2.6\Release\src\user.o build\temp.win32-2.6\Release\src\pyspotify.o build\temp.win32-2.6\Release\src\toplistbrowser.o -LC:\Python26\libs -LC:\Python26\PCbuild -lspotify -lpython26 -lmsvcr90 -o build\lib.win32-2.6\spotify\_spotify.pyd
_spotify.exp: file not recognized: File format not recognized
collect2.exe: error: ld returned 1 exit status
dllwrap: gcc exited with status 1
error: command 'dllwrap' failed with exit status 1
也許mingw的ld沒有正確讀取絕對路徑?也就是說,嘗試移動libspotify到一個相對的位置,看看這是否沒有幫助。 –
嗨尼克,感謝您的建議 - 但我已經試過複製到每個文件夾/子文件夾,我可以找到無濟於事:「無論我把它們放在哪裏(pySpotify文件夾/子文件夾,臨時構建文件夾/子文件夾和MinGW文件夾/子文件夾)「。 – Metalshark