Skip to content

Building GCodeWorkShop using MSYS2

u-235 edited this page Sep 28, 2024 · 1 revision

MSYS2 provides a set of tools and libraries for developing Windows applications. New releases of MSYS2 will no longer support Windows 7 and 8.1 from 2023, so MSYS2 should be installed from the archive for these operating systems.

Note that the following instructions show the build of the 64-bit version. If you need to build the 32-bit version, replace x86_64 with i686, for example, type mingw-w64-i686-gcc instead of mingw-w64-x86_64-gcc. Read more about naming packages.

One more important note: if an error occurs at some point (just an error, not a warning), further steps make sense only after the error is fixed.

Preparing the developers environment

I assume that MSYS2 is successfully installed, and its console is available to you. Next, to prepare the developers environment you should make some simple steps, entering commands into the MSYS2 console.

Synchronize the package manager

A good rule of thumb is to synchronize your package manager with the repositories prior to installing packages.

pacman -Syuu

Installing Qt

We install the base package Qt5 and its translations, Qt tools, network and serial port libraries.

pacman -S mingw-w64-x86_64-qt5-base mingw-w64-x86_64-qt5-serialport mingw-w64-x86_64-qt5-tools mingw-w64-x86_64-qt5-translations

Installing GCC

To build an application we need a C++ compiler and a pair of utilities.

pacman -S mingw-w64-x86_64-gcc make unzip

You are now ready to build the application.

Building the application

We download the archive with the current version of the master branch into our home directory, unzip it, and jump to the resulting project directory. Then we run qmake and make to build the application.

cd ~
wget https://github.com/GCodeProjects/GCodeWorkShop/archive/refs/heads/master.zip
unzip master.zip
cd GCodeWorkShop-master
qmake -r
make -j4

After completing the build, a new bin directory with the application will appear in the project directory.

Running the application

So, you are in the ~/GCodeWorkShop-master directory and it's time to test run the application. After running the command

bin/release/gcodeworkshop.exe

the application window should appear and you can be congratulated on successfully building the application. However, if you try to start the application from an explorer, you will get a warning that some dlls required for the application are missing. To fix this problem, we are going to copy the application and all necessary files into C:/GCodeWorkShop. To do so we launch the script

install/MSYS2-deploy.sh

The application is now available at C:/GCodeWorkShop/bin/gcodeworkshop.exe and a link can be created on the desktop for easy launch.