Building squishrunner with Video Support

Building squishrunner from source is very rarely necessary. In the instructions from Installing Squish for Qt from Desktop Source Packages or Installing Squish for Qt from Embedded Source Packages, we avoid building it entirely, since it is only squishserver that needs to be binary-compatible with your AUT, while squishrunner can be taken from one of our official binary releases and typically runs on a desktop or a CI server that is using a popular operating system/platform.

However, in the rare cases where you do need to build squishrunner, (perhaps to support a different version of one of our supported script interpreters) this section explains how to build it with optional support for recording videos.

Requirements

Before we can configure squish, we need to satisfy these requirements:

  1. Install the development packages of the script languages you plan to use, for Python, Ruby, Perl or TCL (JavaScript is included with Squish).
  2. Qt 4.8 or greater must be available. If the path to qmake is in our PATH, it is picked up automatically by Squish's configure script.
  3. A C++ compiler matching the version used for building Qt, and on Windows, a way to open a command shell window with the compiler's command line tools in our PATH.

Setting Up Build Directory

Next, we set up a build directory, which we will refer to as <BUILDDIR> in the steps below. This directory needs to have the following contents:

  1. Sources to build openh264 v2.1.1 library
  2. Sources to build ffmpeg 4.4 library
  3. Sources to build Squish 7.0 or later. Download the source archive from Squish Download Center. If you can not see it there, ask your sales rep for access to the desktop or embedded source packages.
  4. build.sh, a cross-platform script for building ffmpeg with openh264 support:
    topDir=`pwd`
    
    packageName=$1
    
    cd $topDir/openh264
    make $OPENH264_ARGS
    make install-static $OPENH264_ARGS PREFIX=$topDir/install/openh264
    make install-headers $OPENH264_ARGS PREFIX=$topDir/install/openh264
    
    cd $topDir/ffmpeg
    export PKG_CONFIG_PATH=$topDir/install/openh264/lib/pkgconfig
    ./configure $FFMPEG_ARGS --prefix=$topDir/install/ffmpeg \
                --disable-static --enable-shared --disable-all \
                --disable-autodetect --enable-ffmpeg --disable-doc \
                --enable-avcodec --enable-avformat --enable-swscale \
                --disable-everything --enable-libopenh264 --enable-encoder=libopenh264 \
                --enable-protocol=file --enable-muxer=mp4 --build-suffix=Squish \
                --enable-debug --disable-stripping
    make
    make install
    
    cd $topDir/install/ffmpeg
    for i in `find . -name "*Squish.lib" -o -name "*Squish.so" -o -name "*Squish.dylib"`
    do
        cp -Pv $i `echo $i | sed s/Squish././`
    done
    
    tar -czf $topDir/$packageName -C $topDir/install ffmpeg
  5. On Windows only, build.bat, a batch file for building ffmpeg on Windows that uses MSYS2 to run build.sh:
    set MSYSTEM=MSYS
    set CHERE_INVOKING=1
    set MSYS2_PATH_TYPE=inherit
    set OPENH264_ARGS=OS=msvc %OPENH264_ARGS%
    set FFMPEG_ARGS=--toolchain=msvc %FFMPEG_ARGS%
    set PATH=c:\msys64\usr\bin;%LOCALAPPDATA%\bin\NASM;%PROGRAMFILES%\Git\usr\bin;%PATH%
    bash -l build.sh ffmpeg-4.4-squish-windows-x64.tar.gz

For 32-bit Builds

If you are using a 32-bit compiler and a 32-bit Qt, ffmpeg and openh264 need to be built for 32 bits also. To do this, we set some environment variables near the top of build.sh. Set them to the following values depending on your platform.

Windows
OPENH264_ARGS=ENABLE64BIT=No
FFMPEG_ARGS=--arch=i686
Debian Linux/Ubuntu
OPENH264_ARGS=ENABLE64BIT=No
FFMPEG_ARGS="--arch=i686 --extra-cflags=-m32 --extra-cxxflags=-m32 --extra-ldflags=-m32"

Building ffmpeg with openh264 Support

The official binary releases of ffmpeg on Windows use Windows Media Foundation for H.264 by default. On Linux, they use libx264. These binaries have issues when used with Squish. Configuring ffmpeg using the script below disables everything except Openh264 to avoid such issues.

WindowsInstall nasm.

Install MSYS2

Open an MSYS2 terminal and from there, install some additional packages:

$ pacman -sYY
$ pacman -S make pkg-config tar git

Open an developer's command line shell, such as x64 Native Tools Command Prompt for Visual Studio

C:\> cd BUILDDIR
C:\builddir> git clone https://github.com/cisco/openh264.git -b v2.1.1
C:\builddir> git clone https://git.ffmpeg.org/ffmpeg.git -b n4.4
C:\builddir> build.bat
Debian Linux/Ubuntu
$ sudo apt-get build-dep ffmpeg
$ cd BUILDDIR
$ git clone https://github.com/cisco/openh264.git -b v2.1.1
$ git clone https://git.ffmpeg.org/ffmpeg.git -b n4.4
$ ./build.sh ffmpeg-4.4-squish-linux-x64.tar.gz

After this step is done, if all is successful, you should see in <BUILDDIR> a directory called install, containing the built ffmpeg, and a ffmpeg-4.4-squish.tar.gz archive containing the same files.

Configuring and Building squishrunner with Video Support

WindowsWe need to specify in the configure line, the location of things like qmake, Python, and whatever other script interpreters we want to use, if they are not already in our PATH:
C:\builddir> mkdir squish-build
C:\builddir> cd squish-build
C:\builddir\squish-build> ..\squish-7.0-qt-src\configure --with-qmake=C:\Qt\5.15.7\msvc2019_64\bin\qmake
   --with-python3=C:\Python38\python.exe --disable-all --enable-runner --with-ffmpeg=..\install\ffmpeg\
C:\builddir\squish-build> build
Debian Linux/UbuntuQt, Python and other script interpreters are usually found automatically by configure as long as they were installed using the system package manager.
$ sudo apt-get install libperl-dev ruby-dev python3-dev qt5-qmake
$ mkdir squish-build
$ cd squish-build
$ ../squish-7.0-qt-src/configure --disable-all --enable-runner --with-ffmpeg=../install/ffmpeg/
$ ./build

© 2023 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners.
The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation.
Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.