17 KiB
Dependancy
Red Panda C++ need Qt 5 (>=5.12) to build.
Windows
For Windows 7 or later:
Library + Toolchain \ Target | x86 | x64 | ARM64 |
---|---|---|---|
MSYS2 + GNU-based MinGW | ✔️ | ✔️ | ❌ |
MSYS2 + LLVM-based MinGW | ✔️ | ✔️ | ✔️ |
Qt.io + MinGW | ✔️ | ✔️ | ❌ |
Qt.io + MSVC | ✔️ | ✔️ | ❌ |
vcpkg + MSVC | ✔️ | ✔️ | ❌ |
Notes for Windows on ARM:
- Red Panda C++ can be built for ARM64 ABI only on Windows 11 ARM64, while it is supposed (but not tested) to run on Windows 10 ARM64.
- The ARM64EC (“emulation compatible”) ABI, which highlights interoperability with x64, is currently not supported.
- ARM64EC does not bring significant benefit, since Red Panda C++ can be built to ARM64 classic ABI.
- However, ARM64EC will allow users to use their favorite input methods, fancy Qt styles.
- With the ARM32 deprecation in Windows 11 Insider Preview Build 25905, ARM32 support will never be added.
For legacy Windows (NT 5.1 – 6.0):
Library + Toolchain \ Target | x86 | x64 |
---|---|---|
Qt 5.6 from patched source + MinGW | ✔️ | ✔️ |
Notes for legacy Windows:
- Supported Windows versions:
- Windows XP SP3 or later;
- Windows Server 2003 x64 Edition (a.k.a. Windows XP x64 Edition) SP2 or later.
- Windows 7 x64 or later required as build host.
- Here is a script for building Qt 5.6 from source alongside official Qt installation (with Qt.io MinGW GCC 8.1.0).
MSYS2 Qt Library with MinGW Toolchain (Recommended)
Red Panda C++ should work with any MinGW toolchain from MSYS2, including GCCs and Clangs in three GNU-based environments (MINGW32, MINGW64 and UCRT64), and Clangs in three LLVM-based environments (CLANG32, CLANG64 and CLANGARM64; see also MSYS2’s document), while the following toolchains are frequently tested:
- MINGW32 GCC,
- MINGW64 GCC,
- UCRT64 GCC (recommended for x64)
- CLANGARM64 Clang (the only and recommended toolchain for ARM64).
Official distributions of Red Panda C++ are built with MINGW32 GCC and MINGW64 GCC.
Prerequisites:
- Windows 8.1 x64 or later, or Windows 11 ARM64.
- Install MSYS2.
- In selected environment, install toolchain and Qt 5 library:
pacman -S $MINGW_PACKAGE_PREFIX-toolchain $MINGW_PACKAGE_PREFIX-qt5-static
For build only:
- In selected environment, set related variables:
SRC_DIR="/c/src/redpanda-src" # “C:\src\redpanda-src” for example BUILD_DIR="/c/src/redpanda-build" # “C:\src\redpanda-build” for example INSTALL_DIR="/c/src/redpanda-pkg" # “C:\src\redpanda-pkg” for example
- Navigate to build directory:
rm -rf "$BUILD_DIR" # optional for clean build mkdir -p "$BUILD_DIR" && cd "$BUILD_DIR"
- Configure, build and install:
$MSYSTEM_PREFIX/qt5-static/bin/qmake PREFIX="$INSTALL_DIR" "$SRC_DIR/Red_Panda_CPP.pro" mingw32-make -j$(nproc) mingw32-make install
For development:
- Install Qt Creator (either MSYS2 edition from package
$MINGW_PACKAGE_PREFIX-qt-creator
or standalone edition from Qt.io downloads site). - Open
Red_Panda_CPP.pro
with Qt Creator.
Qt.io Qt Library with MinGW Toolchain or MSVC Toolchain
Prerequisites:
- Windows 7 x64 or later. ARM64 is not supported.
- Install Qt with online installer from Qt.io.
- Select the library (in Qt group, Qt 5.15.2 subgroup, check at lease one of MinGW 8.1.0 32-bit, MinGW 8.1.0 64-bit, MSVC 2019 32-bit or MSVC 2019 64-bit).
- For MinGW toolchain, select the toolchain (in Qt group, Developer and Designer Tools subgroup, check MinGW 8.1.0 32-bit or MinGW 8.1.0 64-bit, matching the library).
- Optionally select Qt Creator (in Qt group, Developer and Designer Tools subgroup; recomended for MSVC toolchain for parallel build support).
- For MSVC toolchain, install Visual Studio 2019 or later, or Visual Studio Build Tools 2019 or later, with Desktop Development with C++ workload.
- In Installation Details panel, under the Desktop Development with C++ workload, select at least one MSVC x86/x64 build tools and one Windows SDK.
For build only:
- Launch Qt environment from Start Menu.
- In Qt environment, set related variables:
rem no quotes even if path contains spaces set SRC_DIR=C:\src\redpanda-src set BUILD_DIR=C:\src\redpanda-build set INSTALL_DIR=C:\src\redpanda-pkg rem for MSVC toolchain set VS_INSTALL_PATH=C:\Program Files\Microsoft Visual Studio\2022\Community rem for MSVC toolchain; or x86 set VC_ARCH=amd64 rem for MSVC toolchain; keep unset if Qt Creator is not installed set QT_CREATOR_DIR=C:\Qt\Tools\QtCreator
- Navigate to build directory:
rem optional for clean build rmdir /s /q "%BUILD_DIR%" mkdir "%BUILD_DIR%" && cd /d "%BUILD_DIR%"
- Configure, build and install. For MinGW toolchain:
For MSVC toolchain:qmake PREFIX="%INSTALL_DIR%" "%SRC_DIR%\Red_Panda_CPP.pro" mingw32-make -j%NUMBER_OF_PROCESSORS% mingw32-make install windeployqt "%INSTALL_DIR%\RedPandaIDE.exe"
call "%VS_INSTALL_PATH%\Common7\Tools\VsDevCmd.bat" -arch=%VC_ARCH% qmake PREFIX="%INSTALL_DIR%" "%SRC_DIR%\Red_Panda_CPP.pro" set JOM=%QT_CREATOR_DIR%\bin\jom\jom.exe if "%QT_CREATOR_DIR%" neq "" ( "%JOM%" -j%NUMBER_OF_PROCESSORS% "%JOM%" install ) else ( nmake nmake install ) windeployqt "%INSTALL_DIR%\RedPandaIDE.exe"
For development:
- Open
Red_Panda_CPP.pro
with Qt Creator.
Advanced Option: vcpkg Qt Static Library with MSVC Toolchain
Prerequisites:
- Windows 7 x64 or later. ARM64 is not supported.
- For a fresh installation of Windows 7, install following components in order:
- SHA-2 code signing support (prerequisite of .NET Framework 4.8),
- .NET Framework 4.8 (prerequisite of Windows Management Framework 5.1 and Visual Studio; also optional dependency of Git for Windows),
- Windows Management Framework 5.1 (prerequisite of vcpkg bootstrapping).
- For a fresh installation of Windows 7, install following components in order:
- Install Visual Studio 2017 or later, or Visual Studio Build Tools 2017 or later, with Desktop Development with C++ workload.
- In Installation Details panel, under the Desktop Development with C++ workload, select at least one MSVC x86/x64 build tools and one Windows SDK.
- Install standalone vcpkg.
- As of 2023.08.09, a patch is required for Windows 7 to use compatible version of Python. Affected files will change over time, so manually edit them to apply the patch.
- Install Qt with vcpkg.
$TARGET = "x64-windows-static" # or "x86-windows-static" vcpkg install qt5-base:$TARGET qt5-svg:$TARGET qt5-tools:$TARGET
To build with VS 2019 or later in PowerShell (Core) or Windows PowerShell:
- Set related variables:
$SRC_DIR = "C:\src\redpanda-src" $BUILD_DIR = "C:\src\redpanda-build" $INSTALL_DIR = "C:\src\redpanda-pkg" $VCPKG_ROOT = "C:\src\vcpkg" $VCPKG_TARGET = "x64-windows-static" # or "x86-windows-static" $VS_INSTALL_PATH = "C:\Program Files\Microsoft Visual Studio\2022\Community" $VC_ARCH = "amd64" # or "x86" $JOM = "$VCPKG_ROOT\downloads\tools\jom\jom-1.1.3\jom.exe" # check the version
- Navigate to build directory:
Remove-Item -Recurse -Force "$BUILD_DIR" # optional for clean build (New-Item -ItemType Directory -Force "$BUILD_DIR") -and (Set-Location "$BUILD_DIR")
- Configure, build and install:
Import-Module "$VS_INSTALL_PATH\Common7\Tools\Microsoft.VisualStudio.DevShell.dll" Enter-VsDevShell -VsInstallPath "$VS_INSTALL_PATH" -SkipAutomaticLocation -DevCmdArguments "-arch=$VC_ARCH" & "$VCPKG_ROOT\installed\$VCPKG_TARGET\tools\qt5\bin\qmake.exe" PREFIX="$INSTALL_DIR" "$SRC_DIR\Red_Panda_CPP.pro" & "$JOM" "-j${Env:NUMBER_OF_PROCESSORS}" & "$JOM" install
To build with VS 2017 or later in Command Prompt:
- Launch proper VC environment from Start Menu.
- Set related variables:
rem no quotes even if path contains spaces set SRC_DIR=C:\src\redpanda-src set BUILD_DIR=C:\src\redpanda-build set INSTALL_DIR=C:\src\redpanda-pkg set VCPKG_ROOT=C:\src\vcpkg rem or x86-windows-static set VCPKG_TARGET=x64-windows-static rem check the version set JOM=%VCPKG_ROOT%\downloads\tools\jom\jom-1.1.3\jom.exe
- Navigate to build directory:
rem optional for clean build rmdir /s /q "%BUILD_DIR%" mkdir "%BUILD_DIR%" && cd /d "%BUILD_DIR%"
- Configure, build and install:
"%VCPKG_ROOT%\installed\%VCPKG_TARGET%\tools\qt5\bin\qmake.exe" PREFIX="%INSTALL_DIR%" "%SRC_DIR%\Red_Panda_CPP.pro" "%JOM%" -j%NUMBER_OF_PROCESSORS% "%JOM%" install
Linux and Other freedesktop.org-conforming (XDG) Desktop Systems
General steps:
- Install recent version of GCC (≥ 7) or Clang (≥ 6) that supports C++17.
- Install Qt 5 (≥ 5.12) Base, SVG and Tools modules, including both libraries and development files.
- Optionally install fcitx5-qt for building with static Qt library.
- Optionally install Qt Creator for development.
For build only:
- Configure:
qmake PREFIX=/usr/local /path/to/src/Red_Panda_CPP.pro
- Make:
make -j$(nproc)
- Install:
sudo make install
For development:
- Open
Red_Panda_CPP.pro
with Qt Creator
qmake variables:
PREFIX
: default to/usr/local
. It should be set to/usr
or/opt/redpanda-cpp
when packaging.LIBEXECDIR
: directory for auxiliary executables, default to$PREFIX/libexec
. Arch Linux uses/usr/lib
.XDG_ADAPTIVE_ICON=ON
: install the icon file following freedesktop.org Icon Theme Specification for adaptiveness to themes and sizes. Required by AppImage; recommended for Linux packaging ifPREFIX
set to/usr
.LINUX_STATIC_IME_PLUGIN=ON
(make phase): link to static ime plugin. Recommended for building with static version of Qt; DO NOT set for dynamic version of Qt.
Debian and Its Derivatives
“deb” Package for Current OS
- Install dependency:
sudo apt install \ build-essential debhelper \ libqt5svg5-dev qtbase5-dev qtbase5-dev-tools qttools5-dev-tools
- Build the package:
./packages/debian/builddeb.sh
- Install the package:
sudo apt install /tmp/redpanda-cpp_*.deb
- Run Red Panda C++:
RedPandaIDE
Build Packages for Multiple Architectures and Versions in Containers
Extra requirements for Windows host:
- Docker uses WSL 2 based engine, or enable file sharing on the project folder (Settings > Resources > File sharing);
- PowerShell (Core) or Windows PowerShell.
- Linux host:
DOCKER=docker # or podman SOURCE_DIR=/build/RedPanda-CPP # source directory *in container* JOBS=$(nproc) # reduce it for multiple builds at same time MIRROR=mirrors.kernel.org # leave empty for default mirror PLATFORM=linux/amd64 # or linux/386, linux/arm64/v8, linux/arm/v7, linux/riscv64 IMAGE=debian:12 # or Ubuntu (e.g. ubuntu:22.04) $DOCKER run --rm -e MIRROR=$MIRROR -e SOURCE_DIR=$SOURCE_DIR -e JOBS=$JOBS -v $PWD:$SOURCE_DIR --platform $PLATFORM $IMAGE $SOURCE_DIR/packages/debian/01-in-docker.sh
- Windows host:
$DOCKER = "docker" # or "podman" $SOURCE_DIR = "/build/RedPanda-CPP" # source directory *in container* $JOBS = $Env:NUMBER_OF_PROCESSORS # reduce it for multiple builds at same time $MIRROR = "mirrors.kernel.org" # leave empty for default mirror $PLATFORM = "linux/amd64" # or "linux/386", "linux/arm64/v8", "linux/arm/v7", "linux/riscv64" $IMAGE = "debian:12" # or Ubuntu (e.g. "ubuntu:22.04") & $DOCKER run --rm -e MIRROR=$MIRROR -e SOURCE_DIR=$SOURCE_DIR -e JOBS=$JOBS -v "$(Get-Location):$SOURCE_DIR" --platform $PLATFORM $IMAGE $SOURCE_DIR/packages/debian/01-in-docker.sh
Manual Install
- Install compiler
apt install gcc g++ make gdb gdbserver
- Install Qt 5 and other dependencies
apt install qtbase5-dev qttools5-dev-tools libqt5svg5-dev git qterminal
- Fetch source code
git clone https://github.com/royqh1979/RedPanda-CPP.git
- Build
cd RedPanda-CPP/ qmake Red_Panda_CPP.pro make -j$(nproc) sudo make install
- Run
RedPandaIDE
Arch Linux
A reference PKGBUILD is available at packages/archlinux
. Build RedPanda C++ with makepkg and then install.
Enter RedPandaIDE
to launch RedPanda C++.
Note that makepkg checks out HEAD of the repo, so any change should be committed before building.
Fedora
- Install dependency:
sudo dnf install \ gcc gcc-c++ rpm-build rpmdevtools git \ glibc-static libstdc++-static libasan \ qt5-qtbase-devel qt5-qtsvg-devel qt5-qttools-devel rpmdev-setuptree # first time only
- Build the package:
./packages/fedora/buildrpm.sh
- Install the package:
sudo dnf install ~/rpmbuild/RPMS/$(uname -m)/redpanda-cpp-git-*.rpm
- Run Red Panda C++:
RedPandaIDE
openSUSE
- Install dependency:
sudo zypper in \ gcc gcc-c++ rpm-build rpmdevtools git \ glibc-devel-static \ libqt5svg5-dev qtbase5-dev qtbase5-dev-tools qttools5-dev-tools rpmdev-setuptree # first time only
- Build the package:
./packages/opensuse/buildrpm.sh
- Install the package:
sudo zypper --no-gpg-checks in ~/rpmbuild/RPMS/$(uname -m)/redpanda-cpp-git-*.rpm
- Run Red Panda C++:
RedPandaIDE
Linux AppImage
-
Install dependency: Docker or Podman.
Extra requirements for Windows host:
- Docker uses WSL 2 based engine, or enable file sharing on the project folder (Settings > Resources > File sharing);
- PowerShell (Core) or Windows PowerShell.
-
Prepare build environment. Linux host:
ARCH=x86_64 # or aarch64, riscv64 DOCKER=docker # or podman $DOCKER build -t redpanda-builder-$ARCH packages/appimage/dockerfile-$ARCH
Windows host:
$ARCH = "x86_64" # or "aarch64", "riscv64" $DOCKER = "docker" # or "podman" & $DOCKER build -t redpanda-builder-$ARCH packages/appimage/dockerfile-$ARCH
-
Build AppImage. Linux host:
ARCH=x86_64 DOCKER=docker $DOCKER run --rm -v $PWD:/build/RedPanda-CPP -e CARCH=$ARCH redpanda-builder-$ARCH /build/RedPanda-CPP/packages/appimage/01-in-docker.sh
Windows host:
$ARCH = "x86_64" $DOCKER = "docker" & $DOCKER run --rm -v "$(Get-Location):/build/RedPanda-CPP" -e CARCH=$ARCH redpanda-builder-$ARCH /build/RedPanda-CPP/packages/appimage/01-in-docker.sh
-
Run Red Panda C++.
./dist/RedPandaIDE-x86_64.AppImage # or *-aarch64.AppImage, *-riscv64.AppImage
Emulated Native Build for Foreign Architectures
It is possible to build Red Panda C++ for foreign architectures using targets’ native toolchains with QEMU user space emulation.
Note: Always run emulated native build in containers or jails. Mixing architectures may kill your system.
For Linux or BSD host, install statically linked QEMU user space emulator (package name is likely qemu-user-static
) and make sure that binfmt support is enabled.
For Windows host, Docker and Podman should have QEMU user space emulation enabled. If not,
- For Docker:
docker run --rm --privileged multiarch/qemu-user-static:register
- For Podman, whose virtual machine is based on Fedora WSL, simply enable binfmt support:
wsl -d podman-machine-default sudo cp /usr/lib/binfmt.d/qemu-aarch64-static.conf /proc/sys/fs/binfmt_misc/register wsl -d podman-machine-default sudo cp /usr/lib/binfmt.d/qemu-riscv64-static.conf /proc/sys/fs/binfmt_misc/register
macOS
Qt.io Qt Library
Prerequisites:
- macOS 10.13 or later.
- Install Xcode Command Line Tools:
xcode-select --install
- Install Qt with online installer from Qt.io.
- Select the library (in Qt group, Qt 5.15.2 subgroup, check macOS).
Build:
- Set related variables:
SRC_DIR="~/redpanda-src" BUILD_DIR="~/redpanda-build" INSTALL_DIR="~/redpanda-pkg"
- Navigate to build directory:
rm -rf "$BUILD_DIR" # optional for clean build mkdir -p "$BUILD_DIR" && cd "$BUILD_DIR"
- Configure, build and install:
~/Qt/5.15.2/clang_64/bin/qmake PREFIX="$INSTALL_DIR" "$SRC_DIR/Red_Panda_CPP.pro" make -j$(sysctl -n hw.logicalcpu) make install ~/Qt/5.15.2/clang_64/bin/macdeployqt "$INSTALL_DIR/bin/RedPandaIDE.app"