We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 3482

Summary: Failed to build WinMM on MinGW+msys on Windows 7 (3d7cae208a0c)
Product: SDL Reporter: Vitaly Novichkov <admin>
Component: audioAssignee: Ryan C. Gordon <icculus>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: major    
Priority: P2 CC: admin, superfury
Version: HG 2.1   
Hardware: x86   
OS: Windows (All)   
Attachments: Workaround for the missing structures on the MinGW (non-w64)

Description Vitaly Novichkov 2016-11-08 11:04:42 UTC
When I tried to build latest SDL package since a5667285680d, it failed on SDL_winmm.c and can't find WAVEOUTCAPS2W structure.

======================================================================
src/audio/winmm/SDL_winmm.c: In function 'DetectWaveOutDevs':
src/audio/winmm/SDL_winmm.c:57:33: error: unknown type name 'WAVEOUTCAPS2W'
 DETECT_DEV_IMPL(SDL_FALSE, Out, WAVEOUTCAPS)
                                 ^
src/audio/winmm/SDL_winmm.c:44:5: note: in definition of macro 'DETECT_DEV_IMPL'

     capstyp##2W caps; \
     ^
src/audio/winmm/SDL_winmm.c:48:56: error: request for member 'szPname' in someth
ing not a structure or union
             char *name = WIN_LookupAudioDeviceName(caps.szPname,&caps.NameGuid)
; \
                                                        ^
src/audio/winmm/SDL_winmm.c:57:1: note: in expansion of macro 'DETECT_DEV_IMPL'
 DETECT_DEV_IMPL(SDL_FALSE, Out, WAVEOUTCAPS)
 ^
src/audio/winmm/SDL_winmm.c:48:70: error: request for member 'NameGuid' in somet
hing not a structure or union
             char *name = WIN_LookupAudioDeviceName(caps.szPname,&caps.NameGuid)
; \
                                                                      ^
src/audio/winmm/SDL_winmm.c:57:1: note: in expansion of macro 'DETECT_DEV_IMPL'
 DETECT_DEV_IMPL(SDL_FALSE, Out, WAVEOUTCAPS)
 ^
src/audio/winmm/SDL_winmm.c: In function 'DetectWaveInDevs':
src/audio/winmm/SDL_winmm.c:58:31: error: unknown type name 'WAVEINCAPS2W'
 DETECT_DEV_IMPL(SDL_TRUE, In, WAVEINCAPS)
                               ^
src/audio/winmm/SDL_winmm.c:44:5: note: in definition of macro 'DETECT_DEV_IMPL'

     capstyp##2W caps; \
     ^
src/audio/winmm/SDL_winmm.c:48:56: error: request for member 'szPname' in someth
ing not a structure or union
             char *name = WIN_LookupAudioDeviceName(caps.szPname,&caps.NameGuid)
; \
                                                        ^
src/audio/winmm/SDL_winmm.c:58:1: note: in expansion of macro 'DETECT_DEV_IMPL'
 DETECT_DEV_IMPL(SDL_TRUE, In, WAVEINCAPS)
 ^
src/audio/winmm/SDL_winmm.c:48:70: error: request for member 'NameGuid' in somet
hing not a structure or union
             char *name = WIN_LookupAudioDeviceName(caps.szPname,&caps.NameGuid)
; \
                                                                      ^
src/audio/winmm/SDL_winmm.c:58:1: note: in expansion of macro 'DETECT_DEV_IMPL'
 DETECT_DEV_IMPL(SDL_TRUE, In, WAVEINCAPS)
 ^
make: *** [build/SDL_winmm.lo] Error 1
======================================================================
Comment 1 Vitaly Novichkov 2016-11-08 12:56:22 UTC
My temporary workaround:
Just added manually declaration of missed structures after #include <mmsystem.h> (which are presented with MinGW-w64 but not in MinGW)

====================================================================
  typedef struct tagWAVEINCAPS2W {
    WORD wMid;
    WORD wPid;
    MMVERSION vDriverVersion;
    WCHAR szPname[MAXPNAMELEN];
    DWORD dwFormats;
    WORD wChannels;
    WORD wReserved1;
    GUID ManufacturerGuid;
    GUID ProductGuid;
    GUID NameGuid;
  } WAVEINCAPS2W,*PWAVEINCAPS2W,*NPWAVEINCAPS2W,*LPWAVEINCAPS2W;
  
    typedef struct tagWAVEOUTCAPS2W {
    WORD wMid;
    WORD wPid;
    MMVERSION vDriverVersion;
    WCHAR szPname[MAXPNAMELEN];
    DWORD dwFormats;
    WORD wChannels;
    WORD wReserved1;
    DWORD dwSupport;
    GUID ManufacturerGuid;
    GUID ProductGuid;
    GUID NameGuid;
  } WAVEOUTCAPS2W,*PWAVEOUTCAPS2W,*NPWAVEOUTCAPS2W,*LPWAVEOUTCAPS2W;
====================================================================
Comment 2 Vitaly Novichkov 2017-01-11 11:01:15 UTC
Created attachment 2675 [details]
Workaround for the missing structures on the MinGW (non-w64)

This workaround adds missing declarations for the WAVEOUTCAPS2W and WAVEINCAPS2W structures in the headers of the non-w64 MinGW (until there are will fix them in next versions).
Comment 3 Vitaly Novichkov 2017-01-18 20:22:14 UTC
About https://hg.libsdl.org/SDL/rev/7e06b0e4dbe0:
Huh? I wasn't hoped you will really accept this because of the fact of workaround... But okay, I'll try to build it now
Comment 4 Vitaly Novichkov 2017-02-15 09:47:26 UTC
Okay, seems this is no more problem. Still need to wait until MinGW folks will fix their bug (I think, it's time to report them about that)
Comment 5 Ryan C. Gordon 2017-05-24 04:39:18 UTC
(In reply to Vitaly Novichkov from comment #4)
> Okay, seems this is no more problem. Still need to wait until MinGW folks
> will fix their bug (I think, it's time to report them about that)

Yes, please do ask them to update their headers, but I think we're good here for now, so resolving this bug.

--ryan.
Comment 6 Ryan C. Gordon 2017-05-24 04:39:57 UTC
*** Bug 3500 has been marked as a duplicate of this bug. ***