Author Topic: New Variable to support wx-config in MSys2 MinGW  (Read 3416 times)

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7298
    • My Best Post
New Variable to support wx-config in MSys2 MinGW
« on: May 18, 2022, 11:09:29 pm »
I am working on upgrading wxWidgets version to 3.1.6 in MSys2.

While doing that I tested how to use wx-config-3.1.

And, CB still needs a patch to make it easy to do.

Code
Index: src/sdk/macrosmanager.cpp
===================================================================
--- src/sdk/macrosmanager.cpp (revision 12814)
+++ src/sdk/macrosmanager.cpp (working copy)
@@ -394,6 +394,8 @@
             wxFileName MasterPath;
             MasterPath.SetPath(c->GetMasterPath(), wxPATH_NATIVE);
             m_Macros[_T("TARGET_COMPILER_DIR")] = MasterPath.GetPathWithSep(wxPATH_NATIVE);
+            m_Macros[_T("TARGET_COMPILER_UNIX_PATH")] = MasterPath.GetPath(wxPATH_GET_VOLUME, wxPATH_UNIX);
+            m_Macros[_T("TARGET_COMPILER_VOLUME")] = MasterPath.GetVolume();
         }
         m_Macros[_T("TARGET_OBJECT_DIR")] = target->GetObjectOutput();
     }

TARGET_COMPILER_UNIX_PATH is like TARGET_COMPILER_DIR but, it always uses forward slashes and does not have a slash at the end. And, it does not show the drive letter like I thought it would.

So, I also added TARGET_COMPILER_VOLUME which will be just the drive letter.

custom variable
Code
WX_CONFIG=wx-config-3.1 --prefix=$(TARGET_COMPILER_VOLUME):$(TARGET_COMPILER_UNIX_PATH)

Extra setting entry example
Code
`sh.exe -c '$(WX_CONFIG) --cflags'`

Global Compiler Additional paths; this may be needed with wxWidgets 3.1.6; might not be needed with 3.1.5 msys2 library
Code
$(TARGET_COMPILER_DIR)../usr/bin
« Last Edit: May 18, 2022, 11:11:21 pm by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Online ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5625
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: New Variable to support wx-config in MSys2 MinGW
« Reply #1 on: May 19, 2022, 07:10:00 am »
Hi, Tim, thanks, I am also interested on this usage.

But:

Code
WX_CONFIG=wx-config-3.1 --prefix=$(TARGET_COMPILER_VOLUME):$(TARGET_COMPILER_UNIX_PATH)

Do we need two variables? I mean maybe we only need one variable to handle this?
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7298
    • My Best Post
Re: New Variable to support wx-config in MSys2 MinGW
« Reply #2 on: May 19, 2022, 07:30:32 am »
Hi, Tim, thanks, I am also interested on this usage.

But:

Code
WX_CONFIG=wx-config-3.1 --prefix=$(TARGET_COMPILER_VOLUME):$(TARGET_COMPILER_UNIX_PATH)

Do we need two variables? I mean maybe we only need one variable to handle this?

The logic would need to be more complex to have only one variable and a few years back a posted a patch that used only one and it was never applied.

If you wish to do a more complex patch feel free. I thought that having an variable that was useful under Linux would help get the change applied.

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Online ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5625
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: New Variable to support wx-config in MSys2 MinGW
« Reply #3 on: May 19, 2022, 07:44:54 am »
The logic would need to be more complex to have only one variable and a few years back a posted a patch that used only one and it was never applied.

Can you tell me where is the "posted patch", thanks!

I will have a look at that patch.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Online ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5625
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: New Variable to support wx-config in MSys2 MinGW
« Reply #4 on: May 19, 2022, 08:21:38 am »
I just did some test:

Code
F:\code>sh.exe -c 'wx-config-3.1 --prefix=F:/code/msys2-64/mingw64/ --libs all'
-LF:/code/msys2-64/mingw64//lib   -pipe -Wl,--dynamicbase,--high-entropy-va,--nxcompat,--default-image-base-high -Wl,--subsystem,windows -mwindows -lwx_mswu_xrc-3.1 -lwx_mswu_webview-3.1 -lwx_mswu_stc
-3.1 -lwx_mswu_richtext-3.1 -lwx_mswu_ribbon-3.1 -lwx_mswu_propgrid-3.1 -lwx_mswu_aui-3.1 -lwx_mswu_gl-3.1 -lwx_mswu_html-3.1 -lwx_mswu_qa-3.1 -lwx_mswu_core-3.1 -lwx_baseu_xml-3.1 -lwx_baseu_net-3.1
-lwx_baseu-3.1

F:\code>sh.exe -c 'wx-config-3.1 --prefix=F:\code\msys2-64\mingw64\ --libs all'


So, you can see, we only need the "/" (forward slash) path separator version of the TARGET_COMPILER_DIR?
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Online ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5625
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: New Variable to support wx-config in MSys2 MinGW
« Reply #5 on: May 19, 2022, 08:29:22 am »
There is a command named "cygpath", which can do such convert

Code
F:\code>cygpath -m F:\code\msys2-64\mingw64\
F:/code/msys2-64/mingw64/

So, either we can define a new variable like "TARGET_COMPILER_DIR_UNIX_SEP" or we may use the cygpath command some where.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Online ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5625
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: New Variable to support wx-config in MSys2 MinGW
« Reply #6 on: May 19, 2022, 08:37:06 am »
Code
F:\code>sh.exe -c 'wx-config-3.1 --prefix=`cygpath -m F:\code\msys2-64\mingw64\ ` --libs all'
-LF:codemsys2-64mingw64/lib   -pipe -Wl,--dynamicbase,--high-entropy-va,--nxcompat,--default-image-base-high -Wl,--subsystem,windows -mwindows -lwx_mswu_xrc-3.1 -lwx_mswu_webview-3.1 -lwx_mswu_stc-3.1
 -lwx_mswu_richtext-3.1 -lwx_mswu_ribbon-3.1 -lwx_mswu_propgrid-3.1 -lwx_mswu_aui-3.1 -lwx_mswu_gl-3.1 -lwx_mswu_html-3.1 -lwx_mswu_qa-3.1 -lwx_mswu_core-3.1 -lwx_baseu_xml-3.1 -lwx_baseu_net-3.1 -lwx
_baseu-3.1


This works, but please note that there is a space after the string "F:\code\msys2-64\mingw64\". Also, I don't know how to do this inside the C::B build option.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7298
    • My Best Post
Re: New Variable to support wx-config in MSys2 MinGW
« Reply #7 on: May 19, 2022, 08:53:23 am »
Could not find what I thought I did.
But, I found a more complex solution.

Your stuff will likely fail to work; but, try doing it. Maybe you have better luck; I really do not know CB scripting and I think it might be simple using CB scripting.

If you want a better fix than fix the below so it works in setting a custom variable.
Code
$TO_UNIX_PATH{$(TARGET_COMPILER_DIR)}

Everything I try failed to work in setting a custom variable; the two lines work patch I posted yesterday.
I just recalled the changing of TARGET_COMPILER_DIR patch was posted by someone else.
I cannot remember who did it; but, it just changed the "\"  to "/" and I think it removed the trailing slash.

Tim S.

« Last Edit: May 19, 2022, 09:16:13 am by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7298
    • My Best Post
Re: New Variable to support wx-config in MSys2 MinGW
« Reply #8 on: May 19, 2022, 09:36:32 am »
Code
Index: src/sdk/macrosmanager.cpp
===================================================================
--- src/sdk/macrosmanager.cpp (revision 12814)
+++ src/sdk/macrosmanager.cpp (working copy)
@@ -394,6 +394,8 @@
             wxFileName MasterPath;
             MasterPath.SetPath(c->GetMasterPath(), wxPATH_NATIVE);
             m_Macros[_T("TARGET_COMPILER_DIR")] = MasterPath.GetPathWithSep(wxPATH_NATIVE);
+            m_Macros[_T("TARGET_COMPILER_UNIX_PATH")] = MasterPath.GetVolume() +
+                     MasterPath.GetVolumeSeparator() + MasterPath.GetPath(wxPATH_GET_VOLUME, wxPATH_UNIX);
         }
         m_Macros[_T("TARGET_OBJECT_DIR")] = target->GetObjectOutput();
     }

I am building CB with the above patch; no idea if it will work; but, the wxWidgets directions implies it might.

Edit: It worked in the wx 3.1 minimal test project. No idea what it will do under wxWidgets 3.0 or under Linux.
Edit2: WX_CONFIG=wx-config-3.1 --prefix=$(TARGET_COMPILER_UNIX_PATH)

Tim S.
« Last Edit: May 19, 2022, 09:50:32 am by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Online ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5625
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: New Variable to support wx-config in MSys2 MinGW
« Reply #9 on: May 19, 2022, 02:22:03 pm »
Hi, Tim, you method works under C::B.

I just add the below line to the linker option:

Code
`sh.exe -c 'wx-config-3.1 --prefix=$TO_UNIX_PATH{$(TARGET_COMPILER_DIR)} --libs all'`

and the linker works correctly(it link to the wx library supplied by msys2).

So, is the patch below still needed?

Code
Index: src/sdk/macrosmanager.cpp
===================================================================
--- src/sdk/macrosmanager.cpp (revision 12814)
+++ src/sdk/macrosmanager.cpp (working copy)
@@ -394,6 +394,8 @@
             wxFileName MasterPath;
             MasterPath.SetPath(c->GetMasterPath(), wxPATH_NATIVE);
             m_Macros[_T("TARGET_COMPILER_DIR")] = MasterPath.GetPathWithSep(wxPATH_NATIVE);
+            m_Macros[_T("TARGET_COMPILER_UNIX_PATH")] = MasterPath.GetVolume() +
+                     MasterPath.GetVolumeSeparator() + MasterPath.GetPath(wxPATH_GET_VOLUME, wxPATH_UNIX);
         }
         m_Macros[_T("TARGET_OBJECT_DIR")] = target->GetObjectOutput();
     }

I am building CB with the above patch; no idea if it will work; but, the wxWidgets directions implies it might.

Edit: It worked in the wx 3.1 minimal test project. No idea what it will do under wxWidgets 3.0 or under Linux.
Edit2: WX_CONFIG=wx-config-3.1 --prefix=$(TARGET_COMPILER_UNIX_PATH)

Tim S.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Online ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5625
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: New Variable to support wx-config in MSys2 MinGW
« Reply #10 on: May 19, 2022, 02:35:46 pm »
Another question:

Why do you need a custom variable like WX_CONFIG?

In my previous post, I don't use a custom variable.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7298
    • My Best Post
Re: New Variable to support wx-config in MSys2 MinGW
« Reply #11 on: May 19, 2022, 03:45:32 pm »
It makes it easy and it is closer to the Linux projects that way.
This should make it easy to change the CB wizards.

Tim S.

Another question:

Why do you need a custom variable like WX_CONFIG?

In my previous post, I don't use a custom variable.
« Last Edit: May 19, 2022, 03:48:14 pm by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7298
    • My Best Post
Re: New Variable to support wx-config in MSys2 MinGW
« Reply #12 on: May 19, 2022, 03:47:00 pm »
But, if the devs ignore my patch I will likely use your way without the custom variable.

I expect them to ignore my patch; so, thanks for testing the project file way only.
I likely would have tried in a month or so. But, I am really have too make to do for my time and energy.
I think I have gotten the wxWidgets 3.1.6 PR to MSys2 MinGW done, but each prior time, either, I or someone else thinks of a new thing to change. I just did the CB stuff to verify that the wxWidgets change did not break this CB stuff.

Tim S.
« Last Edit: May 19, 2022, 03:53:30 pm by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Online ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5625
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: New Variable to support wx-config in MSys2 MinGW
« Reply #13 on: May 19, 2022, 04:22:03 pm »
It makes it easy and it is closer to the Linux projects that way.
This should make it easy to change the CB wizards.

Tim S.

Another question:

Why do you need a custom variable like WX_CONFIG?

In my previous post, I don't use a custom variable.

OK, for me, I think adding a "TARGET_COMPILER_UNIX_PATH" macro is simple and indeed has benefit. We can use either way. A simple wx wizard is very important from my point of view.

If other devs don't have objections, I will apply your patch about "TARGET_COMPILER_UNIX_PATH". Thanks.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Online ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5625
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: New Variable to support wx-config in MSys2 MinGW
« Reply #14 on: May 19, 2022, 04:24:05 pm »

I think I have gotten the wxWidgets 3.1.6 PR to MSys2 MinGW done...

Do you have the direct2D enabled wx 3.1.6 for your PR?
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Online ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5625
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: New Variable to support wx-config in MSys2 MinGW
« Reply #15 on: May 19, 2022, 04:28:23 pm »

I think I have gotten the wxWidgets 3.1.6 PR to MSys2 MinGW done...

Do you have the direct2D enabled wx 3.1.6 for your PR?
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7298
    • My Best Post
Re: New Variable to support wx-config in MSys2 MinGW
« Reply #16 on: May 19, 2022, 04:50:14 pm »

I think I have gotten the wxWidgets 3.1.6 PR to MSys2 MinGW done...

Do you have the direct2D enabled wx 3.1.6 for your PR?

Yep, that was one of the changes I added after the first time I did the PR.
https://github.com/msys2/MINGW-packages/pull/11631

Quote
Summary of the current changes

wxWidgets3.1: Update to version 3.1.6; and,

Removed MSYSTEM guard in "wx-config.in".
Redo manifest filename logic in "wx/msw/wx.rc".
The prior manifest logic failed to work under Clang64.
Add replaces "wxmsw3.1-git" package.
Add "enable-graphics-d2d" to help support Code::Blocks IDE.

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline PB

  • Multiple posting newcomer
  • *
  • Posts: 32
Re: New Variable to support wx-config in MSys2 MinGW
« Reply #17 on: May 20, 2022, 11:52:17 pm »

Summary of the current changes
Redo manifest filename logic in "wx/msw/wx.rc".
The prior manifest logic failed to work under Clang64.

I know virtually nothing about MSYS2 packages but I wonder why are those changes necessary?

I have tried not that long ago and wxWidgets with the unmodified wx.rc builds just fine not only with GCC (package mingw-w64-x86_64-toolchain) but also clang (package mingw-w64-clang-x86_64-toolchain)?

Is there another clang package? I admit I have no idea if that package i listed uses its own resource compiler (llvm-rc) or mingw one (windres).
« Last Edit: May 20, 2022, 11:57:07 pm by PB »

Online ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5625
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: New Variable to support wx-config in MSys2 MinGW
« Reply #18 on: May 21, 2022, 05:20:03 am »
Hi, tim, I add this macro in rev12816. Thanks!
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7298
    • My Best Post
Re: New Variable to support wx-config in MSys2 MinGW
« Reply #19 on: May 22, 2022, 05:20:05 pm »

Summary of the current changes
Redo manifest filename logic in "wx/msw/wx.rc".
The prior manifest logic failed to work under Clang64.

I know virtually nothing about MSYS2 packages but I wonder why are those changes necessary?

I have tried not that long ago and wxWidgets with the unmodified wx.rc builds just fine not only with GCC (package mingw-w64-x86_64-toolchain) but also clang (package mingw-w64-clang-x86_64-toolchain)?

Is there another clang package? I admit I have no idea if that package i listed uses its own resource compiler (llvm-rc) or mingw one (windres).

The library builds without the change; but, some sample(s) will error without the change!
Edit: The UCRT64 use its own resource compiler (llvm-rc)

Tim S.
« Last Edit: May 22, 2022, 05:29:32 pm by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7298
    • My Best Post
Re: New Variable to support wx-config in MSys2 MinGW
« Reply #20 on: August 13, 2022, 04:50:15 am »
Attached CB Project used to test building Code::Blocks using TARGET_COMPILER_UNIX_PATH macro.

The project started off as a copy of "CodeBlocks_wx30-unix.cbp" and was renamed to "CodeBlocks_wx32-msys2.cbp"
The primary purpose was to verify my msys2 mingw64 package had what was needed to build Code::Blocks.
Edit2: My only testing was running the built Code::Blocks and seeing if it could load all the core plugins without any errors.
Edit3: https://packages.msys2.org/base/mingw-w64-wxwidgets3.2

Contents of "updatemsys2.sh"
Code
#!/bin/sh
./update msys2

Tim S.
« Last Edit: August 13, 2022, 05:39:42 am by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Online ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5625
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: New Variable to support wx-config in MSys2 MinGW
« Reply #21 on: August 13, 2022, 09:58:11 am »
Hi, Tim, thanks for your work on the msys2 and wx library.

One question:

Static libraries and headers for wxWidgets 3.2 (mingw-w64)

What is the word "static" means? Do they mean the library is not dll?

EDIT:
My guess is not correct, see this page: https://packages.msys2.org/package/mingw-w64-x86_64-wxwidgets3.2-msw-libs?repo=mingw64
It contains many dll files.
« Last Edit: August 13, 2022, 10:02:18 am by ollydbg »
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Online ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5625
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: New Variable to support wx-config in MSys2 MinGW
« Reply #22 on: August 13, 2022, 04:00:53 pm »
What is the msys2 package do we need to use this cbp?

Code
# pacman -S mingw-w64-x86_64-wxwidgets3.2-msw
# pacman -S mingw-w64-x86_64-wxwidgets3.2-msw-cb_headers

Those two packages?

EDIT:

Where is the "updatemsys2.sh"?
« Last Edit: August 13, 2022, 04:02:26 pm by ollydbg »
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7298
    • My Best Post
Re: New Variable to support wx-config in MSys2 MinGW
« Reply #23 on: August 13, 2022, 05:15:56 pm »
What is the msys2 package do we need to use this cbp?

Code
# pacman -S mingw-w64-x86_64-wxwidgets3.2-msw
# pacman -S mingw-w64-x86_64-wxwidgets3.2-msw-cb_headers

Those two packages?

Those and the depends of them should be enough.
You also need rsync

Quote
EDIT:

Where is the "updatemsys2.sh"?

I pasted the entire file ( 2 lines ) in code tags.

I use below to run the script file from the proper MINGW prompt
Code
./updatemsys2.sh

Edit it might make more sense just to run.
Code
./update msys2

Tim S.
« Last Edit: August 13, 2022, 09:14:27 pm by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Online ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5625
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: New Variable to support wx-config in MSys2 MinGW
« Reply #24 on: August 14, 2022, 05:17:44 am »
Here are some steps I need to use Tim's cbp file:

0, use pacman to install wx library (3.2)

Code
pacman -S mingw-w64-x86_64-wxwidgets3.2-msw
pacman -S mingw-w64-x86_64-wxwidgets3.2-msw-cb_headers

1, Set the compiler path to msys2's mingw 64 bit comipler, in my PC, it is

Code
F:\msys2\mingw64

and put the string

Code
$(TARGET_COMPILER_DIR)../usr/bin

In the "Additional Paths" option in the global Compiler setting.


2, open the cbp file(CodeBlocks_wx32-msys2.cbp), build.


3, in the msys2 mingw64's shell, run the command

Code
./update msys2

Note that those tools are needed to used by the "update" script

Code
pacman -S zip
pacman -S rsync


The result C::B(in the outputmsys2 folder) looks OK  :)

Note this only contains the core plugins.

BTW: it takes about 12 minutes to build the CodeBlocks_wx32-msys2.cbp on my PC, while it takes more than about 35 minutes to let the "Clangd_client" to parse all the 457 source files on my PC.  :(
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7298
    • My Best Post
Re: New Variable to support wx-config in MSys2 MinGW
« Reply #25 on: August 14, 2022, 08:40:23 am »
Thanks for putting the directions needed together. And, one more person confirms the wxWidgets 3.2 package works.

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3255
Re: New Variable to support wx-config in MSys2 MinGW
« Reply #26 on: August 14, 2022, 06:20:35 pm »
Can you put this in the wiki?

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7298
    • My Best Post
Re: New Variable to support wx-config in MSys2 MinGW
« Reply #27 on: August 14, 2022, 06:59:13 pm »
Can you put this in the wiki?

I am creating more CB projects; once I am done will see if I still can edit the wiki.

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline AndrewCot

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 650
Re: New Variable to support wx-config in MSys2 MinGW
« Reply #28 on: August 15, 2022, 04:50:42 am »
I have come across two issues as described below:


WX_CONFIG Library usage
Cannot build SDK target using what I think is the standard using the library linker tag as follows:
    You cannot use the following
        <Add library="`$(WX_CONFIG) --libs std,aui,propgrid`" />
    You need to use this
        <Add option="`$(WX_CONFIG) --libs std,aui,propgrid`" />

    Because the library code does not work with the wx_config results correctly. Another issue is that when using the wx_config as an option the libraries are included in the link command order like they are options and not libraries. The work around in Tim's CodeBlocks_wx32-msys2.zip project is to specify libraries that need to be included before the wxWidgets libraries as an option like:
        <Add option="-lwxscintilla_cb" />

Does anyone know if there is a way to use the library tags instead of option tags? I could not find any way of doing this with the current code that I looked at, but I may not have looked in the right place.


Additional Paths issue and potential changes required:
When you include $(TARGET_COMPILER_DIR)../usr/bin in the "Additional Paths" option in the global Compiler setting then on Windows any existing project that includes the zip command in the <ExtraCommands /> you will need to change the directory delim '\' to '/' if you are using the '/' delim as you will now use the MSYS2 usr/bin/zip instead of your existing windows zip file.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7298
    • My Best Post
Re: New Variable to support wx-config in MSys2 MinGW
« Reply #29 on: August 15, 2022, 05:23:01 am »
I have come across two issues as described below:


WX_CONFIG Library usage
Cannot build SDK target using what I think is the standard using the library linker tag as follows:
    You cannot use the following
        <Add library="`$(WX_CONFIG) --libs std,aui,propgrid`" />
    You need to use this
        <Add option="`$(WX_CONFIG) --libs std,aui,propgrid`" />

I see no difference between what you say works and not works.
Oops I see it now.

Tim S
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Online ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5625
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: New Variable to support wx-config in MSys2 MinGW
« Reply #30 on: August 15, 2022, 05:25:43 am »
I have come across two issues as described below:


WX_CONFIG Library usage
Cannot build SDK target using what I think is the standard using the library linker tag as follows:
    You cannot use the following
        <Add library="`$(WX_CONFIG) --libs std,aui,propgrid`" />
    You need to use this
        <Add option="`$(WX_CONFIG) --libs std,aui,propgrid`" />

I see no difference between what you say works and not works.

Tim S

I think they are different options:

For example:

Code
				<Linker>
<Add option="`$(WX_CONFIG) --libs std,aui`" />
<Add option="-Wl,--no-undefined" />
<Add library="codeblocks" />
</Linker>


The "Add library" told C::B that a library named "codeblocks" will be linked, C::B will generate the correct linker command line option.
While, the "Add option" let the user directly put the linker command line option.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Online ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5625
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: New Variable to support wx-config in MSys2 MinGW
« Reply #31 on: August 16, 2022, 02:41:35 pm »

Additional Paths issue and potential changes required:
When you include $(TARGET_COMPILER_DIR)../usr/bin in the "Additional Paths" option in the global Compiler setting then on Windows any existing project that includes the zip command in the <ExtraCommands /> you will need to change the directory delim '\' to '/' if you are using the '/' delim as you will now use the MSYS2 usr/bin/zip instead of your existing windows zip file.
This is a bad issue, in-fact, we just need sh.exe in the path "$(TARGET_COMPILER_DIR)../usr/bin" to run the wx-config script.
using the usr/bin/zip is only expected when we run the update script under mingw64 shell.
« Last Edit: August 16, 2022, 02:46:26 pm by ollydbg »
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7298
    • My Best Post
Re: New Variable to support wx-config in MSys2 MinGW
« Reply #32 on: August 16, 2022, 05:12:44 pm »

Additional Paths issue and potential changes required:
When you include $(TARGET_COMPILER_DIR)../usr/bin in the "Additional Paths" option in the global Compiler setting then on Windows any existing project that includes the zip command in the <ExtraCommands /> you will need to change the directory delim '\' to '/' if you are using the '/' delim as you will now use the MSYS2 usr/bin/zip instead of your existing windows zip file.
This is a bad issue, in-fact, we just need sh.exe in the path "$(TARGET_COMPILER_DIR)../usr/bin" to run the wx-config script.
using the usr/bin/zip is only expected when we run the update script under mingw64 shell.

AndrewCot seems to think converting Windows CB projects to run under MSys2 makes sense!
It does NOT! I am guessing he rarely uses the Linux CB projects because he is not understanding that the Linux projects has the same "flaws" as the MSys2 projects has.

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9657
Re: New Variable to support wx-config in MSys2 MinGW
« Reply #33 on: August 16, 2022, 05:21:12 pm »
AndrewCot seems to think converting Windows CB projects to run under MSys2 makes sense!
It does NOT! I am guessing he rarely uses the Linux CB projects because he is not understanding that the Linux projects has the same "flaws" as the MSys2 projects has.
I agree. The way forward could be to use the Unix project files under MSYS2. Shouldn't these work right out-of-the-box?
(Besides: Can anybody tell me why exactly it is worth putting energy into MSYS 2 support? I might have missed it. In the end you can do everything from native Windows, incl. using the MSYS compilers, which is what I do from time-to-time?!)
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: http://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: http://wiki.codeblocks.org/index.php?title=FAQ

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7298
    • My Best Post
Re: New Variable to support wx-config in MSys2 MinGW
« Reply #34 on: August 16, 2022, 10:40:02 pm »
AndrewCot seems to think converting Windows CB projects to run under MSys2 makes sense!
It does NOT! I am guessing he rarely uses the Linux CB projects because he is not understanding that the Linux projects has the same "flaws" as the MSys2 projects has.
I agree. The way forward could be to use the Unix project files under MSYS2. Shouldn't these work right out-of-the-box?
(Besides: Can anybody tell me why exactly it is worth putting energy into MSYS 2 support? I might have missed it. In the end you can do everything from native Windows, incl. using the MSYS compilers, which is what I do from time-to-time?!)

I have tried a few times to do an Code::Blocks IDE package for MSys2 and failed on the first try; current try builds; but, fails to run.
This time it was just to test my wxWidgets MSys2 package to verify it works with CB Projects.

I would like to get the scripted wizard working better with MSys2 mingw64; but, using MSys2 MinGW64 to build Code::Blocks might be best done the normal way (using cmd.exe prompt) instead of an MSys2 MinGW64 prompt.

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline AndrewCot

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 650
Re: New Variable to support wx-config in MSys2 MinGW
« Reply #35 on: August 17, 2022, 12:12:47 am »
Let me be polite and say if you have no idea it is better to say so or nothing than to accuse someone of something that is completely wrong.

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3255
Re: New Variable to support wx-config in MSys2 MinGW
« Reply #36 on: August 17, 2022, 03:09:44 pm »
Quote
Can anybody tell me why exactly it is worth putting energy into MSYS 2 support
I personally think it is a great way to have a package manager with libraries that just work on windows. I need some library pacman -S and the library and all dependencies are there.
I think people nowadays use vcpck or cocoa but the first is a microsoft thing and i am not a big fan about it, and i tested the second when it was still new and it was not really nice to use, so i was stuck with msys2
Do not view it as a unix environment on windows, view it as a package manager. And for this it would be nice to have codeblocks as package there... You want to install codeblocks? Simply run pacman -S codeblocks and everything works...
If it makes sense to port windows project files or use unix project files, that is out of my scope...

Offline New Pagodi

  • Multiple posting newcomer
  • *
  • Posts: 39
Re: New Variable to support wx-config in MSys2 MinGW
« Reply #37 on: August 17, 2022, 03:58:24 pm »
Also, if you can get codeblocks running with the GTK backend on windows, that might be the easiest way to add darkmode support that has been requested several times.  The shortest path to wxGTK on windows is probably through msys.

Online ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5625
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: New Variable to support wx-config in MSys2 MinGW
« Reply #38 on: August 17, 2022, 04:32:01 pm »
Also, if you can get codeblocks running with the GTK backend on windows, that might be the easiest way to add darkmode support that has been requested several times.  The shortest path to wxGTK on windows is probably through msys.

I have never used the wxGTK under Windows before, can some one shows the difference between wxGTK and wxMSW under Windows?
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7298
    • My Best Post
Re: New Variable to support wx-config in MSys2 MinGW
« Reply #39 on: August 17, 2022, 08:47:14 pm »
Also, if you can get codeblocks running with the GTK backend on windows, that might be the easiest way to add darkmode support that has been requested several times.  The shortest path to wxGTK on windows is probably through msys.

I have never used the wxGTK under Windows before, can some one shows the difference between wxGTK and wxMSW under Windows?

If you will take over the maintenance of it; I will create an core CB project using wxGTK-gtk3.
You would have to do the other CB projects.

Edit: Or, if you can tell me which wxWidgets sample will show the difference I could do that, instead.

Tim S.
« Last Edit: August 17, 2022, 08:50:17 pm by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org