// Status=edited = Building from source This guide is for developers building _WSJT-X_, _MAP65_, or _QMAP_ from source. To install and operate a released version instead, use the platform packages from the https://github.com/WSJTX/wsjtx/releases[official GitHub Releases page]. == Know which build you need The same source can be built for several different purposes. Choose the simplest path that answers your question: [%autowidth] |=== | Goal | Appropriate path | Edit, compile, and test locally | Use the platform package manager and the instructions in this chapter. | Exercise an installed layout or create an unsigned package | Complete the local build, then use the CMake `install` or `package` target. |=== External contributors should fork the public repository; core team members should use the private development branch assigned to their work. The https://github.com/WSJTX/wsjtx/blob/master/CONTRIBUTING.md[contribution guide] explains the repository model and pull-request workflow. == Common requirements All platforms require: * Git and CMake 3.20 or later for the commands as written. The project configuration retains CMake 3.12 as its minimum for older build environments. With CMake 3.12, replace `cmake -S . -B build` with `mkdir -p build && (cd build && cmake ..)`. With CMake 3.12 through 3.19, replace `ctest --test-dir build --output-on-failure` with `(cd build && ctest --output-on-failure)`. * Qt 5 Core, Widgets, Network, Multimedia, SerialPort, PrintSupport, Sql, LinguistTools, and WebSockets; Test when developer tests are enabled; and ActiveQt AxContainer on Windows * C and C++ compilers with C++17 support * a Fortran compiler, normally `gfortran` * FFTW 3, including the single-precision `libfftw3f` library * Boost, libusb, and PortAudio * the Hamlib revision selected by the project's CI configuration CMake enables developer tests and User Guide generation by default. User Guide generation requires Asciidoctor. If you do not need the local guide, configure with `-DWSJT_GENERATE_DOCS=OFF`. Use an out-of-source build directory. This keeps generated files out of the source tree and makes a clean reconfigure as simple as choosing a new directory. [[SRC_WINDOWS_MSYS2]] == Building on Windows with MSYS2 The supported Windows developer environment is *MSYS2 MINGW64*. MSYS2 supplies the compiler, Qt, CMake, and most libraries through its signed package repositories. WSJT-X builds the CI-selected Hamlib revision separately. The project intentionally uses MINGW64 as its current Windows compatibility contract. Do not substitute the MSYS, UCRT64, CLANG64, or another MSYS2 shell: package names, binary formats, paths, and supported Windows APIs can differ. NOTE: The MSYS2 Boost package is suitable for local development. Official Windows builds use a separate Boost configuration to support older Windows versions; see `.github/workflows/build-windows.yml`. === Install and update MSYS2 . Download and run the installer from https://www.msys2.org. The default location, `C:\msys64`, is suitable. . Open the *MSYS2 MINGW64* shell. . Update the base system: [source,bash] ---- pacman -Syu ---- MSYS2 may ask you to close the terminal during a core update. Close it, reopen *MSYS2 MINGW64*, and run `pacman -Syu` again until no further core update is required. Every command in the remainder of the Windows section runs in that MINGW64 shell. Confirm the environment before installing packages: [source,bash] ---- echo "$MSYSTEM" ---- The result must be `MINGW64`. === Install the local-development dependencies Install the compiler, build tools, and libraries: [source,bash] ---- pacman -S --needed \ git make tar autoconf automake libtool \ mingw-w64-x86_64-gcc \ mingw-w64-x86_64-gcc-fortran \ mingw-w64-x86_64-cmake \ mingw-w64-x86_64-qt5-base \ mingw-w64-x86_64-qt5-multimedia \ mingw-w64-x86_64-qt5-serialport \ mingw-w64-x86_64-qt5-svg \ mingw-w64-x86_64-qt5-tools \ mingw-w64-x86_64-qt5-websockets \ mingw-w64-x86_64-qt5-activeqt \ mingw-w64-x86_64-fftw \ mingw-w64-x86_64-boost \ mingw-w64-x86_64-libusb \ mingw-w64-x86_64-openssl \ mingw-w64-x86_64-portaudio \ mingw-w64-x86_64-pkg-config ---- User Guide generation is enabled by default. Install Ruby and Asciidoctor if you want the guide included in the build: [source,bash] ---- pacman -S --needed mingw-w64-x86_64-ruby gem install asciidoctor --no-document ---- If you skip these tools, add `-DWSJT_GENERATE_DOCS=OFF` to the CMake command in the configure section. The application and automated tests do not require a locally rendered User Guide. NSIS is required only when creating an unsigned Windows installer: [source,bash] ---- pacman -S --needed mingw-w64-x86_64-nsis ---- Check that the MINGW64 programs, rather than programs from another Windows toolchain, will be used: [source,bash] ---- missing_tools=0 for tool in gcc g++ gfortran cmake qmake-qt5 dumpcpp-qt5; do command -v "$tool" || { echo "MISSING: $tool"; missing_tools=1; } done if test "$missing_tools" -eq 0; then gcc --version gfortran --version cmake --version else echo "Install the missing tools before continuing." >&2 false fi ---- The MinGW programs should resolve under `/mingw64/bin`. Do not continue until the check reports a path for every tool and no `MISSING` line. === Clone the source Clone from inside the MINGW64 shell. These commands use a predictable workspace under the MSYS2 home directory: [source,bash] ---- mkdir -p ~/wsjtx-dev cd ~/wsjtx-dev git -c core.autocrlf=false -c core.longpaths=true \ clone https://github.com/WSJTX/wsjtx.git src cd src git config core.autocrlf false git config core.longpaths true ---- Keeping automatic CRLF conversion disabled prevents generated version metadata from treating an unchanged checkout as modified. Long-path support accommodates deep source and generated-file names used by the Windows build. External contributors should clone their fork instead and add `https://github.com/WSJTX/wsjtx.git` as the `upstream` remote. Core team members should use the private repository and the development branch assigned to their work. === Install OmniRig Install https://www.dxatlas.com/OmniRig/[OmniRig] in Windows. The usual location is `C:\Program Files (x86)\Afreet\OmniRig\OmniRig.exe`. WSJT-X does not link against OmniRig at build time, but `dumpcpp` reads the COM type library embedded in this executable to generate the ActiveQt interface. MSYS2 installs this tool as `dumpcpp-qt5`. The build finds that name directly; do not copy or rename it to `dumpcpp`. === Build the CI-selected Hamlib revision The CI configuration selects the Hamlib revision supported by this WSJT-X source. Read it from the checked-out tree rather than assuming that the newest Hamlib branch is compatible: [source,bash] ---- cd ~/wsjtx-dev/src HAMLIB_BRANCH=$(awk -F'"' '/hamlib_branch:/ {print $2; exit}' \ .github/workflows/ci.yml) if test -n "$HAMLIB_BRANCH"; then echo "Building Hamlib $HAMLIB_BRANCH" else echo "hamlib_branch is missing" >&2 false fi ---- If this check fails, inspect the `hamlib_branch` setting in `.github/workflows/ci.yml` before continuing. [source,bash] ---- cd ~/wsjtx-dev git clone --depth 1 --branch "$HAMLIB_BRANCH" \ https://github.com/Hamlib/Hamlib.git hamlib-src cd hamlib-src ./bootstrap ./configure --prefix="$HOME/wsjtx-dev/hamlib-prefix" \ --enable-shared --disable-static \ --without-cxx-binding --without-readline \ CFLAGS="-DNDEBUG -g -O2 -fdata-sections -ffunction-sections" \ LDFLAGS="-Wl,--gc-sections" make -j"$(nproc)" make install-strip ---- This creates an isolated Hamlib installation under `~/wsjtx-dev/hamlib-prefix`; it does not replace another Hamlib installation on the computer. If the CI pin changes, remove or rename `hamlib-src` and `hamlib-prefix`, then repeat this section. A shallow clone made for an older tag may not contain the new revision. === Configure and build WSJT-X Return to the source tree and configure a local developer build. The normal build includes WSJT-X, MAP65, and QMAP; add `-DWSJT_SKIP_QMAP=ON` to omit QMAP. [source,bash] ---- cd ~/wsjtx-dev/src OMNIRIG=$(cygpath "C:/Program Files (x86)/Afreet/OmniRig/OmniRig.exe") cmake -G "MSYS Makefiles" -S . -B build \ -DCMAKE_PREFIX_PATH="$HOME/wsjtx-dev/hamlib-prefix" \ -DCMAKE_INSTALL_PREFIX=C:/WSJT \ -DOMNIRIG_TYPE_LIB="$OMNIRIG" \ -DCMAKE_Fortran_FLAGS="-fallow-argument-mismatch -std=legacy" \ -DWSJT_SKIP_MANPAGES=ON \ -DWSJT_FORTRAN_LIBRARY_VARIANTS=OPENMP_ONLY \ -Wno-dev cmake --build build -j"$(nproc)" ---- CMake 4.4 may report that `-Wno-dev` is deprecated. This notice is harmless; the guide keeps the option because it also works with the documented older CMake versions. The important options are: [%autowidth] |=== | Option | Purpose | `CMAKE_PREFIX_PATH` | Locates the Hamlib installation built above. | `CMAKE_INSTALL_PREFIX` | Selects the destination used by the install target. | `OMNIRIG_TYPE_LIB` | Identifies the OmniRig executable whose COM type library `dumpcpp` reads. | `CMAKE_Fortran_FLAGS` | Allows current gfortran to compile the project's legacy Fortran interfaces. | `WSJT_SKIP_MANPAGES` | Avoids Unix manpage tooling that is not used by the Windows build. | `WSJT_FORTRAN_LIBRARY_VARIANTS=OPENMP_ONLY` | Builds the normal OpenMP decoder-library variant. | `WSJT_GENERATE_DOCS=OFF` | Omits the local User Guide when Asciidoctor is not installed. | `WSJT_SKIP_QMAP=ON` | Omits QMAP from the build. |=== === Run the automated tests Tests are enabled by default. Hamlib's DLL must be on `PATH` while Windows loads test executables that use rig-control code: [source,bash] ---- cd ~/wsjtx-dev/src export PATH="$HOME/wsjtx-dev/hamlib-prefix/bin:$PATH" export QT_QPA_FONTDIR=C:/Windows/Fonts ctest --test-dir build --output-on-failure ---- Some GUI tests use Qt's offscreen platform, which does not find the Windows system fonts automatically. `QT_QPA_FONTDIR` lets those tests render text without installing a separate font package. To rerun a single test, substitute its name below: [source,bash] ---- ctest --test-dir build -R '^test_name$' --output-on-failure ---- An ordinary local test run does not require a separate pFUnit installation. === Install and run The build directory is useful for tests, but it is not a self-contained application layout. Install to the prefix selected during configuration: [source,bash] ---- cmake --build build --target install ---- This places the application under `C:\WSJT`. Executables and required runtime DLLs are collected in `C:\WSJT\bin`; program data is installed under `C:\WSJT\share\wsjtx`. Run `C:\WSJT\bin\wsjtx.exe` from Windows Explorer, Command Prompt, or the MINGW64 shell. The install step matters. A build-tree executable can find compiler and Qt DLLs through the MINGW64 environment, but it does not have the final data-file and plugin layout. It is suitable for a quick launch only: [source,bash] ---- export PATH="$HOME/wsjtx-dev/hamlib-prefix/bin:$PATH" export QT_QPA_PLATFORM_PLUGIN_PATH=/mingw64/share/qt5/plugins ./build/wsjtx.exe ---- Missing Hamlib on `PATH` produces a DLL-load failure. A missing Qt platform plugin commonly reports that `qwindows.dll` could not be found or loaded. Even when it starts, the build-tree application is not suitable for normal operation: features that require installed ephemeris, callsign, country, or other data files can fail. For example, an FT8 decode can report `ALLCALL7.TXT is too short or broken?`, and opening Astronomical Data can fail without the installed ephemeris. Use the installed copy for functional testing. === Create an unsigned installer After installing NSIS, create a package from the configured build: [source,bash] ---- cmake --build build --target package ---- The installer is written under `build` as `wsjtx--win64.exe`. It is unsigned, so Windows SmartScreen may warn about it. === Update safely Update the MSYS2 environment with: [source,bash] ---- pacman -Syu ---- Update the checked-out branch, then rerun the CMake configure command, build, and tests: [source,bash] ---- cd ~/wsjtx-dev/src git pull --ff-only ---- Rebuild Hamlib when the CI-selected revision changes. Use a new build directory after a major MSYS2 update changes GCC, gfortran, CMake, Qt, the MinGW runtime, or foundational libraries. Cached compiler and dependency paths from an older environment can otherwise produce confusing configure, link, or runtime failures. === Troubleshooting Windows builds For Windows build failures, check the following: * `echo "$MSYSTEM"` reports `MINGW64`. * Every tool check from the dependency section resolves under `/mingw64/bin`. * `OMNIRIG_TYPE_LIB` names an existing Windows installation of `OmniRig.exe`. * `mingw-w64-x86_64-openssl` is installed if CMake reports missing OpenSSL runtime DLLs. * `~/wsjtx-dev/hamlib-prefix` contains `include/hamlib/rig.h`, `lib/libhamlib.dll.a`, and `bin/libhamlib-4.dll`. After fixing a configuration error, rerun the configure command. For a useful support report, include: [source,bash] ---- echo "$MSYSTEM" git rev-parse --short HEAD cmake --version gcc --version gfortran --version pacman -Q | sort ---- Also include the complete CMake error or failing command, not only its final line, and state whether the failure occurred during configure, compile, test, install, package, or application launch. == Linux and macOS developer builds Use the native package manager for local-development dependencies, then build the CI-selected Hamlib revision into a private workspace. Keeping dependency source, installed libraries, and generated build files outside the WSJT-X checkout makes updates and clean rebuilds easier. === Install the dependencies On current Debian or Ubuntu systems, a practical dependency starting point is: [source,bash] ---- sudo apt update sudo apt install \ git build-essential cmake gfortran \ qtbase5-dev qttools5-dev qtmultimedia5-dev \ libqt5serialport5-dev libqt5websockets5-dev \ libqt5sql5-sqlite libqt5multimedia5-plugins \ libfftw3-dev libboost-log-dev libusb-1.0-0-dev libudev-dev \ portaudio19-dev autoconf automake libtool pkg-config texinfo \ asciidoctor ---- On macOS, install the Xcode command-line tools and the local developer dependencies with Homebrew: [source,bash] ---- xcode-select --install brew install cmake gcc qt@5 fftw boost libusb portaudio \ autoconf automake libtool pkg-config texinfo asciidoctor ---- === Clone the source Clone the public repository, substituting your fork's URL if contributing a change. If you already have a checkout, change to its root directory instead. [source,bash] ---- mkdir -p ~/wsjtx-dev git clone https://github.com/WSJTX/wsjtx.git ~/wsjtx-dev/src cd ~/wsjtx-dev/src ---- === Build the CI-selected Hamlib revision Start in the root of the WSJT-X checkout. Capture its path and read the Hamlib revision selected by that source: [source,bash] ---- WSJTX_SOURCE=$(git rev-parse --show-toplevel) WSJTX_WORKSPACE="$HOME/wsjtx-dev" mkdir -p "$WSJTX_WORKSPACE" HAMLIB_BRANCH=$(awk -F'"' '/hamlib_branch:/ {print $2; exit}' \ "$WSJTX_SOURCE/.github/workflows/ci.yml") if test -n "$HAMLIB_BRANCH"; then echo "Building Hamlib $HAMLIB_BRANCH" else echo "hamlib_branch is missing" >&2 false fi ---- If this check fails, inspect `.github/workflows/ci.yml` before continuing. The remaining commands assume the same terminal session. They create Hamlib source and installation directories beside each other under `~/wsjtx-dev`: [source,bash] ---- git clone --depth 1 --branch "$HAMLIB_BRANCH" \ https://github.com/Hamlib/Hamlib.git "$WSJTX_WORKSPACE/hamlib-src" cd "$WSJTX_WORKSPACE/hamlib-src" ./bootstrap ./configure --prefix="$WSJTX_WORKSPACE/hamlib-prefix" \ --enable-shared --disable-static \ --without-cxx-binding --without-readline make -j"$(getconf _NPROCESSORS_ONLN)" make install-strip ---- If the CI-selected revision changes, remove or rename `hamlib-src` and `hamlib-prefix`, then repeat this section. === Configure, build, test, and install These local builds skip manpage generation, which requires additional tools. On Linux, configure WSJT-X with the explicit source and workspace paths: [source,bash] ---- cmake -S "$WSJTX_SOURCE" -B "$WSJTX_WORKSPACE/wsjtx-build" \ -DCMAKE_PREFIX_PATH="$WSJTX_WORKSPACE/hamlib-prefix" \ -DWSJT_SKIP_MANPAGES=ON \ -DCMAKE_INSTALL_PREFIX="$HOME/wsjtx-prefix" cmake --build "$WSJTX_WORKSPACE/wsjtx-build" ctest --test-dir "$WSJTX_WORKSPACE/wsjtx-build" --output-on-failure cmake --build "$WSJTX_WORKSPACE/wsjtx-build" --target install ---- On macOS, include the Homebrew library prefixes and select Homebrew's `gfortran` explicitly. [source,bash] ---- cmake -S "$WSJTX_SOURCE" -B "$WSJTX_WORKSPACE/wsjtx-build" \ -DCMAKE_PREFIX_PATH="$WSJTX_WORKSPACE/hamlib-prefix;$(brew --prefix qt@5);$(brew --prefix fftw);$(brew --prefix boost);$(brew --prefix libusb);$(brew --prefix portaudio)" \ -DCMAKE_Fortran_COMPILER="$(brew --prefix gcc)/bin/gfortran" \ -DWSJT_SKIP_MANPAGES=ON \ -DCMAKE_INSTALL_PREFIX="$HOME/wsjtx-prefix" cmake --build "$WSJTX_WORKSPACE/wsjtx-build" ctest --test-dir "$WSJTX_WORKSPACE/wsjtx-build" --output-on-failure cmake --build "$WSJTX_WORKSPACE/wsjtx-build" --target install ----