Author Topic: patch for the autotools build to work with Msys2/MinGW32  (Read 9197 times)

Offline reckless

  • Regular
  • ***
  • Posts: 349
patch for the autotools build to work with Msys2/MinGW32
« on: May 16, 2024, 05:30:12 pm »
The Msys2 devs dont want it since they are deprecating win32 but for those of us who still use 32 bit sometimes this fixes the build.

the problem as noticed by others is that windres on 32 bit mingw gets passed -mthreads via the WX_CXXFLAGS flag.
changed it to WX_CPPFLAGS as both return the same minus the -mthreads flag.

« Last Edit: May 16, 2024, 05:32:07 pm by reckless »

Offline Grit Clef

  • Multiple posting newcomer
  • *
  • Posts: 107
  • Where there is a will, there is a way.
Re: patch for the autotools build to work with Msys2/MinGW32
« Reply #1 on: May 17, 2024, 06:30:38 am »
Good! Simple but useful for me.
-Windows 7, 32-bit
-CodeBlocks r13542, gcc 14.2.0, debug version

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 6034
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: patch for the autotools build to work with Msys2/MinGW32
« Reply #2 on: May 19, 2024, 12:12:31 am »
The Msys2 devs dont want it since they are deprecating win32 but for those of us who still use 32 bit sometimes this fixes the build.

the problem as noticed by others is that windres on 32 bit mingw gets passed -mthreads via the WX_CXXFLAGS flag.
changed it to WX_CPPFLAGS as both return the same minus the -mthreads flag.

Hi, reckless, long time no see. Thanks.

I'm not using the 32 bit windows system, some of my PCs are still Win7 64bit, and it seems msys2 are dropping support for those systems.

BTW, can you have a look at this post:

Code::Blocks / Tickets / #1461 Fix building codeblocks on MinGW-w64 aarch64

I'm still hoping Code::Blocks could be built under the MinGW64 port. (as you patch, it supports building C::B on the MinGW32 port)
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 reckless

  • Regular
  • ***
  • Posts: 349
Re: patch for the autotools build to work with Msys2/MinGW32
« Reply #3 on: May 25, 2024, 07:35:28 pm »
mingw64 works fine now not sure about aarch but i can have a look :)

Offline reckless

  • Regular
  • ***
  • Posts: 349
Re: patch for the autotools build to work with Msys2/MinGW32
« Reply #4 on: May 25, 2024, 07:41:54 pm »
ah wait you mean for older OS like win7 ? well it should still be possible by setting the WIN32_WINNT flag to 0x601 and building it with mingw64.
i do have a prebuilt package you can try out if you want ?.
otherwise you probably have to build the package yourself but they did include mingw64 in the PKGBUILD now but it is not avaliable as a pacman package yet it seems.
« Last Edit: May 25, 2024, 07:48:53 pm by reckless »

Offline reckless

  • Regular
  • ***
  • Posts: 349
Re: patch for the autotools build to work with Msys2/MinGW32
« Reply #5 on: May 25, 2024, 07:56:35 pm »
here is the modified package build for codeblocks with both mingw32 and mingw64 added as well as 32 bit clang if someone prefers the ucrt build.

Offline reckless

  • Regular
  • ***
  • Posts: 349
Re: patch for the autotools build to work with Msys2/MinGW32
« Reply #6 on: May 26, 2024, 09:24:45 am »
doh seems they removed it again  ::) but the modified version linked here works.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 6034
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: patch for the autotools build to work with Msys2/MinGW32
« Reply #7 on: May 26, 2024, 09:31:31 am »
doh seems they removed it again  ::) but the modified version linked here works.

What github issue or pull request are you using? Can you share the links?

Or, you suggest pushing your contributions to the C::B's source base?

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 reckless

  • Regular
  • ***
  • Posts: 349
Re: patch for the autotools build to work with Msys2/MinGW32
« Reply #8 on: May 26, 2024, 09:36:51 am »
https://github.com/msys2/MINGW-packages/commit/ba7eac7846234a4d3f8f22f8d060ef85d4d6d749

this one, but since they dont intend on providing neither a mingw64 nor mingw32 build it might make more sense to just add the fix to C::B base ?.
« Last Edit: May 26, 2024, 09:56:30 am by reckless »

Offline reckless

  • Regular
  • ***
  • Posts: 349
Re: patch for the autotools build to work with Msys2/MinGW32
« Reply #9 on: May 26, 2024, 12:28:58 pm »
one strange thing i noticed which might be interresting is that i use the TDM compiler (modified version by me) with msys2 and the static runtime version of wxwidgets 3.2 works out of the box  with the autotools build :o has'nt crashed once on me.
but if i use the standard windows build with the batch files it goes ape huh.

the TDM build i use was made for msys2 and unless using -static-libgcc -static-libstdc++ it works just like the normal msys2 mingw builds.
other than that i fixed a bug with the cleanup function which was leaking path handles to the exception mechanism if it failed to run and i changed the _onexit routine running the cleanup function to atexit using a wrapper.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 6034
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: patch for the autotools build to work with Msys2/MinGW32
« Reply #10 on: August 17, 2024, 01:08:20 pm »
We have another discussion on the github action build bot, see this link:

build bot in the github, I see one nice project

Though it has some build issues for the wxSmith related plugins.
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 reckless

  • Regular
  • ***
  • Posts: 349
Re: patch for the autotools build to work with Msys2/MinGW32
« Reply #11 on: October 05, 2024, 06:38:24 am »
yep noticed it some days ago sorry havent been around much lately (just moved, again...).
seems most of the things are now in working order  :)  great good job folks.