gammasoft71 / xtd

Free open-source modern C++17 / C++20 framework to create console, GUI (forms like WinForms) and unit test applications and libraries on Microsoft Windows, Apple macOS and Linux.
https://gammasoft71.github.io/xtd
MIT License
735 stars 57 forks source link

[ENHANCEMENT] xtd - MSYS2 support #220

Closed ghost closed 6 months ago

ghost commented 1 year ago

I'm trying to build on MSYS2 MinGW64. It required wxwidgets. No problems, MSYS2 has wxwidgets packages too. After I installed wxwidgets, cmake configuration completed and I could start the build. But it failed immediately because of missing execinfo.h, this is a header from gnulib. So it seems MSYS2 is not supported, isn't it?

Here is the status of MSYS2 support by xtd

gammasoft71 commented 1 year ago

Indeed, StackWalker (a thierce library) uses `execinfo.h which is unfortunately not portable and is specific to gnulib. I added a correction (I hope) in the commit https://github.com/gammasoft71/xtd/commit/072f080c0b53eba981c2930d4c002190e0c15b14.

As I never tested xtd with MSYS2, it is possible that other problems occur. If you continue the experiment, please keep me informed.

Regards, Gammasoft71

gammasoft71 commented 1 year ago

Hello again,

Can you tell me if you succeed to build xtd on MinGW64 with success?

If so, how did you get there? Do I have to add something in the installation and in the documentation of xtd ?

Regards, Gammasoft71

ghost commented 1 year ago

Hello again,

Can you tell me if you succeed to build xtd on MinGW64 with success?

If so, how did you get there? Do I have to add something in the installation and in the documentation of xtd ?

Regards, Gammasoft71

Don't build because code error.

gammasoft71 commented 1 year ago

Don't build because code error.

Can you send me the log ?

ghost commented 1 year ago

Don't build because code error.

Can you send me the log ?

$ ninja -j1
[1/494] Building CXX object src/xtd.3rdparty.call_stack/CMakeFiles/xtd.3rdparty.call_stack.dir/module_information.cpp.obj
[2/494] Building CXX object src/xtd.3rdparty.call_stack/CMakeFiles/xtd.3rdparty.call_stack.dir/process_information.cpp.obj
[3/494] Building CXX object src/xtd.3rdparty.call_stack/CMakeFiles/xtd.3rdparty.call_stack.dir/stack_frame.cpp.obj
[4/494] Building CXX object src/xtd.3rdparty.call_stack/CMakeFiles/xtd.3rdparty.call_stack.dir/stack_walker.cpp.obj
FAILED: src/xtd.3rdparty.call_stack/CMakeFiles/xtd.3rdparty.call_stack.dir/stack_walker.cpp.obj
C:\msys64\mingw64\bin\c++.exe -D__CMAKE_INSTALL_PREFIX__="\"C:/Program Files (x86)/xtd\"" -D__XTD_ASSEMBLY_VERSION__=\"\" -D__XTD_CONSOLE_INCLUDE_PATH__="\"C:/Program Files (x86)/xtd/include\"" -D__XTD_CONSOLE_LIB_PATH__="\"C:/Program Files (x86)/xtd/lib\"" -D__XTD_CURRENT_TARGET_ID__=7 -D__XTD_DRAWING_INCLUDE_PATH__="\"C:/Program Files (x86)/xtd/include\"" -D__XTD_DRAWING_LIB_PATH__="\"C:/Program Files (x86)/xtd/lib\"" -D__XTD_DRAWING_RESOURCES_PATH__="\"C:/Program Files (x86)/xtd/share/xtd/resources\"" -D__XTD_FORMS_INCLUDE_PATH__="\"C:/Program Files (x86)/xtd/include\"" -D__XTD_FORMS_LIB_PATH__="\"C:/Program Files (x86)/xtd/lib\"" -D__XTD_FORMS_RESOURCES_PATH__="\"C:/Program Files (x86)/xtd/share/xtd/resources\"" -D__XTD_INCLUDE_PATH__="\"C:/Program Files (x86)/xtd/include\"" -D__XTD_INSTALL_PATH__="\"C:/Program Files (x86)/xtd\"" -D__XTD_LIB_PATH__="\"C:/Program Files (x86)/xtd/lib\"" -D__XTD_LOCALE_PATH__="\"C:/Program Files (x86)/xtd/share/xtd/locale\"" -D__XTD_REFERENCE_GUIDE_PATH__="\"C:/Program Files (x86)/xtd/share/xtd/reference_guide\"" -D__XTD_RESOURCES_PATH__="\"C:/Program Files (x86)/xtd/share/xtd/resources\"" -D__XTD_TARGET_ID_CONSOLE_APPLICATION__=1 -D__XTD_TARGET_ID_CUSTOM_TARGET__=8 -D__XTD_TARGET_ID_GUI_APPLICATION__=2 -D__XTD_TARGET_ID_INTERFACE_LIBRARY__=4 -D__XTD_TARGET_ID_MODULE_LIBRARY__=5 -D__XTD_TARGET_ID_SHARED_LIBRARY__=6 -D__XTD_TARGET_ID_STATIC_LIBRARY__=7 -D__XTD_TARGET_ID_TEST_APPLICATION__=3 -D__XTD_TARGET_ID_UNKNOWN__=0 -D__XTD_THEMES_PATH__="\"C:/Program Files (x86)/xtd/share/xtd/themes\"" -D__XTD_TUNIT_INCLUDE_PATH__="\"C:/Program Files (x86)/xtd/include\"" -D__XTD_TUNIT_LIB_PATH__="\"C:/Program Files (x86)/xtd/lib\"" -D__XTD_USE_ENUMERATION_INTROSPECTION__ -IC:/msys64/home/Administrator/xtd/src/xtd.3rdparty.call_stack -Wall -Wextra -Wno-unused-parameter -Wno-unknown-pragmas -pedantic -std=gnu++20 -MD -MT src/xtd.3rdparty.call_stack/CMakeFiles/xtd.3rdparty.call_stack.dir/stack_walker.cpp.obj -MF src\xtd.3rdparty.call_stack\CMakeFiles\xtd.3rdparty.call_stack.dir\stack_walker.cpp.obj.d -o src/xtd.3rdparty.call_stack/CMakeFiles/xtd.3rdparty.call_stack.dir/stack_walker.cpp.obj -c C:/msys64/home/Administrator/xtd/src/xtd.3rdparty.call_stack/stack_walker.cpp
C:/msys64/home/Administrator/xtd/src/xtd.3rdparty.call_stack/stack_walker.cpp:180: warning: "_tcscat_s" redefined
  180 | #define _tcscat_s _tcscat
      |
In file included from C:/msys64/mingw64/include/tchar.h:1139,
                 from C:/msys64/home/Administrator/xtd/src/xtd.3rdparty.call_stack/stack_walker.cpp:31:
C:/msys64/mingw64/include/sec_api/tchar_s.h:149: note: this is the location of the previous definition
  149 | #define _tcscat_s strcat_s
      |
In file included from C:/msys64/home/Administrator/xtd/src/xtd.3rdparty.call_stack/stack_walker.cpp:35:
C:/msys64/home/Administrator/xtd/src/xtd.3rdparty.call_stack/stack_walker.h:126:3: warning: 'typedef' was ignored in this declaration
  126 |   typedef enum CallstackEntryType {firstEntry, nextEntry, lastEntry};
      |   ^~~~~~~
C:/msys64/home/Administrator/xtd/src/xtd.3rdparty.call_stack/stack_walker.cpp:329:3: warning: 'typedef' was ignored in this declaration
  329 |   typedef struct IMAGEHLP_MODULE64_V2 {
      |   ^~~~~~~
C:/msys64/home/Administrator/xtd/src/xtd.3rdparty.call_stack/stack_walker.cpp: In member function 'BOOL StackWalkerInternal::Init(LPCSTR)':
C:/msys64/home/Administrator/xtd/src/xtd.3rdparty.call_stack/stack_walker.cpp:243:11: warning: cast between incompatible function types from 'FARPROC' {aka 'long long int (*)()'} to 'StackWalkerInternal::tSI' {aka 'int (*)(void*, char*, int)'} [-Wcast-function-type]
  243 |     pSI = (tSI) GetProcAddress(m_hDbhHelp, "SymInitialize");
      |           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:/msys64/home/Administrator/xtd/src/xtd.3rdparty.call_stack/stack_walker.cpp:244:11: warning: cast between incompatible function types from 'FARPROC' {aka 'long long int (*)()'} to 'StackWalkerInternal::tSC' {aka 'int (*)(void*)'} [-Wcast-function-type]
  244 |     pSC = (tSC) GetProcAddress(m_hDbhHelp, "SymCleanup");
      |           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:/msys64/home/Administrator/xtd/src/xtd.3rdparty.call_stack/stack_walker.cpp:246:11: warning: cast between incompatible function types from 'FARPROC' {aka 'long long int (*)()'} to 'StackWalkerInternal::tSW' {aka 'int (*)(long unsigned int, void*, void*, _tagSTACKFRAME64*, void*, int (*)(void*, long long unsigned int, void*, long unsigned int, long unsigned int*), void* (*)(void*, long long unsigned int), long long unsigned int (*)(void*, long long unsigned int), long long unsigned int (*)(void*, void*, _tagADDRESS64*))'} [-Wcast-function-type]
  246 |     pSW = (tSW) GetProcAddress(m_hDbhHelp, "StackWalk64");
      |           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:/msys64/home/Administrator/xtd/src/xtd.3rdparty.call_stack/stack_walker.cpp:247:12: warning: cast between incompatible function types from 'FARPROC' {aka 'long long int (*)()'} to 'StackWalkerInternal::tSGO' {aka 'long unsigned int (*)()'} [-Wcast-function-type]
  247 |     pSGO = (tSGO) GetProcAddress(m_hDbhHelp, "SymGetOptions");
      |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:/msys64/home/Administrator/xtd/src/xtd.3rdparty.call_stack/stack_walker.cpp:248:12: warning: cast between incompatible function types from 'FARPROC' {aka 'long long int (*)()'} to 'StackWalkerInternal::tSSO' {aka 'long unsigned int (*)(long unsigned int)'} [-Wcast-function-type]
  248 |     pSSO = (tSSO) GetProcAddress(m_hDbhHelp, "SymSetOptions");
      |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:/msys64/home/Administrator/xtd/src/xtd.3rdparty.call_stack/stack_walker.cpp:250:13: warning: cast between incompatible function types from 'FARPROC' {aka 'long long int (*)()'} to 'StackWalkerInternal::tSFTA' {aka 'void* (*)(void*, long long unsigned int)'} [-Wcast-function-type]
  250 |     pSFTA = (tSFTA) GetProcAddress(m_hDbhHelp, "SymFunctionTableAccess64");
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:/msys64/home/Administrator/xtd/src/xtd.3rdparty.call_stack/stack_walker.cpp:251:14: warning: cast between incompatible function types from 'FARPROC' {aka 'long long int (*)()'} to 'StackWalkerInternal::tSGLFA' {aka 'int (*)(void*, long long unsigned int, long unsigned int*, _IMAGEHLP_LINE64*)'} [-Wcast-function-type]
  251 |     pSGLFA = (tSGLFA) GetProcAddress(m_hDbhHelp, "SymGetLineFromAddr64");
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:/msys64/home/Administrator/xtd/src/xtd.3rdparty.call_stack/stack_walker.cpp:252:13: warning: cast between incompatible function types from 'FARPROC' {aka 'long long int (*)()'} to 'StackWalkerInternal::tSGMB' {aka 'long long unsigned int (*)(void*, long long unsigned int)'} [-Wcast-function-type]
  252 |     pSGMB = (tSGMB) GetProcAddress(m_hDbhHelp, "SymGetModuleBase64");
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:/msys64/home/Administrator/xtd/src/xtd.3rdparty.call_stack/stack_walker.cpp:253:13: warning: cast between incompatible function types from 'FARPROC' {aka 'long long int (*)()'} to 'StackWalkerInternal::tSGMI' {aka 'int (*)(void*, long long unsigned int, StackWalkerInternal::IMAGEHLP_MODULE64_V2*)'} [-Wcast-function-type]
  253 |     pSGMI = (tSGMI) GetProcAddress(m_hDbhHelp, "SymGetModuleInfo64");
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:/msys64/home/Administrator/xtd/src/xtd.3rdparty.call_stack/stack_walker.cpp:255:14: warning: cast between incompatible function types from 'FARPROC' {aka 'long long int (*)()'} to 'StackWalkerInternal::tSGSFA' {aka 'int (*)(void*, long long unsigned int, long long unsigned int*, _IMAGEHLP_SYMBOL64*)'} [-Wcast-function-type]
  255 |     pSGSFA = (tSGSFA) GetProcAddress(m_hDbhHelp, "SymGetSymFromAddr64");
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:/msys64/home/Administrator/xtd/src/xtd.3rdparty.call_stack/stack_walker.cpp:256:13: warning: cast between incompatible function types from 'FARPROC' {aka 'long long int (*)()'} to 'StackWalkerInternal::tUDSN' {aka 'long unsigned int (*)(const char*, char*, long unsigned int, long unsigned int)'} [-Wcast-function-type]
  256 |     pUDSN = (tUDSN) GetProcAddress(m_hDbhHelp, "UnDecorateSymbolName");
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:/msys64/home/Administrator/xtd/src/xtd.3rdparty.call_stack/stack_walker.cpp:257:12: warning: cast between incompatible function types from 'FARPROC' {aka 'long long int (*)()'} to 'StackWalkerInternal::tSLM' {aka 'long long unsigned int (*)(void*, void*, char*, char*, long long unsigned int, long unsigned int)'} [-Wcast-function-type]
  257 |     pSLM = (tSLM) GetProcAddress(m_hDbhHelp, "SymLoadModule64");
      |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:/msys64/home/Administrator/xtd/src/xtd.3rdparty.call_stack/stack_walker.cpp:258:13: warning: cast between incompatible function types from 'FARPROC' {aka 'long long int (*)()'} to 'StackWalkerInternal::tSGSP' {aka 'int (*)(void*, char*, long unsigned int)'} [-Wcast-function-type]
  258 |     pSGSP = (tSGSP) GetProcAddress(m_hDbhHelp, "SymGetSearchPath");
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:/msys64/home/Administrator/xtd/src/xtd.3rdparty.call_stack/stack_walker.cpp: In member function 'BOOL StackWalkerInternal::GetModuleListTH32(HANDLE, DWORD)':
C:/msys64/home/Administrator/xtd/src/xtd.3rdparty.call_stack/stack_walker.cpp:458:16: warning: cast between incompatible function types from 'FARPROC' {aka 'long long int (*)()'} to 'tCT32S' {aka 'void* (*)(long unsigned int, long unsigned int)'} [-Wcast-function-type]
  458 |       pCT32S = (tCT32S) GetProcAddress(hToolhelp, "CreateToolhelp32Snapshot");
      |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:/msys64/home/Administrator/xtd/src/xtd.3rdparty.call_stack/stack_walker.cpp:459:15: warning: cast between incompatible function types from 'FARPROC' {aka 'long long int (*)()'} to 'tM32F' {aka 'int (*)(void*, StackWalkerInternal::tagMODULEENTRY32*)'} [-Wcast-function-type]
  459 |       pM32F = (tM32F) GetProcAddress(hToolhelp, "Module32First");
      |               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:/msys64/home/Administrator/xtd/src/xtd.3rdparty.call_stack/stack_walker.cpp:460:15: warning: cast between incompatible function types from 'FARPROC' {aka 'long long int (*)()'} to 'tM32N' {aka 'int (*)(void*, StackWalkerInternal::tagMODULEENTRY32*)'} [-Wcast-function-type]
  460 |       pM32N = (tM32N) GetProcAddress(hToolhelp, "Module32Next");
      |               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:/msys64/home/Administrator/xtd/src/xtd.3rdparty.call_stack/stack_walker.cpp: In member function 'BOOL StackWalkerInternal::GetModuleListPSAPI(HANDLE)':
C:/msys64/home/Administrator/xtd/src/xtd.3rdparty.call_stack/stack_walker.cpp:525:12: warning: cast between incompatible function types from 'FARPROC' {aka 'long long int (*)()'} to 'tEPM' {aka 'int (*)(void*, HINSTANCE__**, long unsigned int, long unsigned int*)'} [-Wcast-function-type]
  525 |     pEPM = (tEPM) GetProcAddress(hPsapi, "EnumProcessModules");
      |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:/msys64/home/Administrator/xtd/src/xtd.3rdparty.call_stack/stack_walker.cpp:526:14: warning: cast between incompatible function types from 'FARPROC' {aka 'long long int (*)()'} to 'tGMFNE' {aka 'long unsigned int (*)(void*, HINSTANCE__*, char*, long unsigned int)'} [-Wcast-function-type]
  526 |     pGMFNE = (tGMFNE) GetProcAddress(hPsapi, "GetModuleFileNameExA");
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:/msys64/home/Administrator/xtd/src/xtd.3rdparty.call_stack/stack_walker.cpp:527:13: warning: cast between incompatible function types from 'FARPROC' {aka 'long long int (*)()'} to 'tGMFNE' {aka 'long unsigned int (*)(void*, HINSTANCE__*, char*, long unsigned int)'} [-Wcast-function-type]
  527 |     pGMBN = (tGMFNE) GetProcAddress(hPsapi, "GetModuleBaseNameA");
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:/msys64/home/Administrator/xtd/src/xtd.3rdparty.call_stack/stack_walker.cpp:528:12: warning: cast between incompatible function types from 'FARPROC' {aka 'long long int (*)()'} to 'tGMI' {aka 'int (*)(void*, HINSTANCE__*, StackWalkerInternal::_MODULEINFO*, long unsigned int)'} [-Wcast-function-type]
  528 |     pGMI = (tGMI) GetProcAddress(hPsapi, "GetModuleInformation");
      |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:/msys64/home/Administrator/xtd/src/xtd.3rdparty.call_stack/stack_walker.cpp:535:75: error: expected primary-expression before ')' token
  535 |     hMods = (HMODULE*) malloc(sizeof(HMODULE) * (TTBUFLEN / sizeof HMODULE));
      |                                                                           ^
C:/msys64/home/Administrator/xtd/src/xtd.3rdparty.call_stack/stack_walker.cpp: In member function 'DWORD StackWalkerInternal::LoadModule(HANDLE, LPCSTR, LPCSTR, DWORD64, DWORD)':
C:/msys64/home/Administrator/xtd/src/xtd.3rdparty.call_stack/stack_walker.cpp:613:16: warning: enumeration value 'SymDia' not handled in switch [-Wswitch]
  613 |         switch (Module.SymType) {
      |                ^
C:/msys64/home/Administrator/xtd/src/xtd.3rdparty.call_stack/stack_walker.cpp: In member function 'virtual void StackWalker::OnLoadModule(LPCSTR, LPCSTR, DWORD64, DWORD, DWORD, LPCSTR, LPCSTR, ULONGLONG)':
C:/msys64/home/Administrator/xtd/src/xtd.3rdparty.call_stack/stack_walker.cpp:1041:68: warning: format '%d' expects argument of type 'int', but argument 7 has type 'DWORD' {aka 'long unsigned int'} [-Wformat=]
 1041 |     _snprintf_s(buffer, STACKWALK_MAX_NAMELEN, "%s:%s (%p), size: %d (result: %d), SymType: '%s', PDB: '%s'\n", img, mod, (LPVOID) baseAddr, size, result, symType, pdbName);
      |                                                                   ~^                                                                         ~~~~
      |                                                                    |                                                                         |
      |                                                                    int                                                                       DWORD {aka long unsigned int}
      |                                                                   %ld
C:/msys64/home/Administrator/xtd/src/xtd.3rdparty.call_stack/stack_walker.cpp:1041:80: warning: format '%d' expects argument of type 'int', but argument 8 has type 'DWORD' {aka 'long unsigned int'} [-Wformat=]
 1041 |     _snprintf_s(buffer, STACKWALK_MAX_NAMELEN, "%s:%s (%p), size: %d (result: %d), SymType: '%s', PDB: '%s'\n", img, mod, (LPVOID) baseAddr, size, result, symType, pdbName);
      |                                                                               ~^                                                                   ~~~~~~
      |                                                                                |                                                                   |
      |                                                                                int                                                                 DWORD {aka long unsigned int}
      |                                                                               %ld
C:/msys64/home/Administrator/xtd/src/xtd.3rdparty.call_stack/stack_walker.cpp:1047:68: warning: format '%d' expects argument of type 'int', but argument 7 has type 'DWORD' {aka 'long unsigned int'} [-Wformat=]
 1047 |     _snprintf_s(buffer, STACKWALK_MAX_NAMELEN, "%s:%s (%p), size: %d (result: %d), SymType: '%s', PDB: '%s', fileVersion: %d.%d.%d.%d\n", img, mod, (LPVOID) baseAddr, size, result, symType, pdbName, v1, v2, v3, v4);
      |                                                                   ~^                                                                                                   ~~~~
      |                                                                    |                                                                                                   |
      |                                                                    int                                                                                                 DWORD {aka long unsigned int}
      |                                                                   %ld
C:/msys64/home/Administrator/xtd/src/xtd.3rdparty.call_stack/stack_walker.cpp:1047:80: warning: format '%d' expects argument of type 'int', but argument 8 has type 'DWORD' {aka 'long unsigned int'} [-Wformat=]
 1047 |     _snprintf_s(buffer, STACKWALK_MAX_NAMELEN, "%s:%s (%p), size: %d (result: %d), SymType: '%s', PDB: '%s', fileVersion: %d.%d.%d.%d\n", img, mod, (LPVOID) baseAddr, size, result, symType, pdbName, v1, v2, v3, v4);
      |                                                                               ~^                                                                                             ~~~~~~
      |                                                                                |                                                                                             |
      |                                                                                int                                                                                           DWORD {aka long unsigned int}
      |                                                                               %ld
C:/msys64/home/Administrator/xtd/src/xtd.3rdparty.call_stack/stack_walker.cpp:1047:124: warning: format '%d' expects argument of type 'int', but argument 11 has type 'DWORD' {aka 'long unsigned int'} [-Wformat=]
 1047 |     _snprintf_s(buffer, STACKWALK_MAX_NAMELEN, "%s:%s (%p), size: %d (result: %d), SymType: '%s', PDB: '%s', fileVersion: %d.%d.%d.%d\n", img, mod, (LPVOID) baseAddr, size, result, symType, pdbName, v1, v2, v3, v4);
      |                                                                                                                           ~^                                                                           ~~
      |                                                                                                                            |                                                                           |
      |                                                                                                                            int                                                                         DWORD {aka long unsigned int}
      |                                                                                                                           %ld
C:/msys64/home/Administrator/xtd/src/xtd.3rdparty.call_stack/stack_walker.cpp:1047:127: warning: format '%d' expects argument of type 'int', but argument 12 has type 'DWORD' {aka 'long unsigned int'} [-Wformat=]
 1047 |     _snprintf_s(buffer, STACKWALK_MAX_NAMELEN, "%s:%s (%p), size: %d (result: %d), SymType: '%s', PDB: '%s', fileVersion: %d.%d.%d.%d\n", img, mod, (LPVOID) baseAddr, size, result, symType, pdbName, v1, v2, v3, v4);
      |                                                                                                                              ~^                                                                            ~~
      |                                                                                                                               |                                                                            |
      |                                                                                                                               int                                                                          DWORD {aka long unsigned int}
      |                                                                                                                              %ld
C:/msys64/home/Administrator/xtd/src/xtd.3rdparty.call_stack/stack_walker.cpp:1047:130: warning: format '%d' expects argument of type 'int', but argument 13 has type 'DWORD' {aka 'long unsigned int'} [-Wformat=]
 1047 |     _snprintf_s(buffer, STACKWALK_MAX_NAMELEN, "%s:%s (%p), size: %d (result: %d), SymType: '%s', PDB: '%s', fileVersion: %d.%d.%d.%d\n", img, mod, (LPVOID) baseAddr, size, result, symType, pdbName, v1, v2, v3, v4);
      |                                                                                                                                 ~^                                                                             ~~
      |                                                                                                                                  |                                                                             |
      |                                                                                                                                  int                                                                           DWORD {aka long unsigned int}
      |                                                                                                                                 %ld
C:/msys64/home/Administrator/xtd/src/xtd.3rdparty.call_stack/stack_walker.cpp:1047:133: warning: format '%d' expects argument of type 'int', but argument 14 has type 'DWORD' {aka 'long unsigned int'} [-Wformat=]
 1047 |     _snprintf_s(buffer, STACKWALK_MAX_NAMELEN, "%s:%s (%p), size: %d (result: %d), SymType: '%s', PDB: '%s', fileVersion: %d.%d.%d.%d\n", img, mod, (LPVOID) baseAddr, size, result, symType, pdbName, v1, v2, v3, v4);
      |                                                                                                                                    ~^                                                                              ~~
      |                                                                                                                                     |                                                                              |
      |                                                                                                                                     int                                                                            DWORD {aka long unsigned int}
      |                                                                                                                                    %ld
C:/msys64/home/Administrator/xtd/src/xtd.3rdparty.call_stack/stack_walker.cpp: In member function 'virtual void StackWalker::OnCallstackEntry(CallstackEntryType, CallstackEntry&)':
C:/msys64/home/Administrator/xtd/src/xtd.3rdparty.call_stack/stack_walker.cpp:1067:56: warning: format '%d' expects argument of type 'int', but argument 5 has type 'DWORD' {aka 'long unsigned int'} [-Wformat=]
 1067 |       _snprintf_s(buffer, STACKWALK_MAX_NAMELEN, "%s (%d): %s\n", entry.lineFileName, entry.lineNumber, entry.name);
      |                                                       ~^                              ~~~~~~~~~~~~~~~~
      |                                                        |                                    |
      |                                                        int                                  DWORD {aka long unsigned int}
      |                                                       %ld
C:/msys64/home/Administrator/xtd/src/xtd.3rdparty.call_stack/stack_walker.cpp: In member function 'virtual void StackWalker::OnDbgHelpErr(LPCSTR, DWORD, DWORD64)':
C:/msys64/home/Administrator/xtd/src/xtd.3rdparty.call_stack/stack_walker.cpp:1074:73: warning: format '%d' expects argument of type 'int', but argument 5 has type 'DWORD' {aka 'long unsigned int'} [-Wformat=]
 1074 |   _snprintf_s(buffer, STACKWALK_MAX_NAMELEN, "ERROR: %s, GetLastError: %d (Address: %p)\n", szFuncName, gle, (LPVOID) addr);
      |                                                                        ~^                               ~~~
      |                                                                         |                               |
      |                                                                         int                             DWORD {aka long unsigned int}
      |                                                                        %ld
C:/msys64/home/Administrator/xtd/src/xtd.3rdparty.call_stack/stack_walker.cpp: In member function 'virtual void StackWalker::OnSymInit(LPCSTR, DWORD, LPCSTR)':
C:/msys64/home/Administrator/xtd/src/xtd.3rdparty.call_stack/stack_walker.cpp:1080:94: warning: format '%d' expects argument of type 'int', but argument 5 has type 'DWORD' {aka 'long unsigned int'} [-Wformat=]
 1080 |   _snprintf_s(buffer, STACKWALK_MAX_NAMELEN, "SymInit: Symbol-SearchPath: '%s', symOptions: %d, UserName: '%s'\n", szSearchPath, symOptions, szUserName);
      |                                                                                             ~^                                   ~~~~~~~~~~
      |                                                                                              |                                   |
      |                                                                                              int                                 DWORD {aka long unsigned int}
      |                                                                                             %ld
C:/msys64/home/Administrator/xtd/src/xtd.3rdparty.call_stack/stack_walker.cpp:1088:62: warning: format '%d' expects argument of type 'int', but argument 4 has type 'DWORD' {aka 'long unsigned int'} [-Wformat=]
 1088 |     _snprintf_s(buffer, STACKWALK_MAX_NAMELEN, "OS-Version: %d.%d.%d (%s)\n",
      |                                                             ~^
      |                                                              |
      |                                                              int
      |                                                             %ld
 1089 |       ver.dwMajorVersion, ver.dwMinorVersion, ver.dwBuildNumber,
      |       ~~~~~~~~~~~~~~~~~~
      |           |
      |           DWORD {aka long unsigned int}
C:/msys64/home/Administrator/xtd/src/xtd.3rdparty.call_stack/stack_walker.cpp:1088:65: warning: format '%d' expects argument of type 'int', but argument 5 has type 'DWORD' {aka 'long unsigned int'} [-Wformat=]
 1088 |     _snprintf_s(buffer, STACKWALK_MAX_NAMELEN, "OS-Version: %d.%d.%d (%s)\n",
      |                                                                ~^
      |                                                                 |
      |                                                                 int
      |                                                                %ld
 1089 |       ver.dwMajorVersion, ver.dwMinorVersion, ver.dwBuildNumber,
      |                           ~~~~~~~~~~~~~~~~~~
      |                               |
      |                               DWORD {aka long unsigned int}
C:/msys64/home/Administrator/xtd/src/xtd.3rdparty.call_stack/stack_walker.cpp:1088:68: warning: format '%d' expects argument of type 'int', but argument 6 has type 'DWORD' {aka 'long unsigned int'} [-Wformat=]
 1088 |     _snprintf_s(buffer, STACKWALK_MAX_NAMELEN, "OS-Version: %d.%d.%d (%s)\n",
      |                                                                   ~^
      |                                                                    |
      |                                                                    int
      |                                                                   %ld
 1089 |       ver.dwMajorVersion, ver.dwMinorVersion, ver.dwBuildNumber,
      |                                               ~~~~~~~~~~~~~~~~~
      |                                                   |
      |                                                   DWORD {aka long unsigned int}
ninja: build stopped: subcommand failed.
gammasoft71 commented 1 year ago

Thanks for the logs. This seems to be a big problem in the thirdparty StackTrace library. 🙁

Unfortunately, there is no support for this code anymore.

So I will install in a VM a Windows and MMSYS2 (MinGW64) to try to fix the problem.

If I don't succeed to fix the problem, there will simply be no stack traces with Windows and MSYS2 (MinGW32 and MinGW64).

Note:

It might be necessary to find another portable and maintained library to handle stack traces.

ghost commented 1 year ago

Is there any progress on this?

gammasoft71 commented 11 months ago

I'm trying to build xtd with MSYS2. I have defined the necessary packages with pacman.

The problem I'm having is with the path definition in cmake between the gtk3 libraries (which has the correct path style) but wxwidgets has the wrong path style, in fact, the library has paths formatted for windows.

I don't have a nice solution for integrating this into cmake.

If anyone can, please send me a PR to correct the problem.

ghost commented 10 months ago

I'm trying to build xtd with MSYS2. I have defined the necessary packages with pacman.

The problem I'm having is with the path definition in cmake between the gtk3 libraries (which has the correct path style) but wxwidgets has the wrong path style, in fact, the library has paths formatted for windows.

I don't have a nice solution for integrating this into cmake.

If anyone can, please send me a PR to correct the problem.

Care to elaborate more? Because wx-config gives the correct path style for me.

gammasoft71 commented 9 months ago

Hi @iahung2,

First of all, thank you for your interest in xtd.

I no longer have the same problem as described above. But I still have a problem. Perhaps this is due to the various updates that have taken place since then.

To begin with, before testing xtd, I'll do a simple test.

I want to compile a simple example wxWidgets. And it doesn't work cmake can't find the wxWidgets package.

Here is my configuration :

Simple Project:

#include <wx/wx.h>

namespace HelloWorldStaticTextExample {
  class Frame : public wxFrame {
  public:
    Frame() : wxFrame(nullptr, wxID_ANY, "Hello world (Static text)") {
      staticText1->SetFont({32, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_ITALIC, wxFONTWEIGHT_BOLD});
      staticText1->SetForegroundColour(wxTheColourDatabase->Find("Forest Green"));
    }

  private:
    wxStaticText* staticText1 = new wxStaticText(this, wxID_ANY, "Hello, World!", wxDefaultPosition, wxDefaultSize, wxALIGN_CENTER);
  };

  class Application : public wxApp {
    bool OnInit() override {
      (new Frame())->Show();
      return true;
    }
  };
}

wxIMPLEMENT_APP(HelloWorldStaticTextExample::Application);

Project

project(HelloWorldStaticText)

find_package(wxWidgets REQUIRED) include(${wxWidgets_USE_FILE})

set(SOURCES README.md HelloWorldStaticText.cpp)

Options

set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON)

Target

add_executable(${PROJECT_NAME} WIN32 MACOSX_BUNDLE ${SOURCES}) target_link_libraries(${PROJECT_NAME} ${wxWidgets_LIBRARIES}) set_target_properties(${PROJECT_NAME} PROPERTIES FOLDER "HelloWorlds")


* Result

-- The C compiler identification is GNU 11.3.0 -- The CXX compiler identification is GNU 11.3.0 System is unknown to cmake, create: Platform/MINGW64_NT-10.0-22621 to use this system, please post your config file on discourse.cmake.org so it can be added to cmake -- Detecting C compiler ABI info System is unknown to cmake, create: Platform/MINGW64_NT-10.0-22621 to use this system, please post your config file on discourse.cmake.org so it can be added to cmake -- Detecting C compiler ABI info - done -- Check for working C compiler: /usr/bin/cc.exe - skipped -- Detecting C compile features -- Detecting C compile features - done -- Detecting CXX compiler ABI info System is unknown to cmake, create: Platform/MINGW64_NT-10.0-22621 to use this system, please post your config file on discourse.cmake.org so it can be added to cmake -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: /usr/bin/CC.exe - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done CMake Error at /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:230 (message): Could NOT find wxWidgets (missing: wxWidgets_LIBRARIES wxWidgets_INCLUDE_DIRS) Call Stack (most recent call first): /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:600 (_FPHSA_FAILURE_MESSAGE) /usr/share/cmake/Modules/FindwxWidgets.cmake:977 (find_package_handle_standard_args) CMakeLists.txt:6 (find_package)

-- Configuring incomplete, errors occurred! See also "/home/yves/Projects/Examples_wxWidgets/src/HelloWorlds/HelloWorldStaticText/build/CMakeFiles/CMakeOutput.log".



**CMake can't find the wxWidgets library. Maybe the problem is that I'm using an ARM processor and not an Intel one?
I don't know...**

If it works for you, can you tell me what the difference might be with my test?

Thank you in advance.
ghost commented 9 months ago

@gammasoft71 You are using the CLANGARM64 shell, but installed packages for the x86_64 architecture! The prefix for packages on CLANGARM64 is mingw-w64-clang-aarch64-, not mingw-w64-ucrt-x86_64- or mingw-w64-x86_64-. The packages without prefix are for the MSYS environment (a Cygwin fork that provides POSIX emulation). They are for the x86_64 architecture, too. The rule of thumb is, if the native packages (have prefix) are available, then install them instead of the ones without prefix. For example, install mingw-w64-clang-aarch64-cmake instead of cmake. You installed the wrong packages, but you don't have to uninstall them. Just install the correct packages and the correct packages will take precedence.

gammasoft71 commented 9 months ago

Sorry it's my bad... I'm not awake today, I'm oponed the bad shell... ;-)

With the right shell : MSYS2 CLANGMINGW64 Shell

-- The C compiler identification is GNU 13.1.0
-- The CXX compiler identification is GNU 13.1.0
System is unknown to cmake, create:
Platform/MINGW64_NT-10.0-22621 to use this system, please post your config file on discourse.cmake.org so it can be added to cmake
-- Detecting C compiler ABI info
System is unknown to cmake, create:
Platform/MINGW64_NT-10.0-22621 to use this system, please post your config file on discourse.cmake.org so it can be added to cmake
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /mingw64/bin/cc.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
System is unknown to cmake, create:
Platform/MINGW64_NT-10.0-22621 to use this system, please post your config file on discourse.cmake.org so it can be added to cmake
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /mingw64/bin/CC.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at /usr/share/cmake/Modules/FindwxWidgets.cmake:228 (file):
  file failed to open for reading (No such file or directory):

    /home/yves/Projects/Examples_wxWidgets/src/HelloWorlds/HelloWorldStaticText/C:/msys64/mingw64/include/wx-3.2/wx/version.h
Call Stack (most recent call first):
  /usr/share/cmake/Modules/FindwxWidgets.cmake:955 (wx_extract_version)
  CMakeLists.txt:6 (find_package)

-- Found wxWidgets: -LC:/msys64/mingw64/lib;;;-pipe;-Wl,--subsystem,windows;-mwindows;-lwx_mswu_xrc-3.2;-lwx_mswu_html-3.2;-lwx_mswu_qa-3.2;-lwx_mswu_core-3.2;-lwx_baseu_xml-3.2;-lwx_baseu_net-3.2;-lwx_baseu-3.2 (Required is at least version "3.2")
-- Configuring incomplete, errors occurred!
See also "/home/yves/Projects/Examples_wxWidgets/src/HelloWorlds/HelloWorldStaticText/build/CMakeFiles/CMakeOutput.log".

CMake can't find wxWidgets either.

ghost commented 9 months ago

First, remove README.md from SOURCES on your CMakeLists.txt. Second, you are using the wrong version of cmake. As I said, install the package with prefix, the package without prefix will not work. Please re-read my previous post. Btw, I have your sample code compiled and working.

$ file HelloWorldStaticText.exe
HelloWorldStaticText.exe: PE32+ executable (GUI) x86-64, for MS Windows, 20 sections
$ ldd HelloWorldStaticText.exe
        ntdll.dll => /c/Windows/SYSTEM32/ntdll.dll (0x7fff47800000)
        KERNEL32.DLL => /c/Windows/system32/KERNEL32.DLL (0x7fff468c0000)
        KERNELBASE.dll => /c/Windows/system32/KERNELBASE.dll (0x7fff44a20000)
        libgcc_s_seh-1.dll => /mingw64/bin/libgcc_s_seh-1.dll (0x7fff20940000)
        msvcrt.dll => /c/Windows/system32/msvcrt.dll (0x7fff475a0000)
        libstdc++-6.dll => /mingw64/bin/libstdc++-6.dll (0x7fff1de60000)
        wxbase32u_gcc_custom.dll => /mingw64/bin/wxbase32u_gcc_custom.dll (0x7fff1dbb0000)
        wxmsw32u_core_gcc_custom.dll => /mingw64/bin/wxmsw32u_core_gcc_custom.dll (0x7fff1d360000)
        libwinpthread-1.dll => /mingw64/bin/libwinpthread-1.dll (0x7fff30b40000)
        ADVAPI32.dll => /c/Windows/system32/ADVAPI32.dll (0x7fff46d30000)
        liblzma-5.dll => /mingw64/bin/liblzma-5.dll (0x7fff20270000)
        ole32.dll => /c/Windows/system32/ole32.dll (0x7fff46a00000)
        SHELL32.dll => /c/Windows/system32/SHELL32.dll (0x7fff452a0000)
        SHLWAPI.dll => /c/Windows/system32/SHLWAPI.dll (0x7fff47000000)
        USER32.dll => /c/Windows/system32/USER32.dll (0x7fff45120000)
        VERSION.dll => /c/Windows/SYSTEM32/VERSION.dll (0x7fff3d800000)
        zlib1.dll => /mingw64/bin/zlib1.dll (0x7fff20240000)
        COMCTL32.dll => /c/Windows/WinSxS/amd64_microsoft.windows.common-controls_6595b64144ccf1df_5.82.9600.17415_none_34aa3313958e7a52/COMCTL32.dll (0x7fff1fd00000)
        comdlg32.dll => /c/Windows/system32/comdlg32.dll (0x7fff46f40000)
        GDI32.dll => /c/Windows/system32/GDI32.dll (0x7fff44f50000)
        libjpeg-8.dll => /mingw64/bin/libjpeg-8.dll (0x7fff1d250000)
        OLEACC.dll => /c/Windows/SYSTEM32/OLEACC.dll (0x7fff40130000)
        OLEAUT32.dll => /c/Windows/system32/OLEAUT32.dll (0x7fff467e0000)
        libpng16-16.dll => /mingw64/bin/libpng16-16.dll (0x7fff1f980000)
        RPCRT4.dll => /c/Windows/system32/RPCRT4.dll (0x7fff46be0000)
        libtiff-6.dll => /mingw64/bin/libtiff-6.dll (0x7fff1ed70000)
        UxTheme.dll => /c/Windows/SYSTEM32/UxTheme.dll (0x7fff435d0000)
        WINMM.dll => /c/Windows/SYSTEM32/WINMM.dll (0x7fff3ba60000)
        WINSPOOL.DRV => /c/Windows/SYSTEM32/WINSPOOL.DRV (0x7fff34f20000)
        sechost.dll => /c/Windows/SYSTEM32/sechost.dll (0x7fff47540000)
        combase.dll => /c/Windows/SYSTEM32/combase.dll (0x7fff470d0000)
        libdeflate.dll => /mingw64/bin/libdeflate.dll (0x7fff20220000)
        libjbig-0.dll => /mingw64/bin/libjbig-0.dll (0x7fff20200000)
        libLerc.dll => /mingw64/bin/libLerc.dll (0x7fff1d180000)
        libwebp-7.dll => /mingw64/bin/libwebp-7.dll (0x7fff1d0c0000)
        libzstd.dll => /mingw64/bin/libzstd.dll (0x7fff1cf90000)
        WINMMBASE.dll => /c/Windows/SYSTEM32/WINMMBASE.dll (0x7fff3ba30000)
        SHCORE.DLL => /c/Windows/SYSTEM32/SHCORE.DLL (0x7fff42c90000)
        libsharpyuv-0.dll => /mingw64/bin/libsharpyuv-0.dll (0x7fff1fce0000)
        cfgmgr32.dll => /c/Windows/SYSTEM32/cfgmgr32.dll (0x7fff44d20000)
        DEVOBJ.dll => /c/Windows/SYSTEM32/DEVOBJ.dll (0x7fff43750000)
gammasoft71 commented 9 months ago

Thank you for your explanations... I am in the process of creating scripts to install xtd with MSYS2.

ghost commented 8 months ago

@gammasoft71 Any progress?

gammasoft71 commented 8 months ago

On hold for now...

LukyGuyLucky commented 7 months ago

Looking forward to supporting msys/MinGW build under windows (both 32 bit & 64 bit) ,It'd better be as simple as a VS sln. build. Great thanks.

gammasoft71 commented 6 months ago

Done