VOGONS


First post, by superfury

User metadata
Rank l33t++
Rank
l33t++

I'm trying to get SDL2 running and compiling for UniPCemu 64-bit versions, but I keep having troubles with the setup.

I've downloaded the main MinGW-w64 files archive (mingw-w64-bin_i686-mingw_20111220.zip), MSYS-20111123.zip and SDL2-2.0.5, then extracted the MinGW-w64 files to a folder in the root of my hard disk (Z:\MinGW64). Then I extracted the MSys archive in the same folder. Finally I opened the MSys.bat and executed the command "mount Z:\MinGW /mingw" and closed the window.

Then I extracted the SDL2-2.0.5.zip into the Z:\MinGW64\Z:\MinGW64\msys\home\<Username here>.

I opened the MSys.bat again, cd-ing into the SDL2-2.0.5 directory. I execute "./configure --host=x86_64-w64-mingw32"(without quotes). The configuration succeeds.

Finally, I execute "make", but it finally fails building SDL 2.0.5 with the following error:

/bin/sh build-scripts/updaterev.sh
CC build/SDL_windowsvideo.lo
src/video/windows/SDL_windowsvideo.c:231:18: fatal error: d3d9.h: No such file or directory
compilation terminated.
make: *** [build/SDL_windowsvideo.lo] Error 1

It seems it's missing some "d3d9" header, but shouldn't it be included in the MinGW-w64 package by default?

Btw I have another MinGW(32-bit)+Msys configuration installed at Z:\MinGW for 32-bit compilation(But, since it's a different installation, it shouldn't interfere?).

Author of the UniPCemu emulator.
UniPCemu Git repository
UniPCemu for Android, Windows, PSP, Vita and Switch on itch.io

Reply 1 of 6, by superfury

User metadata
Rank l33t++
Rank
l33t++

It compiles without problems within Visual Studio Community 2015. But for some reason, both MinGW 32-bits(SDL_winmm.c various errors) and MinGW 64-bits(Given in the previous post) fail to compile.

I've called ./configure --prefix=/mingw before calling make, but it still won't compile, not even on 32-bit MinGW:

  CC     build/SDL_winmm.lo
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 something 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 something 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 something 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 something 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

Anyone knows what might cause all these problems with MinGW?

Author of the UniPCemu emulator.
UniPCemu Git repository
UniPCemu for Android, Windows, PSP, Vita and Switch on itch.io

Reply 2 of 6, by Kisai

User metadata
Rank Member
Rank
Member
superfury wrote:
It compiles without problems within Visual Studio Community 2015. But for some reason, both MinGW 32-bits(SDL_winmm.c various er […]
Show full quote

It compiles without problems within Visual Studio Community 2015. But for some reason, both MinGW 32-bits(SDL_winmm.c various errors) and MinGW 64-bits(Given in the previous post) fail to compile.

I've called ./configure --prefix=/mingw before calling make, but it still won't compile, not even on 32-bit MinGW:

  CC     build/SDL_winmm.lo
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 something 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 something 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 something 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 something 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

Anyone knows what might cause all these problems with MinGW?

Looks like you need newer headers.

Find all "WAVEOUTCAPS2W", Subfolders, Find Results 1, "Visual C++ Include Directories", ""
C:\Program Files (x86)\Windows Kits\8.1\Include\um\mmeapi.h(154):typedef struct tagWAVEOUTCAPS2W {

typedef WAVEOUTCAPS2W WAVEOUTCAPS2;

Reply 3 of 6, by Dominus

User metadata
Rank DOSBox Moderator
Rank
DOSBox Moderator

The SDL2 development branch had some mingw fix applied the other day. I'd also recommend the SDL forum/mailinglist

Windows 3.1x guide for DOSBox
60 seconds guide to DOSBox
DOSBox SVN snapshot for macOS (10.4-11.x ppc/intel 32/64bit) notarized for gatekeeper

Reply 4 of 6, by superfury

User metadata
Rank l33t++
Rank
l33t++

The same problem occurs after updating all MinGW stuff to their latest revisions (according to the MinGW-get tool). It keeps complaining about the WAVEINCAPS macro.

Edit: I've placed the issue at libSDL.org's bug tracker.

Author of the UniPCemu emulator.
UniPCemu Git repository
UniPCemu for Android, Windows, PSP, Vita and Switch on itch.io

Reply 5 of 6, by superfury

User metadata
Rank l33t++
Rank
l33t++

The WAVEINCAPS problem is fixed by adding the definitions to the file right below the include in winmm.c.

The problem still left is that, for some reason (probably due to 64-bit integer operations) it links dynamically against LIBGCC_S_DW2-1.DLL, functions __divdi3 and __udivdi3. I've generated the Makefile using ./configure --prefix=/mingw, then opened the Makefile, replaceing the CFLAGS line with:

CFLAGS  = -enable-core-inline -static-libgcc -static-libstdc++  -DUSING_GENERATED_CONFIG_H

Then, calling Make, then Make install, the SDL2.dll still contains a reference to the libgcc_s_dw2-1.dll, no matter what I do? Is this a bug in the latest MinGW gcc compiler? Is there any way to not make it dynamically link that, and statically link that DLL instead?

No matter what I do, it keeps linking to that dll's __divdi3 and __udivdi3 functions, with seemingly no way to make it not link against it, or statically link against it. This only happens when building the 32-bit SDL2 DLL, not the 64-bit one.

Edit: Using my old build (gcc 4.8.X) also generates that strange linkage for some reason. SDL 2.0.3 won't even compile due to some missing winapifamily.h header. Applying the latest SDL_platform.h resolves this issue. Now it complains about a dxgi.h, which doesn't exist in my MinGW toolkit for windows?

Author of the UniPCemu emulator.
UniPCemu Git repository
UniPCemu for Android, Windows, PSP, Vita and Switch on itch.io

Reply 6 of 6, by Wohlstand

User metadata
Rank Newbie
Rank
Newbie

Why not to take fresh assembly from hg.libsdl.org ? There are fixed all those bugs, and it must be built fine on MinGW-w64. (however, there are has tiny bug requires workaround with mmsys module because MinGW's (non w64, original MinGW) mmsys.h has some missing WinAPI structure declarations)