Hi,
I am building wxWidget using cmake and MSYS2/Clang64.
This is how I build wxWidgets:
git clone https://github.com/wxWidgets/wxWidgets cd wxWidgets git submodule update --init
Followed by:
mkdir build-release cd build-release cmake .. -G"MinGW Makefiles" -DCMAKE_BUILD_TYPE=Release \ -DwxBUILD_DEBUG_LEVEL=0 \ -DwxBUILD_MONOLITHIC=1 -DwxBUILD_SAMPLES=SOME -DwxUSE_STL=1 mingw32-make -j$(nproc)
The cmake output is (I have truncated so it will only display the compiler identification part):
-- The C compiler identification is Clang 15.0.2 -- The CXX compiler identification is Clang 15.0.2 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: C:/msys64/clang64/bin/cc.exe - skipped -- Detecting C compile features -- Detecting C compile features - done -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: C:/msys64/clang64/bin/c++.exe - skipped
The build output (fails during the samples build):
I am getting this error while building the samples:
Scanning dependencies of target dataview Scanning dependencies of target minimal Scanning dependencies of target widgets [ 96%] Building CXX object utils/CMakeFiles/wxrc.dir/__/__/__/utils/wxrc/wxrc.cpp.obj [ 96%] Building CXX object samples/CMakeFiles/console.dir/__/__/__/samples/console/console.cpp.obj[ 96%] Building CXX object samples/CMakeFiles/dataview.dir/cmake_pch.hxx.pch [ 96%] [ 96%] Building RC object samples/CMakeFiles/console.dir/__/__/__/samples/sample.rc.obj Building RC object samples/CMakeFiles/dataview.dir/__/__/__/samples/sample.rc.obj [ 96%] Building CXX object samples/CMakeFiles/minimal.dir/__/__/__/samples/minimal/minimal.cpp.obj [ 96%] Building CXX object samples/CMakeFiles/widgets.dir/cmake_pch.hxx.pch [ 97%] Building RC object samples/CMakeFiles/minimal.dir/__/__/__/samples/sample.rc.obj [ 97%] Building RC object samples/CMakeFiles/widgets.dir/__/__/__/samples/sample.rc.obj llvm-rc: Error in 24 statement (ID 1): llvm-rc: Error in 24 statement (ID 1): error : file not found : wx/msw/wx error : file not found : wx/msw/wx llvm-rc: Error in 24 statement (ID 1): llvm-rc: error : file not found : wx/msw/wx Error in 24 statement (ID 1): error : file not found : wx/msw/wx mingw32-make[2]: *** [samples\CMakeFiles\dataview.dir\build.make:124: samples/CMakeFiles/dataview.dir/__/__/__/samples/sample.rc.obj] Error 1 mingw32-make[2]: *** [samples\CMakeFiles\console.dir\build.make:89: samples/CMakeFiles/console.dir/__/__/__/samples/sample.rc.obj] Error 1 mingw32-make[2]: *** [samples\CMakeFiles\widgets.dir\build.make:634: samples/CMakeFiles/widgets.dir/__/__/__/samples/sample.rc.obj] Error 1 mingw32-make[2]: *** Waiting for unfinished jobs.... mingw32-make[2]: *** Waiting for unfinished jobs.... mingw32-make[2]: *** Waiting for unfinished jobs.... mingw32-make[2]: *** [samples\CMakeFiles\minimal.dir\build.make:89: samples/CMakeFiles/minimal.dir/__/__/__/samples/sample.rc.obj] Error 1 mingw32-make[2]: *** Waiting for unfinished jobs.... mingw32-make[1]: *** [CMakeFiles\Makefile2:706: samples/CMakeFiles/console.dir/all] Error 2 mingw32-make[1]: *** Waiting for unfinished jobs.... mingw32-make[1]: *** [CMakeFiles\Makefile2:758: samples/CMakeFiles/minimal.dir/all] Error 2 mingw32-make[1]: *** [CMakeFiles\Makefile2:732: samples/CMakeFiles/dataview.dir/all] Error 2 mingw32-make[1]: *** [CMakeFiles\Makefile2:784: samples/CMakeFiles/widgets.dir/all] Error 2 [ 97%] Linking CXX executable ..\lib\clang_x64_dll\wxrc.exe [ 97%] Built target wxrc mingw32-make: *** [Makefile:135: all] Error 2
My workaround is to apply this small patch:
--- ../include/wx/msw/wx.rc 2022-12-20 10:14:03.051878100 +0200 +++ /home/eran/devl/wxWidgets-3.2.0/include/wx/msw/wx.rc 2022-07-31 23:22:27.672852900 +0300 @@ -118,7 +118,9 @@ #define wxRC_CONCAT(a, b) wxRC_CONCAT2(a, b) #define wxRC_CONCAT2(a, b) a ## b -#ifdef __GNUC__ +#if defined(__llvm__) + #define wxMANIFEST_FILE "wx/msw/wx_dpi_aware_pmv2.manifest" +#elif defined(__GNUC__) #define wxMANIFEST_FILE "wx/msw/wx" wxRC_STR(wxMANIFEST_DPI) #else #define wxMANIFEST_FILE wxRC_CONCAT(wx/msw/wx, wxMANIFEST_DPI)
OS: Windows 10, 64 bit
wx version: 3.2.0
Compiler: MSYS2 clang version 15.0.2
NOTE:
I have been using this patch for couple of months now, with no apparent issues.
(I have released multiple versions of CodeLite using wxWidgets built with Clang for Windows with 0 issues (other than my own bugs ;) ))
Thanks
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
I can reproduce the problem. But the patch forces the pmv2 manifest. llvm-rc seems to work fine with the wxRC_CONCAT method, so I think we could just do:
diff --git "a/include/wx/msw/wx.rc" "b/include/wx/msw/wx.rc" index 7a6b203f13..8d41fd7e2b 100644 --- "a/include/wx/msw/wx.rc" +++ "b/include/wx/msw/wx.rc" @@ -118,7 +118,7 @@ wxBITMAP_STD_COLOURS BITMAP "wx/msw/colours.bmp" #define wxRC_CONCAT(a, b) wxRC_CONCAT2(a, b) #define wxRC_CONCAT2(a, b) a ## b -#ifdef __GNUC__ +#if defined(__GNUC__) && !defined(__llvm__)
#define wxMANIFEST_FILE "wx/msw/wx" wxRC_STR(wxMANIFEST_DPI)
#else
#define wxMANIFEST_FILE wxRC_CONCAT(wx/msw/wx, wxMANIFEST_DPI)
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
Whatever works :)
I picked the first solution that I tried and worked.
I changed the patch to use your version and it also seems to work fine (using high DPI)
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
MSYS2 uses a different patch. I think this can be simplified even further, but the CI will have to verify this:
diff --git "a/include/wx/msw/wx.rc" "b/include/wx/msw/wx.rc" index 7a6b203f13..cae328fd31 100644 --- "a/include/wx/msw/wx.rc" +++ "b/include/wx/msw/wx.rc" @@ -106,22 +106,11 @@ wxBITMAP_STD_COLOURS BITMAP "wx/msw/colours.bmp" #endif #if !defined(wxUSE_DPI_AWARE_MANIFEST) || wxUSE_DPI_AWARE_MANIFEST == 0 - #define wxMANIFEST_DPI .manifest + #define wxMANIFEST_FILE "wx/msw/wx.manifest" #elif wxUSE_DPI_AWARE_MANIFEST == 1 - #define wxMANIFEST_DPI _dpi_aware.manifest + #define wxMANIFEST_FILE "wx/msw/wx_dpi_aware.manifest" #elif wxUSE_DPI_AWARE_MANIFEST == 2 - #define wxMANIFEST_DPI _dpi_aware_pmv2.manifest -#endif - -#define wxRC_STR(text) wxRC_STR2(text) -#define wxRC_STR2(text) #text -#define wxRC_CONCAT(a, b) wxRC_CONCAT2(a, b) -#define wxRC_CONCAT2(a, b) a ## b - -#ifdef __GNUC__ - #define wxMANIFEST_FILE "wx/msw/wx" wxRC_STR(wxMANIFEST_DPI) -#else - #define wxMANIFEST_FILE wxRC_CONCAT(wx/msw/wx, wxMANIFEST_DPI) + #define wxMANIFEST_FILE "wx/msw/wx_dpi_aware_pmv2.manifest" #endif wxMANIFEST_ID RT_MANIFEST wxMANIFEST_FILE
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
I can try it locally with MSYS2/clang if its needed
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
I'm mostly worried about msvc, since those will now have quotes around the path. But all documentation I find about RT_MANIFEST uses quotes as well, so it shouldn't be a problem.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
Oh well, I think that clang should be the default for Windows... its just superior to gcc / msvc in so many ways... :D
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
If this simple fix works, let's apply it and backport to 3.2. We could always further improve/simplify the version in master, of course.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
Closed #23057 as completed via ddea807.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()