cross-platform-build-environment-setup
Summary
Configure and validate native build environments for Qt5-based metabolomics software across Windows, macOS, and Linux platforms. This skill ensures dependency resolution, compiler toolchain setup, and environment variable configuration so that source code compiles to platform-specific executables.
When to use
When you have a Qt5 C++ project (such as Maven GUI or Maven Core) that must be built on multiple target operating systems, and you need to install and verify platform-specific build dependencies (MSYS2 + mingw64 on Windows, Homebrew + Qt5 on macOS, PPA + Qt5.8 on Linux), set up compiler paths and library search paths, and confirm that qmake and make can successfully compile the project without missing dependencies or linker errors.
When NOT to use
- The project does not depend on Qt5 or uses a different build system (e.g., CMake, Meson, setuptools); use the appropriate toolchain setup for that system instead.
- You are cross-compiling to a platform different from the host machine; this skill covers native builds only.
- Binary executables are already provided or the project is pre-packaged as a Docker image; environment setup is not needed.
Inputs
- Qt5-based C++ project source tree (e.g., git clone eugenemel/maven)
- build.pro or similar qmake project configuration file
- Target platform identifier (Windows, macOS, or Linux with specific version)
Outputs
- Installed and verified Qt5 development toolchain on target platform
- Set environment variables (PATH, LDFLAGS, CPPFLAGS, PKG_CONFIG_PATH) specific to platform
- Successful qmake configuration (build files generated in build directory)
- Compiled object files and, optionally, intermediate build artifacts ready for packaging
How to apply
Begin by identifying the target platform and installing the appropriate package manager and base development toolchain: MSYS2 with pacman on Windows, Homebrew on macOS, or apt-get with PPA on Linux (Ubuntu 16.04 LTS). For each platform, install Qt5 and required libraries (sqlite3, zlib, libssl-dev, mesa-common-dev on Linux) using the platform's native package manager. On Windows, after MSYS2 installation, run pacman commands to install mingw-w64-x86_64-qt-creator and dependencies; on macOS, use brew install qt5 followed by explicit PATH, LDFLAGS, CPPFLAGS, and PKG_CONFIG_PATH exports; on Linux, add the Qt5.8 PPA and install qt58-meta-minimal plus OpenGL and database development libraries. After dependency installation, validate the environment by running qmake -r build.pro to configure the build, then make -j4 to compile with parallel jobs. If compilation succeeds without unresolved symbol errors or missing header files, the environment is correctly configured.
Related tools
- MSYS2 (Provides mingw64 compiler toolchain and pacman package manager for Windows build environment setup) — http://www.msys2.org/
- Homebrew (Package manager for macOS; used to install Qt5 and development libraries)
- Qt5 (Cross-platform GUI framework; core build dependency providing qmake and Qt libraries)
- qmake (Qt build configuration tool; parses build.pro and generates platform-specific Makefiles)
- make (GNU build automation tool; compiles source code using generated Makefiles with parallel job support (-j4))
- pacman (MSYS2 package manager for Windows; installs Qt, git, zlib, sqlite3, and development tools) — https://github.com/msys2/MSYS2-packages
- git (Version control; clones project source trees recursively to obtain Maven and Maven Core dependencies)
Examples
pacman -S --needed --noconfirm mingw-w64-x86_64-qt-creator zlib-devel mingw64/mingw-w64-x86_64-sqlite3 && git clone --recursive [redacted-email]:eugenemel/maven.git maven && cd maven && qmake -r build.pro && make -j4
Evaluation signals
- qmake -r build.pro completes without errors and generates Makefile or platform-specific build configuration files in the build directory.
- make -j4 runs to completion without 'command not found', 'unresolved external symbol', or 'No rule to make target' errors.
- All required header files (Qt5 headers, sqlite3.h, zlib.h, openssl headers) are found during compilation; no '#include' resolution errors.
- Compiler and linker flags (LDFLAGS, CPPFLAGS, PKG_CONFIG_PATH) are correctly set, verified by examining qmake output or build log for expected -L and -I paths.
- Final executable artifact is generated in the expected location (maven_dev_*.exe on Windows, Maven.app on macOS, or binary in Linux build output).
Limitations
- Platform-specific build configurations require separate setup and validation on each target OS; a build environment validated on macOS will not produce Windows executables without re-running setup on a Windows machine or CI/CD pipeline.
- Qt5 path and environment variable setup is brittle and platform-specific; incorrect LDFLAGS, CPPFLAGS, or PKG_CONFIG_PATH on macOS or Linux will cause silent linker failures or missing library errors.
- Linux builds require a specific PPA (beineri/opt-qt58-xenial) for Ubuntu 16.04 LTS; other Linux distributions may require different Qt5 installation methods and library paths.
- MSYS2 on Windows contains known bugs (e.g., envsubst export identifier error documented in maven_core README); workarounds such as renaming /mingw64/bin/envsubst.exe may be required.
- As of November 5, 2024, Linux builds have been retired from the automated build pipeline for Maven GUI, so Linux build environment setup is no longer maintained in CI/CD; manual validation may be needed.
Evidence
- [readme] Install the MSYS2 platform for Windows, then from a mingw64 prompt, install 64-bit QT, zlib, and sqlite: "Install the MSYS2 platform for Windows
- From a mingw64 prompt, install 64-bit QT, zlib, and sqlite"
- [readme] On macOS, install Homebrew and Qt5, then export PATH, LDFLAGS, CPPFLAGS, and PKG_CONFIG_PATH: "Install the Homebrew package management system
Install the qt5 package
brew update
brew install qt5
Setup the environment for the newly installed qt5
export"
- [other] Configure the build using qmake -r build.pro and compile using make -j4 with parallel jobs: "3. Configure the build using qmake -r build.pro. 4. Compile the project using make -j4 with parallel jobs."
- [readme] There is a known bug in MSYS2 packages causing an export identifier error during git clone on Windows: "Note: There is a bug in MSYS2 packages that causes the following error"
- [intro] As of 20241105, linux builds have been retired, and both mac os and windows executable are now produced by Appveyor: "As of 20241105, linux builds have been retired, and both mac os and windows executable are now produced by Appveyor"
1---2name: cross-platform-build-environment-setup3description: Use when when you have a Qt5 C++ project (such as Maven GUI or Maven Core) that must be built on multiple target operating systems, and you need to install and verify platform-specific build dependencies (MSYS2 + mingw64 on Windows, Homebrew + Qt5 on macOS, PPA + Qt5.4license: CC-BY-4.05---67# cross-platform-build-environment-setup89## Summary1011Configure and validate native build environments for Qt5-based metabolomics software across Windows, macOS, and Linux platforms. This skill ensures dependency resolution, compiler toolchain setup, and environment variable configuration so that source code compiles to platform-specific executables.1213## When to use1415When you have a Qt5 C++ project (such as Maven GUI or Maven Core) that must be built on multiple target operating systems, and you need to install and verify platform-specific build dependencies (MSYS2 + mingw64 on Windows, Homebrew + Qt5 on macOS, PPA + Qt5.8 on Linux), set up compiler paths and library search paths, and confirm that qmake and make can successfully compile the project without missing dependencies or linker errors.1617## When NOT to use1819- The project does not depend on Qt5 or uses a different build system (e.g., CMake, Meson, setuptools); use the appropriate toolchain setup for that system instead.20- You are cross-compiling to a platform different from the host machine; this skill covers native builds only.21- Binary executables are already provided or the project is pre-packaged as a Docker image; environment setup is not needed.2223## Inputs2425- Qt5-based C++ project source tree (e.g., git clone eugenemel/maven)26- build.pro or similar qmake project configuration file27- Target platform identifier (Windows, macOS, or Linux with specific version)2829## Outputs3031- Installed and verified Qt5 development toolchain on target platform32- Set environment variables (PATH, LDFLAGS, CPPFLAGS, PKG_CONFIG_PATH) specific to platform33- Successful qmake configuration (build files generated in build directory)34- Compiled object files and, optionally, intermediate build artifacts ready for packaging3536## How to apply3738Begin by identifying the target platform and installing the appropriate package manager and base development toolchain: MSYS2 with pacman on Windows, Homebrew on macOS, or apt-get with PPA on Linux (Ubuntu 16.04 LTS). For each platform, install Qt5 and required libraries (sqlite3, zlib, libssl-dev, mesa-common-dev on Linux) using the platform's native package manager. On Windows, after MSYS2 installation, run pacman commands to install mingw-w64-x86_64-qt-creator and dependencies; on macOS, use brew install qt5 followed by explicit PATH, LDFLAGS, CPPFLAGS, and PKG_CONFIG_PATH exports; on Linux, add the Qt5.8 PPA and install qt58-meta-minimal plus OpenGL and database development libraries. After dependency installation, validate the environment by running qmake -r build.pro to configure the build, then make -j4 to compile with parallel jobs. If compilation succeeds without unresolved symbol errors or missing header files, the environment is correctly configured.3940## Related tools4142- **MSYS2** (Provides mingw64 compiler toolchain and pacman package manager for Windows build environment setup) — http://www.msys2.org/43- **Homebrew** (Package manager for macOS; used to install Qt5 and development libraries)44- **Qt5** (Cross-platform GUI framework; core build dependency providing qmake and Qt libraries)45- **qmake** (Qt build configuration tool; parses build.pro and generates platform-specific Makefiles)46- **make** (GNU build automation tool; compiles source code using generated Makefiles with parallel job support (-j4))47- **pacman** (MSYS2 package manager for Windows; installs Qt, git, zlib, sqlite3, and development tools) — https://github.com/msys2/MSYS2-packages48- **git** (Version control; clones project source trees recursively to obtain Maven and Maven Core dependencies)4950## Examples5152```53pacman -S --needed --noconfirm mingw-w64-x86_64-qt-creator zlib-devel mingw64/mingw-w64-x86_64-sqlite3 && git clone --recursive [redacted-email]:eugenemel/maven.git maven && cd maven && qmake -r build.pro && make -j454```5556## Evaluation signals5758- qmake -r build.pro completes without errors and generates Makefile or platform-specific build configuration files in the build directory.59- make -j4 runs to completion without 'command not found', 'unresolved external symbol', or 'No rule to make target' errors.60- All required header files (Qt5 headers, sqlite3.h, zlib.h, openssl headers) are found during compilation; no '#include' resolution errors.61- Compiler and linker flags (LDFLAGS, CPPFLAGS, PKG_CONFIG_PATH) are correctly set, verified by examining qmake output or build log for expected -L and -I paths.62- Final executable artifact is generated in the expected location (maven_dev_*.exe on Windows, Maven.app on macOS, or binary in Linux build output).6364## Limitations6566- Platform-specific build configurations require separate setup and validation on each target OS; a build environment validated on macOS will not produce Windows executables without re-running setup on a Windows machine or CI/CD pipeline.67- Qt5 path and environment variable setup is brittle and platform-specific; incorrect LDFLAGS, CPPFLAGS, or PKG_CONFIG_PATH on macOS or Linux will cause silent linker failures or missing library errors.68- Linux builds require a specific PPA (beineri/opt-qt58-xenial) for Ubuntu 16.04 LTS; other Linux distributions may require different Qt5 installation methods and library paths.69- MSYS2 on Windows contains known bugs (e.g., envsubst export identifier error documented in maven_core README); workarounds such as renaming /mingw64/bin/envsubst.exe may be required.70- As of November 5, 2024, Linux builds have been retired from the automated build pipeline for Maven GUI, so Linux build environment setup is no longer maintained in CI/CD; manual validation may be needed.7172## Evidence7374- [readme] Install the MSYS2 platform for Windows, then from a mingw64 prompt, install 64-bit QT, zlib, and sqlite: "Install the [MSYS2 platform for Windows](http://www.msys2.org/)75762. From a mingw64 prompt, install 64-bit QT, zlib, and sqlite"77- [readme] On macOS, install Homebrew and Qt5, then export PATH, LDFLAGS, CPPFLAGS, and PKG_CONFIG_PATH: "Install the [Homebrew package management system]()78792. Install the qt5 package8081 brew update82 brew install qt583843. Setup the environment for the newly installed qt58586 export"87- [other] Configure the build using qmake -r build.pro and compile using make -j4 with parallel jobs: "3. Configure the build using qmake -r build.pro. 4. Compile the project using make -j4 with parallel jobs."88- [readme] There is a known bug in MSYS2 packages causing an export identifier error during git clone on Windows: "*Note*: There is a [bug in MSYS2 packages](https://github.com/Alexpux/MSYS2-packages/issues/735) that causes the following error"89- [intro] As of 20241105, linux builds have been retired, and both mac os and windows executable are now produced by Appveyor: "As of 20241105, linux builds have been retired, and both mac os and windows executable are now produced by Appveyor"