Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Draft
wants to merge 17 commits into
base: main
Choose a base branch
from

Conversation

elecpower
Copy link
Collaborator

@elecpower elecpower commented Nov 13, 2023

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 elecpower added documentation Improvements or additions to documentation compilation Related to compiling the firmware and firmware options labels Nov 13, 2023
@elecpower elecpower marked this pull request as draft November 13, 2023 05:04
@offer-shmuely
Copy link
Contributor

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

@elecpower
Copy link
Collaborator Author

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

@mha1
Copy link
Contributor

mha1 commented Nov 30, 2023

@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.

@offer-shmuely
Copy link
Contributor

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

@mha1
Copy link
Contributor

mha1 commented Nov 30, 2023

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

@pfeerick
Copy link
Member

Is this ready to go or was more work needed?

Build Simulator: $(bool_to_text ${BUILD_SIMULATOR})
Pause after each step: $(bool_to_text ${STEP_PAUSE})
"
read -p "Press any key to continue or ctrl+C to abort"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

only Enter works, thus "Press Enter key to continue or Ctrl+C to abort".

Edit the file <MSYS2 install directory>\mingw64.ini eg C:\msys64\mingw64.ini
- Uncomment the line #MSYS2_PATH_TYPE=inherit
- Save the file
"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMHO better, than setting an operating system wide setting for EdgeTX, would be to explicitly use -DARM_TOOLCHAIN_DIR in EdgeTX CMake line, e.g. here then with ARM GNU 11.3.1 -DARM_TOOLCHAIN_DIR="C:\Program Files (x86)\Arm GNU Toolchain arm-none-eabi\11.3 rel1\bin".

Setting something system wide might affect users building other (non EdgeTX) code on their systems.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apparently this does not work anyway as there are spaces in the path.
Let's just say there was robust discussion when I posted these new scripts about how best to pass the ARM path.
I too prefer the -D method.

@rotorman
Copy link
Member

rotorman commented Apr 16, 2024

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 ../

@elecpower
Copy link
Collaborator Author

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
Copy link
Collaborator Author

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.

@pfeerick
Copy link
Member

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?

@elecpower
Copy link
Collaborator Author

elecpower commented May 12, 2024

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

@elecpower elecpower force-pushed the elecpower/msys2-32-64-scripts branch from ae39924 to 29b183e Compare May 15, 2024 13:07
@elecpower
Copy link
Collaborator Author

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compilation Related to compiling the firmware and firmware options documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants