Closed DrFunk closed 9 years ago
have you installed libspotify, the log clearly says that the spotify header files were not found.
...
src/module.c28: libspotify/api.h: No such file or directory
...
@aish9r is right; most of the errors I see in the log are cause by the missing declaration of libspotify API structs.
Anyway, I do not have tried to compile on Windows yet. The code is mostly written with portability in mind, but there will be surely a few quirks to resolve before it works flawlessly.
Hey!
Thanks for your answers =)
I tried adding ~\libspotify\include
to my path, as well as ~\libspotify\lib
and I still have the error.
I also tried to copy the ~\libspotify\include\libspotify
directory in the ~\mopidy-pyspotify-3d62577\src
, so libspotify/api.h
is found when compiling. But I then get another error when linking. Here's a snippet of the log below. I guess it's because the lib cannot be found but it's strange because it's in the path now... Maybe a path separator problem ("\" vs "/") ?
C:\MinGW\bin\dllwrap.exe -mno-cygwin -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.o build\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:\Python27\libs -LC:\Python27\PCbuild -lspotify -lpython27 -lmsvcr90 -o build\lib.win32-2.7\spotify\_spotify.pyd
C:\MinGW\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\..\mingw32\bin\ld.exe: cannot find -lspotify
collect2: 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.
I have started a bounty for this on StackOverflow: http://stackoverflow.com/q/13867498/179454
Was this issue ever resolved? I am having the same problem.
I've just tried to compile in Win8. I've gotten pretty far, but now I'm stuck on the missing libgen.h and unistd.h files. These do not exists in Windows, and haven't been ported either.
A couple of other Open Source projects I found in my search of these files, actively tells their developers to refrain from using them, because of cross-platform issues.
Would be awesome if this was fixed - even for my old XP system ;-)
Here are some Instructions on how to install pyspotify on Windows 8, I've done this on two different computers and its worked both times without issue.
Install Python 2.7 32bit
Install setuptools for Python 2.7 32bit http://www.lfd.uci.edu/~gohlke/pythonlibs/#setuptools
Install pip for Python 2.7 32bit http://www.lfd.uci.edu/~gohlke/pythonlibs/#pip
Install PyAudio for Python 2.7 32bit http://www.lfd.uci.edu/~gohlke/pythonlibs/#pyaudio
Install MinGW http://sourceforge.net/projects/mingw/ (Select the base package when asked)
Add the Scripts folder for your python install and the bin folder for you MinGW install and add both of their locations to the path variable. For me this was C:\Python27\Scripts\
and C:\MinGW\bin\
Then Edit or Create the file in your python install at C:\Python27\Lib\distutils\distutils.cfg
distutils.cfg should have the 2 lines below as its content
[build]
compiler=mingw32
Now we need to take out -mno-cygwin
flag from C:\Python27\Lib\distutils\cygwincompiler.py
It should start around line 326 after you edit the snippet it should look like
self.set_executables(compiler='gcc -O -Wall',
compiler_so='gcc -mdll -O -Wall',
compiler_cxx='g++ -O -Wall',
linker_exe='gcc',
linker_so='%s %s %s'
% (self.linker_dll, shared_option,
entry_point))
Take libspotify.lib
that you got from spotify.com and rename it to spotify.lib
then move it to C:\Python27\libs
Then take the libspotify
folder under include
in the libspotify package and move it to C:\MinGW\include\
then type in cmd pip install -U pyspotify
If you have any questions just shoot me an email at Jacob.Durman@gmail.com
Awesome!
I guess I got it working: Successfully installed pyspotify Cleaning up...
I was hoping to get Spotify going on Plex on my Windows XP - but it seems I need to do some more... At least this is a good start ;-)
Edit: I wonder if the build itself really works... I removed self.dll_libraries = get_msvcr() from cygwincompiler.py (kind of mentioned http://bugs.python.org/issue16472) Then pyspotify is at least possible to load in Plex - but it crashes when calling spotify.Session.create(self, self.settings)
I also tried the Jukebox (to see if it was plex related) - python crashes instead. So suggestion above doesn't seem to work for me at least.
Here's the output from the crash report (Dr Watson) running jukebox - not sure if I can make the information more informative in anyway - I don't know much about Windows development... Any Help would be appreciated.
*** ERROR: Symbol file could not be found. Defaulted to export symbols for C:\Python27\lib\site-packages\spotify\libspotify.dll -
function: libspotify!sp_session_create
01f7d64d ff53e8 call dword ptr [ebx-0x18]
01f7d650 21e6 and esi,esp
01f7d652 0200 add al,[eax]
01f7d654 83c404 add esp,0x4
01f7d657 bf02000000 mov edi,0x2
01f7d65c 53 push ebx
01f7d65d e82ef1ffff call libspotify+0xdc790 (01f7c790)
01f7d662 53 push ebx
01f7d663 e80de60200 call libspotify+0x10bc75 (01fabc75)
01f7d668 83c404 add esp,0x4
FAULT ->01f7d66b 8b9bc0010000 mov ebx,[ebx+0x1c0] ds:0023:000001c0=????????
01f7d671 85db test ebx,ebx
01f7d673 7409 jz libspotify!sp_session_create+0x2ee (01f7d67e)
01f7d675 53 push ebx
01f7d676 e8fae50200 call libspotify+0x10bc75 (01fabc75)
01f7d67b 83c404 add esp,0x4
01f7d67e 57 push edi
01f7d67f e8fc1df8ff call libspotify+0x5f480 (01eff480)
01f7d684 83c404 add esp,0x4
01f7d687 8bc7 mov eax,edi
01f7d689 5f pop edi
Just a note to self: This may be a useful resource for building C exts on Windows: http://www.wireshark.org/docs/wsdg_html_chunked/ChToolsMSChain.html
Due to the imminent release of the 2.0 rewrite of pyspotify, compilation of pyspotify 1.x on Windows will probably never be documented/supported. I'm closing this issue.
Feel free to open a new issue to discuss how to compile pyspotify 2 on Windows.
Hi!
I tried compiling on WinXP and ran into several problems I thought you'd like to know. First, compilation does not work for me with the latest version of gcc (the option '-mno-cygwin' is no longer supported). Then I tried to downgrade to gcc 3.4.5 but I got compilation errors (log below). Apparently PyObject_HEAD is not recognized, although we do have #include at the beginning of module.c
Do you have any idea on how to fix this or is there something stupid I'm missing?
Thanks in advance!
Compilation log: