Author Topic: Windows MSYS2 build via makefiles now working - please review and test  (Read 4252 times)

Offline AndrewCot

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 678
I have a C::B being able to be built with MSYS2 using the bootstrap/configure/make process similar to how it is done on Linux. I have successfully used the resulting C::B develop files to build a simple hello world and debug it (it's my quick and simple real world C::B simple test that I use). The SF ticket for this is 1199.

I have not created any updated patches as the changes are huge as there are allot of changes. To make building easier I have created a branch in the following GitHub repo that also includes tickets  1202, 1205 and 1207 and  a number of  bash scripts and build docs  that will  help with building. The repo and branch is:
 https://github.com/acotty/codeblocks_sfmirror/tree/MSYS2_BASH_BUILD


The build doc that you need to follow is : https://github.com/acotty/codeblocks_sfmirror/blob/MSYS2_BASH_BUILD/Readme_Build_Windows_MSYS2_by_Makefile.txt


There are a few issues which I need help with as I am a newbie autoconf/automake/libtool user. The issues that I need help with are:
  • The plugin DLL names are pre-appended with "lib". Any idea how to not build the plugins with this?  I have worked around this when you run the windows_build_msys2.sh or windows_update_devel.sh scripts.
  • Running "make install" copies the exe's into a src/bin directory instead of the src/devel31_64 directory. Any ideas on how to fix this without affecting the other files? I have worked around this when you run the windows_build_msys2.sh or windows_update_devel.sh scripts.
  • If you run make multiple times the exe's in the src/devel31_64 become bad (size approx 35K), but if you go cleanup all of the build files and start again the exe's are good. I have no idea why, but suspect it has something to do with the exe.la lai files. Anyone got any ideas? The work around is to run "make clean" or use the windows_build_msys2.sh to do a full rebuild.
  • Running "make -jx" where x>1 fails. Anyone got any ideas? The windows_build_msys2.sh script works around this by running make twice. This causes  the overall build to be slow.
The 4 items above are issues in the githuib repo, so if you can help post here or in the relevant github issue. If you find another issue please post here or create a new github issue . If you disagree with anything I have done then supply another way to do it or you will have to live with it as I do not have the time to come up with a new way to do things.


If you already have MSYS2 installed you can test the build instructions by renaming  the C:\msys64 directory to to say C:\msys64_orig and then follow the build guide and once finished rename the new C:\msys64 to say C:\msys64_CB_MAKE and rename the  C:\msys64_orig back to C:\msys64 so next time you want to do some testing you just have to rename the directories.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5910
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Windows MSYS2 build via makefiles now working - please review and test
« Reply #1 on: February 17, 2022, 01:31:57 pm »
Good work!!!
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 Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 1553
Re: Windows MSYS2 build via makefiles now working - please review and test
« Reply #2 on: February 17, 2022, 01:58:02 pm »
The problem with make -jn is (probably) because all targets depend on sdk target being already built.

This happened with wxWidgets, the setup_h target must be fully made before continuing:
Code
mingw32-make -f makefile.gcc     MONOLITHIC=1 SHARED=1 BUILD=release setup_h
mingw32-make -f makefile.gcc -j8 MONOLITHIC=1 SHARED=1 BUILD=release

Offline AndrewCot

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 678
Re: Windows MSYS2 build via makefiles now working - please review and test
« Reply #3 on: February 17, 2022, 09:58:46 pm »
Thanks. I did not think of this as I was looking for some change in the auto tools.

Offline AndrewCot

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 678
Re: Windows MSYS2 build via makefiles now working - please review and test
« Reply #4 on: February 19, 2022, 03:32:37 am »
I tracked down the "make -jxx"failure root case, which was caused by a missing ".exe" in following line in the src\build_tools\autorevision\Makefile.am file:

Code
all-local: auto_revision.exe

I am working my way through the differences between the MSYS2 build I finally end up and the last nightly release and fixing the missing or additional files or if I cannot resolve the issue(s) then you may see posts or tickets or queries.


Offline AndrewCot

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 678
Re: Windows MSYS2 build via makefiles now working - please review and test
« Reply #5 on: February 21, 2022, 07:24:21 am »
As of this afternoon I have hopefully included everything that is in the nightly build along with the addition of the docs in the share/coodeblocks/docs directory if the doc files exist (they do with my local windows installer source tree).

The only issue I have left is the DLL's all start with "lib" otherwise it's ready for Windows prime time testing.

Please do not test it yet on Linux as I have not checked it build on Linux since the end of last week.

Offline AndrewCot

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 678
Re: Windows MSYS2 build via makefiles now working - please review and test
« Reply #6 on: February 21, 2022, 09:26:14 am »
I am working on getting the linux build working again with the changes I have done since I last built C::B on Linux.

Rant:Next time someone wants to use autotools and libtools for cross platform I would suggest to say NO as it's a PITA and see if there is any easier way of doing it, like have a look at CMAKE or .... or .... etc The reason is you end up with a Makefile.am iwth allot if "if windows .... else .... endif" blocks that in the long run are probably a PITA, but at least they work.