edgetx icon indicating copy to clipboard operation
edgetx copied to clipboard

chore: Update MSYS2 Windows 32 and 64 bit toolchain and build scripts

Open elecpower opened this issue 1 year ago • 15 comments

Summary of changes:

  • based on previous MSYS2 64-bit scripts
  • environment aware MSYS2 Win 32 and 64-bit toolchain and compile scripts
  • amendments for changes to MSYS2 package contents, Qt 5.15.2, support tools and make things work
  • add cli options and parameters

Todo:

  • update documentation (after testing and approval)

elecpower avatar Nov 13 '23 05:11 elecpower

tried to make my environment buildable again the msys2_setup_buildenv_stage1_32_64.sh succeded the msys2_setup_buildenv_stage2_32_64.sh does not pass the read -p "Press any key to continue or ctrl+C to abort"

I comment out the "read -p ..."

next failure is

image

offer-shmuely avatar Nov 29 '23 21:11 offer-shmuely

Usually not running the latest version of aqt as this is a newer option. The new build script does not specify a version.

elecpower avatar Nov 29 '23 22:11 elecpower

@offer-shmuely If you haven't done so: the new install scripts will not work on an existing MSYS2 installation. You need to deinstall MSYS2 entirely an re-install MSYS2 using the new install guide and scripts.

mha1 avatar Nov 30 '23 09:11 mha1

Not familiar with MSYS Where is the “new install guide”?

offer-shmuely avatar Nov 30 '23 15:11 offer-shmuely

oops, idk if Neil already update the how-to. but it's similar to the current one. deinstall MSYS2 and try the new scripts

mha1 avatar Nov 30 '23 17:11 mha1

Is this ready to go or was more work needed?

pfeerick avatar Feb 11 '24 11:02 pfeerick

Tested this PR under Win11 Pro 23H2 64-bit. With the comments and changes I posted above and below this post, all worked (was able to build radio firmware, Companion, Simulator binary and library and create an installer executable).

This PR should remove tools/setup_buildenv_msys2_stage1.sh and tools/setup_buildenv_msys2_stage2.sh (as it is replacing the scripts with 4 new files named differently).

After my comments are worked in, I see no issue merging this PR into main. I would also update the Wiki page https://github.com/EdgeTX/edgetx/wiki/Build-Instructions-under-Windows-10-%28MSYS2%29 accordingly, e.g. to also update the CMAKE_PREFIX_PATH to $HOME/qt/5.15.2/mingw81_64.

For someone wanting to test, here the full working CMake line for RM Zorro:

 cmake -G "MSYS Makefiles" -Wno-dev -DCMAKE_PREFIX_PATH=$HOME/qt/5.15.2/mingw81_64 -DSDL2_LIBRARY_PATH=/mingw64/bin/ -DPCB=X7 -DPCBREV=ZORRO -DDEFAULT_MODE=2 -DLUA_MIXER=YES -DARM_TOOLCHAIN_DIR="C:\Program Files (x86)\Arm GNU Toolchain arm-none-eabi\11.3 rel1\bin" -DCMAKE_BUILD_TYPE=Release ../

rotorman avatar Apr 16 '24 12:04 rotorman

This PR was built well before the infamous ADC refactor was released (which keeps on giving). Also Peter has needed to do some tricks to keep the compilations working with updates to the MSYS packages. So it does need revisiting. I'll put it to the test again and take onboard your latest feedback. Once we are okay with the result its time to do some updated documentation.

elecpower avatar Apr 17 '24 06:04 elecpower

The ADC refactor broke Companion compile as the hw def json files are not where CMake expects. Companion compiles, it just does not have any definitions to load for the radio profiles. So a fix required.

elecpower avatar May 11 '24 23:05 elecpower

Really need to make the json generation recursive (i.e. a bit like what tools/generate_hw_defs.sh or tools/generate_yaml.sh does) so that it can be it's own build step, rather than depending on calling libsimulator builds for all desired radios you want the companion build to support. Maybe something like the AddHardwareDefTarget macro could work?

pfeerick avatar May 12 '24 00:05 pfeerick

That's the direction I am going. I take that approach in my Linux dev environment.

elecpower avatar May 12 '24 00:05 elecpower

@pfeerick @rotorman okay so the scripts are working but I need to do more use cases tests before recommending merging. The hardware definitions generation is painfully slow due to resetting the cmake environment for each radio so any thoughts would be most welcome. Feel free to give them a spin and let me know of any issues/suggestions.

elecpower avatar May 15 '24 23:05 elecpower