Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MinGW build broke #268

Open
krumelmonster opened this issue Aug 16, 2022 · 3 comments · May be fixed by #283
Open

MinGW build broke #268

krumelmonster opened this issue Aug 16, 2022 · 3 comments · May be fixed by #283

Comments

@krumelmonster
Copy link

krumelmonster commented Aug 16, 2022

This is up to date arch linux with mingw-w64-binutils 2.38-3, mingw-w64-cmake 1-39, mingw-w64-configure 0.1.1-1,1mingw-w64-crt 10.0.0-1, mingw-w64-environment 1-4, mingw-w64-gcc 12.1.0-1, mingw-w64-headers 10.0.0-1

2.0.0 and b810bf2 compile without issues. Current 8ab3606 fails due to error: redefinition of ‘IID_IMMDeviceEnumerator’ and others which could be fixed by defining __IMMDeviceEnumerator_INTERFACE_DEFINED__, __ISimpleAudioVolume_INTERFACE_DEFINED__, __MMDeviceAPILib_LIBRARY_DEFINED__ etc:

full compile output
$ x86_64-w64-mingw32-cmake -D BUILD_TESTS=OFF -D BUILD_STATIC_LIBS=ON -D ENABLE_JACK=OFF .. && make
CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required):
  Compatibility with CMake < 2.8.12 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.


