Closed retorquere closed 3 years ago
I was trying to upgrade the PortAudio package of https://mxe.cc/, but I stumbled over the same error: https://github.com/mxe/mxe/pull/2631.
Any ideas how to fix this?
If you check the WASAPI source code file then you can find out that conflicting declarations comes from this section:
#ifdef WIN64
#include <wtypes.h>
#define FASTCALL
#include <oleidl.h>
#include <objidl.h>
#else
typedef struct _BYTE_BLOB
{
unsigned long clSize;
unsigned char abData[ 1 ];
} BYTE_BLOB;
typedef /* [unique] */ __RPC_unique_pointer BYTE_BLOB *UP_BYTE_BLOB;
typedef LONGLONG REFERENCE_TIME;
#define NONAMELESSUNION
#endif
BYTE_BLOB
declaration is needed to support the original MinGW32 32-bit compiler which is gcc version 6.3.0 (MinGW.org GCC-6.3.0-1)
. What I can propose is to add the check for the compiler version and exclude these additional declarations.
Would you please modify it to such way and check if source compiles correctly:
#ifdef WIN64
#include <wtypes.h>
#define FASTCALL
#include <oleidl.h>
#include <objidl.h>
#elif defined(__GNUC__) && (__GNUC__ <= 6)
typedef struct _BYTE_BLOB
{
unsigned long clSize;
unsigned char abData[ 1 ];
} BYTE_BLOB;
typedef /* [unique] */ __RPC_unique_pointer BYTE_BLOB *UP_BYTE_BLOB;
typedef LONGLONG REFERENCE_TIME;
#define NONAMELESSUNION
#endif
Thanks @dmitrykos, but this doesn't seem to work with https://mxe.cc/.
The GCC version of the cross-compiler seems to be this:
i686-w64-mingw32.static-gcc (GCC) 5.5.0
The package list at https://mxe.cc/#packages also mentions GCC version 5.5.0.
@mgeier, ok, I see. Does w64 define any specific to w64 project define which we could use to differentiate? Or, could you please find the source code where BYTE_BLOB is defined and check what specific defines to this structure are defined. We could ifdef
this block in PA WASAPI.
@mgeier, I found the needed file https://github.com/mirror/mingw-w64/blob/master/mingw-w64-headers/include/wtypesbase.h and there is _BLOB_DEFINED defined while it is not defined in MinGW32 version I was referencing earlier.
So, let's try to use it as such:
#ifdef WIN64
#include <wtypes.h>
#define FASTCALL
#include <oleidl.h>
#include <objidl.h>
#else
#ifndef _BLOB_DEFINED
typedef struct _BYTE_BLOB
{
unsigned long clSize;
unsigned char abData[ 1 ];
} BYTE_BLOB;
typedef /* [unique] */ __RPC_unique_pointer BYTE_BLOB *UP_BYTE_BLOB;
#endif
typedef LONGLONG REFERENCE_TIME;
#define NONAMELESSUNION
#endif
Will this workaround work for you?
Very nice, that works!
I didn't test if the generated library actually runs on Windows (I'm not a Windows user myself), but at least it compiles without error.
BTW, there is a warning about another preprocessor definition:
src/hostapi/dsound/pa_win_ds.c:54:0: warning: "_WIN32_WINNT" redefined
#define _WIN32_WINNT 0x0400 /* required to get waitable timer APIs */
^
[...]/mxe/usr/i686-w64-mingw32.static/include/_mingw.h:233:0: note: this is the location of the previous definition
#define _WIN32_WINNT 0x502
^
I have no idea whether that matters or not, I just thought I'd mention it while we are at it ...
This warning comes from the DirectSound interface, not WASAPI but it looks fine. May be it makes sense to adjust it to:
#if !defined(_WIN32_WINNT) || (_WIN32_WINNT < 0x0400)
#undef _WIN32_WINNT
#define _WIN32_WINNT 0x0400 /* required to get waitable timer APIs */
#endif
@RossBencina, could probably comment on that. I will handle a fix of WASAPI case in a separate PR.
@dmitrykos I am not sure about redefining _WIN32_WINNT
if it is already defined. I think it is better to move the define further up the file.
In any case, I created a new ticket #549
Describe the bug I'm trying to cross-compile performous according to this recipe, and the build ends with the message in the attached log message.txt (see below)
To Reproduce
Run the build workflow
Expected behavior
The source tests against WIN64 at pa_win_wasapi.c:171:24. Maybe it should also test against WIN32? I'm not too familiar with Windows alas.
Actual behavior
Error messages or logs longer than a page should be attached as a .txt file.
Desktop (please complete the following information):
openssl dgst -sha256 pa_snapshot.tgz
isc020ad3a40ef7dae12dce4ac1b9052b544a9fe43527093b72b78c7e81749ceea
The error messages are: