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 buildability #19349

Merged
merged 1 commit into from
Sep 13, 2023
Merged

mingw buildability #19349

merged 1 commit into from
Sep 13, 2023

Conversation

lyrra
Copy link
Contributor

@lyrra lyrra commented Sep 10, 2023

  • [ x] I signed the CLA

@@ -1,6 +1,6 @@
include(GetPlatformInfo)

if (OS_IS_WIN)
if (OS_IS_WIN AND (NOT MINGW))
find_path(SNDFILE_INCDIR sndfile.h PATHS ${PROJECT_SOURCE_DIR}/dependencies/include;)
if (MINGW)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wouldn't this then be dead code?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Originally the path was took for all flavors of windows. This narrows to a subset that does not include mingw.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But causes sndfile to not get found

Copy link
Contributor Author

@lyrra lyrra Sep 10, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see what you mean with dead code, I've pushed a commit that removes the mingw stuff inside the windows path that is avoided on mingw.

@Jojo-Schmitz
Copy link
Contributor

Jojo-Schmitz commented Sep 10, 2023

When I try this, I get:

-- Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE) 
CMake Error at build/cmake/FindSndFile.cmake:108 (message):
  Could not find: sndfile
Call Stack (most recent call first):
  CMakeLists.txt:169 (include)

@lyrra
Copy link
Contributor Author

lyrra commented Sep 10, 2023

-- Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE)
CMake Error at build/cmake/FindSndFile.cmake:108 (message):
Could not find: sndfile

Not sure about the PKG_CONFIG_EXECUTABLE error, but check if your mingw has libsndfile is installed:
https://packages.msys2.org/package/mingw-w64-x86_64-libsndfile?repo=mingw64

@Jojo-Schmitz
Copy link
Contributor

I'm pretty sure it has, as my 3.x builds find it

@lyrra
Copy link
Contributor Author

lyrra commented Sep 10, 2023

It seems pkg-config is needed to be found, and if so, it is used to find libsndfile:

-- Found PkgConfig: C:/Users/larry/Downloads/msys64/mingw64/bin/pkg-config.exe (found version "1.8.0")
-- Found sndfile: C:/Users/larry/Downloads/msys64/mingw64/lib/libsndfile.dll.a C:/Users/larry/Downloads/msys64/mingw64/include

$ command -v pkg-config
/mingw64/bin/pkg-config

EDIT: on mu3 it seems "find_library" is used instead of "find_package" as in mu4.
That could explain why it works on your mu3, given no pkg-config is installed.
See if https://packages.msys2.org/package/mingw-w64-x86_64-pkgconf is installed (pacman -Q | grep pkgconf).

@Jojo-Schmitz
Copy link
Contributor

Jojo-Schmitz commented Sep 11, 2023

I beleive MUE_BUILD_CRASHPAD_CLIENT and MUE_BUILD_MUSESAMPLES_MODULE need to get disabled, at least I can't build with it in QtCreator/MinGW. Also the entire WASAPI stuff doesn't build for me.

I'm using the MinGW that comes as part of Qt 5.15.2, maybe that's just too old?

@lyrra
Copy link
Contributor Author

lyrra commented Sep 11, 2023

I beleive MUE_BUILD_CRASHPAD_CLIENT and MUE_BUILD_MUSESAMPLES_MODULE need to get disabled, at lerast I can't build with it in QtCreator/MinGW. Also the entire WASAPI stuff doesn't build for me.

I'm using the MinGW that comes as part of Qt 5.15.2, maybe that's just too old?

The WASAPI errors are expected as this PR depends on #19246 which disables wasapi if jack is used (which is needed for mingw).

Yes, also other stuff needs to be disabled, here is my build command:

cmake \
    -P ./build.cmake \
    -G "Unix Makefiles" \
    -DMUE_ENABLE_AUDIO_JACK=ON \
    -DMUE_BUILD_CRASHPAD_CLIENT=OFF \
    -DCMAKE_BUILD_TYPE=Debug \
    -DBUILD_FOR_WINSTORE=OFF \
    -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON

@igorkorsukov igorkorsukov merged commit 30fbb87 into musescore:master Sep 13, 2023
11 checks passed
@Jojo-Schmitz
Copy link
Contributor

But isn't #19246 just about Linux?
Whatever: even with MUE_BUILD_CRASHPAD_CLIENT, MUE_BUILD_MUSESAMPLES_MODULE set to OFF and MUE_ENABLE_AUDIO_JACKtp ON, it doesn't build for me:

