I tried to compile mpd for Windows using Cygwin. After adding some workarounds (add fake_getaddrinfo.h, check http://musicpd.org/mantis/view.php?id=1566) I was able to compile mpd. But when I tried to start it, mpd failed:
1 2 3 4 5 6 7 8 9 | $ ./mpd –no-daemon –stdout –verbose binding to any address flushing warning messages done flushing warning messages current locale is “C“ setting filesystem charset to ISO-8859–1 setFsCharset: fs charset is: ISO-8859–1 reading DB Bad system call |
Mpd uses shared memory – to use shared memory under Cygwin you need the cygserver running. A “$ cygserver-config” did the trick and installed a new service called cygserver. Now export the important variable CYGWIN:
1 | $ export CYGWIN=server |
And retry to start mpd:
1 2 3 4 5 6 7 8 9 | $ ./mpd.exe –stdout –verbose binding to any address flushing warning messages done flushing warning messages current locale is “C“ setting filesystem charset to ISO-8859–1 setFsCharset: fs charset is: ISO-8859–1 reading DB opening pid file 1 [main] mpd 1736 C:cygwinhomempxmpd-testmpd.exe: *** fatal error — MapViewOfFileEx (0x19030000), Win3 2 error 6. Terminating. 68 [main] mpd 676 fork: child 1736 — died waiting for dll loading, errno 11 problems fork’ing for daemon! |
The same error also occurs when you start mpd with the –no-daemon flag, use mpc and play a file.
1 2 3 4 5 6 7 8 9 10 11 | playlist: play 0:“Daft Punk/Daft Punk Alive 2007/7. Too Long.mp3” debug playerInit: 10 debug playerInit: 20 1 [main] mpd 1216 C:cygwinhomempxmpd-testmpd.exe: *** fatal error — MapViewOfFileEx (0x19030000), Win32 error 6. Terminating. 2 [main] mpd 2576 fork: child 1216 — died waiting for dll loading, errno 11 debug playerInit: 30 (pid: 0/-1) debug playerInit: 31 player Problems fork()‘ing playlist: stop |
I traced down the error in the file player.c, source:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | static int playerInit(void){ … LOG(” debug playerInit: 10n”); pid = player_pid; if (pid > 0) { kill(pid, SIGCONT); pc->wait = 0; return 0; } LOG(” debug playerInit: 20n”); player_pid = fork(); «CRASHLOG(” debug playerInit: 30 (pid: %i/%i)n”, pid, player_pid); blockSignals(); LOG(” debug playerInit: 31 n”); if (player_pid==0) … |
I checked my Windows event log:
The description for Event ID ( 0 ) in Source ( Cygwin ) cannot be found. The local computer may not have the necessary registry information or message DLL files to display messages from a remote computer. The following information is part of the event: cygserver: WARNING: Group not found in /etc/passwd! Using gid –1!.
And corrected this error (“$ mkgroup –l > /etc/group” and “$ mkpasswd –l > /etc/passwd”) – but mpd still refused to work. I updated Cygwin to the latest dev snapshot – still the same error. Looks like a Cygwin Bug to me.
** Edit (21.11.07): This Cygwin error has been fixed in the current Snapshot release (cygwin1-20071108.dll.bz2), so mpd runns fine under Windows… **

5 Comments
1 Adam wrote:
I’m confused about MPD under Cygwin. Is icecast required to get mp3 functionality? I’ve compiled and installed libmad and libid3tag but whenever I try to ./configure mpd it says that mp3 and id3 are disabled. Your example here doesn’t seem to include icecast. (Not that I can get icecast to compile, but that’s another can of worms…)
2 michu wrote:
> Is icecast required to get mp3 functionality:
no icecast is used to stream your songs..
try to use “./configure –help” and specify the library path.. did you install libmad and libid3tag?
3 Adam wrote:
Hi Michu.
I’m glad to hear that icecast isn’t required, since it doesn’t seem to be compilable under Cygwin (winsock2 issues).
I have downloaded and compiled the sources for libmad and libid3tag (libmad-0.15.1b, libid3tag-0.15.1b, and even madplay-0.15.2b). The resultant libraries were dropped in /usr/local/lib as part of the process (configure / make / make install).
I tried setting LDFLAGS to –L/usr/local/lib as suggested by ./configure –help. For whatever reason, the configuration script still refused to find the MAD and ID3TAG libs. There didn’t seem to be any command-line library helpers for mad and id3tag (no –with-mad-includes=DIR, like there are for lame, faad, etc.) so I’m a little stumped as to how to proceed.
Adam
4 Maarten wrote:
Hi Michu,
could you maybe send the executables you did get as a result?
I would like to play around a bit with seeing whether MPD at Windows will work like I would like to before I install a full cygwin installation.
kind regards,
Maarten
5 Stuben wrote:
Tried to compile both with gcc3 and gcc4.
Also tried to apply the fake_getaddrinfo patch manually to listen.c, it didn’t work.
Here’s the error:
src/listen.c: In function ‘listen_add_host’:
src/listen.c:224: error: storage size of ‘hints’ isn’t known
src/listen.c:232: error: ‘AI_PASSIVE’ undeclared (first use in this function)
src/listen.c:232: error: (Each undeclared identifier is reported only once
src/listen.c:232: error: for each function it appears in.)
src/listen.c:242: warning: implicit declaration of function ‘getaddrinfo’
src/listen.c:246: warning: implicit declaration of function ‘gai_strerror’
src/listen.c:246: warning: format ‘%s’ expects type ‘char *’, but argument 6 has
type ‘int’
src/listen.c:250: error: dereferencing pointer to incomplete type
src/listen.c:253: error: dereferencing pointer to incomplete type
src/listen.c:253: error: dereferencing pointer to incomplete type
src/listen.c:254: error: dereferencing pointer to incomplete type
src/listen.c:263: error: dereferencing pointer to incomplete type
src/listen.c:264: error: dereferencing pointer to incomplete type
src/listen.c:279: warning: implicit declaration of function ‘freeaddrinfo’
src/listen.c:224: warning: unused variable ‘hints’
src/listen.c: At top level:
/usr/include/asm/byteorder.h:36: warning: inline function ‘__constant_ntohs’ dec
lared but never defined
/usr/include/asm/byteorder.h:35: warning: inline function ‘__constant_ntohl’ dec
lared but never defined
make[1]: *** [src_mpd-listen.o] Error 1
make[1]: Leaving directory ‘/home/user/mpd-0.15.4′
make: *** [all] Error 2