-- The C compiler identification is GNU 12.1.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/x86_64-w64-mingw32-gcc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
Configuring libsoundio version 2.0.0
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
CMake Warning (dev) at /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:438 (message):
  The package name passed to `find_package_handle_standard_args` (PULSEAUDIO)
  does not match the name of the calling package (PulseAudio).  This can lead
  to problems in calling code that expects `find_package` result variables
  (e.g., `_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
  cmake/FindPulseAudio.cmake:14 (find_package_handle_standard_args)
  CMakeLists.txt:65 (find_package)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Could NOT find PULSEAUDIO (missing: PULSEAUDIO_LIBRARY PULSEAUDIO_INCLUDE_DIR)
-- Could NOT find ALSA (missing: ALSA_LIBRARY ALSA_INCLUDE_DIR)
CMake Warning (dev) at /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:438 (message):
  The package name passed to `find_package_handle_standard_args` (COREAUDIO)
  does not match the name of the calling package (CoreAudio).  This can lead
  to problems in calling code that expects `find_package` result variables
  (e.g., `_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
  cmake/FindCoreAudio.cmake:14 (find_package_handle_standard_args)
  CMakeLists.txt:99 (find_package)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Could NOT find COREAUDIO (missing: COREAUDIO_LIBRARY COREAUDIO_INCLUDE_DIR)
-- Looking for audioclient.h
-- Looking for audioclient.h - found
-- Found WASAPI: 1

Installation Summary
--------------------
* Install Directory            : /usr/x86_64-w64-mingw32
* Build Type                   : Debug
* Build static libs            : ON
* Build examples               : ON
* Build tests                  : OFF

System Dependencies
-------------------
* threads                      : OK
* JACK       (optional)        : disabled
* PulseAudio (optional)        : not found
* ALSA       (optional)        : not found
* CoreAudio  (optional)        : not found
* WASAPI     (optional)        : OK

-- Configuring done
-- Generating done
CMake Warning:
  Manually-specified variables were not used by the project:

    CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES


-- Build files have been written to: /tmp/lsio0/libsoundio/build
[  4%] Building C object CMakeFiles/libsoundio_shared.dir/src/soundio.c.obj
[  8%] Building C object CMakeFiles/libsoundio_shared.dir/src/util.c.obj
[ 12%] Building C object CMakeFiles/libsoundio_shared.dir/src/os.c.obj
[ 16%] Building C object CMakeFiles/libsoundio_shared.dir/src/dummy.c.obj
[ 20%] Building C object CMakeFiles/libsoundio_shared.dir/src/channel_layout.c.obj
[ 25%] Building C object CMakeFiles/libsoundio_shared.dir/src/ring_buffer.c.obj
[ 29%] Building C object CMakeFiles/libsoundio_shared.dir/src/wasapi.c.obj
/tmp/lsio0/libsoundio/src/wasapi.c:34:20: error: redefinition of ‘CLSID_MMDeviceEnumerator’
   34 | static const CLSID CLSID_MMDeviceEnumerator = {
      |                    ^~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/x86_64-w64-mingw32/include/combaseapi.h:156,
                 from /usr/x86_64-w64-mingw32/include/objbase.h:14,
                 from /usr/x86_64-w64-mingw32/include/ole2.h:17,
                 from /usr/x86_64-w64-mingw32/include/audioclient.h:13,
                 from /tmp/lsio0/libsoundio/src/wasapi.c:17:
/usr/x86_64-w64-mingw32/include/mmdeviceapi.h:965:1: note: previous definition of ‘CLSID_MMDeviceEnumerator’ with type ‘GUID’
  965 | DEFINE_GUID(CLSID_MMDeviceEnumerator, 0xbcde0395, 0xe52f, 0x467c, 0x8e,0x3d, 0xc4,0x57,0x92,0x91,0x69,0x2e);
      | ^~~~~~~~~~~
/tmp/lsio0/libsoundio/src/wasapi.c:37:20: error: redefinition of ‘IID_IMMDeviceEnumerator’
   37 | static const IID   IID_IMMDeviceEnumerator   = {
      |                    ^~~~~~~~~~~~~~~~~~~~~~~
/usr/x86_64-w64-mingw32/include/mmdeviceapi.h:582:1: note: previous definition of ‘IID_IMMDeviceEnumerator’ with type ‘GUID’
  582 | DEFINE_GUID(IID_IMMDeviceEnumerator, 0xa95664d2, 0x9614, 0x4f35, 0xa7,0x46, 0xde,0x8d,0xb6,0x36,0x17,0xe6);
      | ^~~~~~~~~~~
/tmp/lsio0/libsoundio/src/wasapi.c:41:20: error: redefinition of ‘IID_IMMNotificationClient’
   41 | static const IID   IID_IMMNotificationClient = {
      |                    ^~~~~~~~~~~~~~~~~~~~~~~~~
/usr/x86_64-w64-mingw32/include/mmdeviceapi.h:168:1: note: previous definition of ‘IID_IMMNotificationClient’ with type ‘GUID’
  168 | DEFINE_GUID(IID_IMMNotificationClient, 0x7991eec9, 0x7e89, 0x4d85, 0x83,0x90, 0x6c,0x70,0x3c,0xec,0x60,0xc0);
      | ^~~~~~~~~~~
/tmp/lsio0/libsoundio/src/wasapi.c:45:20: error: redefinition of ‘IID_IAudioClient’
   45 | static const IID   IID_IAudioClient = {
      |                    ^~~~~~~~~~~~~~~~
/usr/x86_64-w64-mingw32/include/audioclient.h:201:1: note: previous definition of ‘IID_IAudioClient’ with type ‘GUID’
  201 | DEFINE_GUID(IID_IAudioClient, 0x1cb9ad4c, 0xdbfa, 0x4c32, 0xb1,0x78, 0xc2,0xf5,0x68,0xa7,0x03,0xb2);
      | ^~~~~~~~~~~
/tmp/lsio0/libsoundio/src/wasapi.c:49:20: error: redefinition of ‘IID_IAudioRenderClient’
   49 | static const IID   IID_IAudioRenderClient    = {
      |                    ^~~~~~~~~~~~~~~~~~~~~~
/usr/x86_64-w64-mingw32/include/audioclient.h:879:1: note: previous definition of ‘IID_IAudioRenderClient’ with type ‘GUID’
  879 | DEFINE_GUID(IID_IAudioRenderClient, 0xf294acfc, 0x3146, 0x4483, 0xa7,0xbf, 0xad,0xdc,0xa7,0xc2,0x60,0xe2);
      | ^~~~~~~~~~~
/tmp/lsio0/libsoundio/src/wasapi.c:53:20: error: redefinition of ‘IID_IAudioSessionControl’
   53 | static const IID   IID_IAudioSessionControl  = {
      |                    ^~~~~~~~~~~~~~~~~~~~~~~~
/usr/x86_64-w64-mingw32/include/audiopolicy.h:276:1: note: previous definition of ‘IID_IAudioSessionControl’ with type ‘GUID’
  276 | DEFINE_GUID(IID_IAudioSessionControl, 0xf4b1a599, 0x7266, 0x4319, 0xa8,0xca, 0xe7,0x0a,0xcb,0x11,0xe8,0xcd);
      | ^~~~~~~~~~~
/tmp/lsio0/libsoundio/src/wasapi.c:57:20: error: redefinition of ‘IID_IAudioSessionEvents’
   57 | static const IID   IID_IAudioSessionEvents   = {
      |                    ^~~~~~~~~~~~~~~~~~~~~~~
/usr/x86_64-w64-mingw32/include/audiopolicy.h:116:1: note: previous definition of ‘IID_IAudioSessionEvents’ with type ‘GUID’
  116 | DEFINE_GUID(IID_IAudioSessionEvents, 0x24918acc, 0x64b3, 0x37c1, 0x8c,0xa9, 0x74,0xa6,0x6e,0x99,0x57,0xa8);
      | ^~~~~~~~~~~
/tmp/lsio0/libsoundio/src/wasapi.c:61:18: error: redefinition of ‘IID_IMMEndpoint’
   61 | static const IID IID_IMMEndpoint = {
      |                  ^~~~~~~~~~~~~~~
/usr/x86_64-w64-mingw32/include/mmdeviceapi.h:505:1: note: previous definition of ‘IID_IMMEndpoint’ with type ‘GUID’
  505 | DEFINE_GUID(IID_IMMEndpoint, 0x1be09788, 0x6894, 0x4089, 0x85,0x86, 0x9a,0x2a,0x6c,0x26,0x5a,0xc5);
      | ^~~~~~~~~~~
/tmp/lsio0/libsoundio/src/wasapi.c:65:18: error: redefinition of ‘IID_IAudioClockAdjustment’
   65 | static const IID IID_IAudioClockAdjustment = {
      |                  ^~~~~~~~~~~~~~~~~~~~~~~~~
/usr/x86_64-w64-mingw32/include/audioclient.h:1266:1: note: previous definition of ‘IID_IAudioClockAdjustment’ with type ‘GUID’
 1266 | DEFINE_GUID(IID_IAudioClockAdjustment, 0xf6e4c0a0, 0x46d9, 0x4fb8, 0xbe,0x21, 0x57,0xa3,0xef,0x2b,0x62,0x6c);
      | ^~~~~~~~~~~
/tmp/lsio0/libsoundio/src/wasapi.c:69:18: error: redefinition of ‘IID_IAudioCaptureClient’
   69 | static const IID IID_IAudioCaptureClient = {
      |                  ^~~~~~~~~~~~~~~~~~~~~~~
/usr/x86_64-w64-mingw32/include/audioclient.h:972:1: note: previous definition of ‘IID_IAudioCaptureClient’ with type ‘GUID’
  972 | DEFINE_GUID(IID_IAudioCaptureClient, 0xc8adbd64, 0xe71e, 0x48a0, 0xa4,0xde, 0x18,0x5c,0x39,0x5c,0xd3,0x17);
      | ^~~~~~~~~~~
/tmp/lsio0/libsoundio/src/wasapi.c:73:18: error: redefinition of ‘IID_ISimpleAudioVolume’
   73 | static const IID IID_ISimpleAudioVolume = {
      |                  ^~~~~~~~~~~~~~~~~~~~~~
/usr/x86_64-w64-mingw32/include/audioclient.h:1346:1: note: previous definition of ‘IID_ISimpleAudioVolume’ with type ‘GUID’
 1346 | DEFINE_GUID(IID_ISimpleAudioVolume, 0x87ce5498, 0x68d6, 0x44e5, 0x92,0x15, 0x6d,0xa4,0x7e,0xf8,0x83,0xd8);
      | ^~~~~~~~~~~
/tmp/lsio0/libsoundio/src/wasapi.c: In function ‘deinit_refresh_devices’:
/tmp/lsio0/libsoundio/src/wasapi.c:489:5: error: this ‘if’ clause does not guard... [-Werror=misleading-indentation]
  489 |     if (rd->mm_device)
      |     ^~
/tmp/lsio0/libsoundio/src/wasapi.c:491:9: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
  491 |         if (rd->default_render_device)
      |         ^~
/tmp/lsio0/libsoundio/src/wasapi.c: At top level:
/tmp/lsio0/libsoundio/src/wasapi.c:65:18: error: ‘IID_IAudioClockAdjustment’ defined but not used [-Werror=unused-const-variable=]
   65 | static const IID IID_IAudioClockAdjustment = {
      |                  ^~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/lsio0/libsoundio/src/wasapi.c:57:20: error: ‘IID_IAudioSessionEvents’ defined but not used [-Werror=unused-const-variable=]
   57 | static const IID   IID_IAudioSessionEvents   = {
      |                    ^~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make[2]: *** [CMakeFiles/libsoundio_shared.dir/build.make:167: CMakeFiles/libsoundio_shared.dir/src/wasapi.c.obj] Error 1
make[1]: *** [CMakeFiles/Makefile2:94: CMakeFiles/libsoundio_shared.dir/all] Error 2
make: *** [Makefile:136: all] Error 2

a46b0f2 fails due to -Werror=misleading-indentation which should be fixed by indenting properly in src/wasapi.c:

full compile output
$ x86_64-w64-mingw32-cmake -D BUILD_TESTS=OFF -D BUILD_STATIC_LIBS=ON -D ENABLE_JACK=OFF .. && make
CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required):
  Compatibility with CMake < 2.8.12 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.


Configuring libsoundio version 2.0.0
CMake Warning (dev) at /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:438 (message):
  The package name passed to `find_package_handle_standard_args` (PULSEAUDIO)
  does not match the name of the calling package (PulseAudio).  This can lead
  to problems in calling code that expects `find_package` result variables
  (e.g., `_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
  cmake/FindPulseAudio.cmake:14 (find_package_handle_standard_args)
  CMakeLists.txt:65 (find_package)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Could NOT find PULSEAUDIO (missing: PULSEAUDIO_LIBRARY PULSEAUDIO_INCLUDE_DIR)
-- Could NOT find ALSA (missing: ALSA_LIBRARY ALSA_INCLUDE_DIR)
CMake Warning (dev) at /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:438 (message):
  The package name passed to `find_package_handle_standard_args` (COREAUDIO)
  does not match the name of the calling package (CoreAudio).  This can lead
  to problems in calling code that expects `find_package` result variables
  (e.g., `_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
  cmake/FindCoreAudio.cmake:14 (find_package_handle_standard_args)
  CMakeLists.txt:99 (find_package)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Could NOT find COREAUDIO (missing: COREAUDIO_LIBRARY COREAUDIO_INCLUDE_DIR)

Installation Summary
--------------------
* Install Directory            : /usr/x86_64-w64-mingw32
* Build Type                   : Debug
* Build static libs            : ON
* Build examples               : ON
* Build tests                  : OFF

System Dependencies
-------------------
* threads                      : OK
* JACK       (optional)        : disabled
* PulseAudio (optional)        : not found
* ALSA       (optional)        : not found
* CoreAudio  (optional)        : not found
* WASAPI     (optional)        : OK

-- Configuring done
-- Generating done
-- Build files have been written to: /tmp/lsio0/libsoundio/build
Consolidate compiler generated dependencies of target libsoundio_shared
[  4%] Building C object CMakeFiles/libsoundio_shared.dir/src/wasapi.c.obj
/tmp/lsio0/libsoundio/src/wasapi.c: In function ‘deinit_refresh_devices’:
/tmp/lsio0/libsoundio/src/wasapi.c:487:5: error: this ‘if’ clause does not guard... [-Werror=misleading-indentation]
  487 |     if (rd->mm_device)
      |     ^~
/tmp/lsio0/libsoundio/src/wasapi.c:489:9: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
  489 |         if (rd->default_render_device)
      |         ^~
cc1: all warnings being treated as errors
make[2]: *** [CMakeFiles/libsoundio_shared.dir/build.make:167: CMakeFiles/libsoundio_shared.dir/src/wasapi.c.obj] Error 1
make[1]: *** [CMakeFiles/Makefile2:94: CMakeFiles/libsoundio_shared.dir/all] Error 2
make: *** [Makefile:136: all] Error 2
@pierre-aimi
Copy link

Also having this exact same problem building using mxe

@xxxx96
Copy link

xxxx96 commented Jan 30, 2023

I also encountered this problem,has anyone solved it

@sgf4
Copy link

sgf4 commented Feb 17, 2023

You need removing all the redefinitions in the C file, it worked for me.

@krumelmonster krumelmonster linked a pull request Jul 27, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants