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

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5635
  • 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 »

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5635
  • 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

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5635
  • 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.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5635
  • 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

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5635
  • 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: 653
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