C:\Users\Jojo\Documents\GitHub\MuseScore\src\framework\audio\internal\platform\win\wasapitypes.h:28: Fehler: winrt/Windows.Devices.Enumeration.h: No such file or directory
In file included from C:/Users/Jojo/Documents/GitHub/MuseScore/src/framework/audio/internal/platform/win/wasapiaudioclient.h:26,
                 from C:/Users/Jojo/Documents/GitHub/MuseScore/src/framework/audio/internal/platform/win/wasapiaudioclient.cpp:23,
                 from C:\Users\Jojo\Documents\GitHub\MuseScore\build.qtc\src\framework\audio\CMakeFiles\audio.dir\Unity\unity_1_cxx.cxx:9:
C:/Users/Jojo/Documents/GitHub/MuseScore/src/framework/audio/internal/platform/win/wasapitypes.h:28:10: fatal error: winrt/Windows.Devices.Enumeration.h: No such file or directory
 #include <winrt/Windows.Devices.Enumeration.h>
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\Users\Jojo\Documents\GitHub\MuseScore\src\framework\audio\audiomodule.cpp:126: Fehler: invalid application of 'sizeof' to incomplete type 'mu::audio::AudioDevicesListener'
In file included from C:/Qt/Tools/mingw810_64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/memory:80,
                 from C:/Users/Jojo/Documents/GitHub/MuseScore/build/pch/pch.h:39,
                 from C:/Users/Jojo/Documents/GitHub/MuseScore/build.qtc/src/framework/global/CMakeFiles/global.dir/cmake_pch.hxx:5,
                 from <command-line>:
C:/Qt/Tools/mingw810_64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/bits/unique_ptr.h: In instantiation of 'void std::default_delete<_Tp>::operator()(_Tp*) const [with _Tp = mu::audio::AudioDevicesListener]':
C:/Qt/Tools/mingw810_64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/bits/unique_ptr.h:274:17:   required from 'std::unique_ptr<_Tp, _Dp>::~unique_ptr() [with _Tp = mu::audio::AudioDevicesListener; _Dp = std::default_delete<mu::audio::AudioDevicesListener>]'
C:/Users/Jojo/Documents/GitHub/MuseScore/src/framework/audio/internal/platform/win/wasapiaudiodriver.h:34:7:   required from 'std::__shared_count<_Lp>::__shared_count(_Ptr) [with _Ptr = mu::audio::WasapiAudioDriver*; __gnu_cxx::_Lock_policy _Lp = (__gnu_cxx::_Lock_policy)2]'
C:/Qt/Tools/mingw810_64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/bits/shared_ptr_base.h:620:22:   required from 'std::__shared_count<_Lp>::__shared_count(_Ptr, std::false_type) [with _Ptr = mu::audio::WasapiAudioDriver*; __gnu_cxx::_Lock_policy _Lp = (__gnu_cxx::_Lock_policy)2; std::false_type = std::integral_constant<bool, false>]'
C:/Qt/Tools/mingw810_64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/bits/shared_ptr_base.h:1107:64:   required from 'std::__shared_ptr<_Tp, _Lp>::__shared_ptr(_Yp*) [with _Yp = mu::audio::WasapiAudioDriver; <template-parameter-2-2> = void; _Tp = mu::audio::IAudioDriver; __gnu_cxx::_Lock_policy _Lp = (__gnu_cxx::_Lock_policy)2]'
C:/Qt/Tools/mingw810_64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/bits/shared_ptr.h:139:46:   required from 'std::shared_ptr<_Tp>::shared_ptr(_Yp*) [with _Yp = mu::audio::WasapiAudioDriver; <template-parameter-2-2> = void; _Tp = mu::audio::IAudioDriver]'
C:/Users/Jojo/Documents/GitHub/MuseScore/src/framework/audio/audiomodule.cpp:126:74:   required from here
C:/Qt/Tools/mingw810_64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/bits/unique_ptr.h:79:16: error: invalid application of 'sizeof' to incomplete type 'mu::audio::AudioDevicesListener'
  static_assert(sizeof(_Tp)>0,
                ^~~~~~~~~~~

@lyrra
Copy link
Contributor Author

lyrra commented Sep 14, 2023

You are correct, you need this patch to make jack build also on windows: c5ec4e1
EDIT: improved the above patch.
Also, mingw package mingw-w64-x86_64-dlfcn is needed, (probably need to point out -ldl in CMakeLists somewhere).

@lyrra lyrra mentioned this pull request Jun 29, 2024
11 tasks
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 this pull request may close these issues.

3 participants