在Windows PC上使用MinGW32
,我正试图编译pySpotify。第一个错误是丢失了libspotify/api.h
。通过将适当的文件夹从libspotify复制到C:\MinGW\include
,我修复了这个问题。但是现在dllwrap
失败了,ld linking.
二进制文件{
相关误差为:
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
You need to add the API headers in the include path (add something like -I~\libspotify\include to your compiler options) and the shared library in the library path (add -L~\libspotify\lib to your linker options). This will allow the compiler to find the necessary include files, and your linker to find the necessary binary objects.
然而,distutils
扩展类似乎已被弃用,而且很难找到相关文档(我相信这是定制编译器选项需要用到的地方)。请注意,~
可能需要更改为%USERPROFILE%
或类似名称。类似地,%PYTHONPATH%\Lib\distutils\distutils.cfg
除了[build]
compiler=mingw32
节之外几乎没有文档。这使得编辑compile/link命令及其选项无法更改。在
如何在Windows上编译pySpotify?
编辑:
通过使用python2.6和复制libspotify.dll/libspotify将它们重命名为pythobuild\n26spotify.dll/libspotify.lib I现在从ld收到另一条错误消息:
^{pr2}$
由于目前无法访问mingw安装,我可以提出一些建议。在
首先,
ld
对参数的顺序很挑剔。奇怪的是,当我在google上搜索“ld参数顺序”时,我得到了一堆页面,表明顺序无关紧要,但我已经被这个问题烧坏了好几次。我最成功的方法是:ld
(即,-Wall
)-LPATH
)-lspotify
)我注意到在你的链接器输出中有一些对amd64的引用。我不确定您是如何编译其他对象文件的,但是由于libspotify在Windows上是32位的,我猜在这里混合使用32/64位不会太好。在
我想不出的最后一件事是,也许dll扩展名与
ld
混淆了,您是否尝试过将文件名改为libspotify.so
?我知道这有点冒险,但不然我不知道该如何帮助你。在我猜您是在尝试将64位版本的pyspotify与32位版本的libspotify链接起来。尝试重新构建pyspotify,在CFLAGS和cxflags中添加-m32
我已经添加了一些关于如何将它编译到实际发行票上的说明。告诉我这对你有没有帮助!在
{a1}
相关问题 更多 >
编程相关推荐