Short version
Help is needed to do a 32-bit static build of Qt5 on Windows. See link error at the end of this post.
Indeed, building against a static build of Qt4 is not sufficient anymore because the function QProcess::setInputChannelMode added in Qt 5.2 is needed on Windows by the applauncher.
Long version
What is this “interactive support” ?
Thanks to the suggestion of @ihnorton and help from @lassoan, we recently improved the launcher to support interactive process.
It basically makes the following possible:
before
macbook-pro:bin inorton$ ./SlicerPython
---> nothing happens, no display or response
^CTraceback (most recent call last):
File "<stdin>", line 1, in <module>
KeyboardInterrupt
after:
macbook-pro:bin inorton$ ./SlicerPython
Python 2.7.13 (default, Apr 5 2018, 16:41:55)
[GCC 4.2.1 Compatible Apple LLVM 8.1.0 (clang-802.0.42)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>
What is the launcher ?
The launcher is statically built executable allowing to prepare the environment before starting the “real” Slicer executable.
The associated source code is maintained at https://github.com/commontk/AppLauncher
How do you build the launcher ?
Each time we integrate changes to the master
branch or tag a new release, binaries for Linux, macOS and Windows are automatically uploaded here.
To efficiently support building the launcher statically against a static build of Qt4, we have pre-packaged build tree for the three operating system we support. See https://github.com/jcfr/qt-static-build
We now need to update these and have Qt5 build tree starting with Windows. But we have issue doing so.
Problem building statically Qt5 on windows ?
References:
Step by step
Step 1: Install Perl to C:\Perl64
- Download from http://www.activestate.com/activeperl
- Custom install:
- Disable example and documentation components
- Do not create Perl file association
- Do not add perl to PATH
Step 2: Open Git Bash and download sources
Note: we should probably only download qtbase
module
mkdir /c/Qt-static
cd /c/Qt-static
git clone git://github.com/qt/qt5/ --branch v5.11.1 --depth 1 --recursive 5.11.1
Step 3: Create C:\Qt-static\qt5vars.cmd
and associated desktop shortcut
Note: we on purpose selected x86
so that we have a 32-bit build tree that will allow to create binaries working on both 32-bit and 64-bit windows install.
REM Set up \Microsoft Visual Studio 2017, where <arch> is \c amd64, \c x86, etc.
REM CALL "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Auxiliary\Build\vcvarsall.bat" x86
CALL "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86
SET _ROOT=C:\Qt-static\5.11.1
SET PATH=%_ROOT%\qtbase\bin;%_ROOT%\gnuwin32\bin;%PATH%
REM Uncomment the below line when using a git checkout of the source repository
SET PATH=%_ROOT%\qtrepotools\bin;%PATH%
SET _ROOT=
SET PATH=C:\Perl64\bin;%PATH%
SET PATH=C:\Python37-x64;%PATH%
In C:\Qt-static\
, create a shortcut link named qt5-shell
by specifying the command %SystemRoot%\system32\cmd.exe /E:ON /V:ON /k C:\Qt-static\qt5vars.cmd
as application and C:\Qt-static
as working directory.
Step 4: Download jom
Download http://download.qt.io/official_releases/jom/jom.zip and copy the jom.exe
into C:\Qt-static\5.11.1
Step 5: Start terminal using the Desktop link created in a previous step and configure Qt
cd C:\Qt-static\5.11.1
configure.bat -platform win32-msvc -release ^
-nomake examples ^
-nomake tests ^
-opensource ^
-confirm-license ^
-static ^
-qt-zlib ^
-qt-pcre ^
-qt-libpng ^
-qt-libjpeg ^
-qt-freetype ^
-no-ssl ^
-no-opengl ^
-skip qt3d ^
-skip qtactiveqt ^
-skip qtandroidextras ^
-skip qtcanvas3d ^
-skip qtcharts ^
-skip qtconnectivity ^
-skip qtdatavis3d ^
-skip qtdeclarative ^
-skip qtdoc ^
-skip qtdocgallery ^
-skip qtenginio ^
-skip qtfeedback ^
-skip qtgamepad ^
-skip qtgraphicaleffects ^
-skip qtimageformats ^
-skip qtlocation ^
-skip qtmacextras ^
-skip qtmultimedia ^
-skip qtnetworkauth ^
-skip qtpim ^
-skip qtpurchasing ^
-skip qtqa ^
-skip qtquickcontrols ^
-skip qtquickcontrols2 ^
-skip qtremoteobjects ^
-skip qtrepotools ^
-skip qtscript ^
-skip qtscxml ^
-skip qtsensors ^
-skip qtserialbus ^
-skip qtserialport ^
-skip qtspeech ^
-skip qtsvg ^
-skip qtsystems ^
-skip qttools ^
-skip qttranslations ^
-skip qtvirtualkeyboard ^
-skip qtwayland ^
-skip qtwebchannel ^
-skip qtwebengine ^
-skip qtwebglplugin ^
-skip qtwebsockets ^
-skip qtwebview ^
-skip qtwinextras ^
-skip qtx11extras ^
-skip qtxmlpatterns
Step 6: Build
C:\Qt-static\5.11.1> jom
jom 1.1.2 - empower your cores
cd qtbase\ && ( if not exist Makefile C:\Qt-static\5.11.1\qtbase\bin\qmake.exe -o Makefile C
:\Qt-static\5.11.1\qtbase\qtbase.pro ) && C:\Qt-static\5.11.1\jom.exe -f Makefile
cd src\ && ( if not exist Makefile C:\Qt-static\5.11.1\qtbase\bin\qmake.exe -o Makefile C:\Q
t-static\5.11.1\qtbase\src\src.pro ) && C:\Qt-static\5.11.1\jom.exe -f Makefile
cd corelib\ && ( if not exist Makefile.qtzlib C:\Qt-static\5.11.1\qtbase\bin\qmake.exe -o Ma
kefile.qtzlib C:\Qt-static\5.11.1\qtbase\src\corelib\qtzlib.pro ) && C:\Qt-static\5.11.1\jom.exe -f
Makefile.qtzlib
[...]
C:\Qt-static\5.11.1\jom.exe -f Makefile.Release
cd sql\ && ( if not exist Makefile C:\Qt-static\5.11.1\qtbase\bin\qmake.exe -o Makefile C:\Q
t-static\5.11.1\qtbase\src\sql\sql.pro ) && C:\Qt-static\5.11.1\jom.exe -f Makefile
C:\Qt-static\5.11.1\jom.exe -f Makefile.Release
cd 3rdparty\harfbuzz-ng\ && ( if not exist Makefile C:\Qt-static\5.11.1\qtbase\bin\qmake.exe
-o Makefile C:\Qt-static\5.11.1\qtbase\src\3rdparty\harfbuzz-ng\harfbuzz-ng.pro ) && C:\Qt-static\5
.11.1\jom.exe -f Makefile
C:\Qt-static\5.11.1\jom.exe -f Makefile.Release
cd tools\uic\ && ( if not exist Makefile C:\Qt-static\5.11.1\qtbase\bin\qmake.exe -o Makefil
e C:\Qt-static\5.11.1\qtbase\src\tools\uic\uic.pro ) && C:\Qt-static\5.11.1\jom.exe -f Makefile
C:\Qt-static\5.11.1\jom.exe -f Makefile.Release
cd network\ && ( if not exist Makefile C:\Qt-static\5.11.1\qtbase\bin\qmake.exe -o Makefile
C:\Qt-static\5.11.1\qtbase\src\network\network.pro ) && C:\Qt-static\5.11.1\jom.exe -f Makefile
C:\Qt-static\5.11.1\jom.exe -f Makefile.Release
cd dbus\ && ( if not exist Makefile C:\Qt-static\5.11.1\qtbase\bin\qmake.exe -o Makefile C:\
Qt-static\5.11.1\qtbase\src\dbus\dbus.pro ) && C:\Qt-static\5.11.1\jom.exe -f Makefile
C:\Qt-static\5.11.1\jom.exe -f Makefile.Release
Qt5Core.lib(qstring.obj) : error LNK2019: unresolved external symbol "public: class QFlags<enum QReg
ularExpression::PatternOption> __thiscall QRegularExpression::patternOptions(void)const " (?patternO
ptions@QRegularExpression@@QBE?AV?$QFlags@W4PatternOption@QRegularExpression@@@@XZ) referenced in fu
nction "public: class QString __thiscall QString::section(class QRegularExpression const &,int,int,c
lass QFlags<enum QString::SectionFlag>)const " (?section@QString@@QBE?AV1@ABVQRegularExpression@@HHV
?$QFlags@W4SectionFlag@QString@@@@@Z)
Qt5Core.lib(qstringlist.obj) : error LNK2001: unresolved external symbol "public: class QFlags<enum
QRegularExpression::PatternOption> __thiscall QRegularExpression::patternOptions(void)const " (?patt
ernOptions@QRegularExpression@@QBE?AV?$QFlags@W4PatternOption@QRegularExpression@@@@XZ)
Qt5Core.lib(qstring.obj) : error LNK2019: unresolved external symbol "public: void __thiscall QRegul
arExpression::setPatternOptions(class QFlags<enum QRegularExpression::PatternOption>)" (?setPatternO
ptions@QRegularExpression@@QAEXV?$QFlags@W4PatternOption@QRegularExpression@@@@@Z) referenced in fun
ction "public: class QString __thiscall QString::section(class QRegularExpression const &,int,int,cl
ass QFlags<enum QString::SectionFlag>)const " (?section@QString@@QBE?AV1@ABVQRegularExpression@@HHV?
$QFlags@W4SectionFlag@QString@@@@@Z)
Qt5Core.lib(qstring.obj) : error LNK2019: unresolved external symbol "public: __thiscall QRegularExp
ression::QRegularExpression(class QRegularExpression const &)" (??0QRegularExpression@@QAE@ABV0@@Z)
referenced in function "public: class QString __thiscall QString::section(class QRegularExpression c
onst &,int,int,class QFlags<enum QString::SectionFlag>)const " (?section@QString@@QBE?AV1@ABVQRegula
rExpression@@HHV?$QFlags@W4SectionFlag@QString@@@@@Z)
[...]
FAQ
How do you create the list of -skip option
to give to configure.bat
?
Copy list of modules from https://github.com/qt/qt5 into a text file (e.g /tmp/qt-modules.txt
):
qt3d @ 3a3fa5d Update submodules on '5.11' in qt5 a day ago
qtactiveqt @ e977cfd Update submodules on '5.11' in qt5 13 days ago
[...]
then run the following command:
for module in $(cat /tmp/qt-modules.txt | cut -d"@" -f1 | tr -d "\t" | tr -d " "); do echo "-skip $module ^"; done
In the command we used, we removed -skip qtbase