Skip to content

Commit

Permalink
Recompiling Qt on linux with -qt-xcb option in order to try to fix sm…
Browse files Browse the repository at this point in the history
…arie/env-switcher-gui#12 .

* Added more details on the compilation options in the readme.
  • Loading branch information
smarie committed Oct 23, 2017
1 parent ae8fcd8 commit 57e3b61
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 11 deletions.
5 changes: 2 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ install:
- echo $QT_DIR
# only build qt if needed (no cached version yet)
# !!!! warning NO QUOTES and NO CURLY BRACES in the test !!!!
- if ls $QT_DIR/lib/*.so 1> /dev/null 2>&1; then
- if ls $QT_DIR/lib-NOCACHE/*.so 1> /dev/null 2>&1; then
echo "Qt was already built in a previous run, using cached folder $QT_DIR";
ls $QT_DIR/lib;
else
Expand All @@ -68,7 +68,7 @@ script:
- echo $PYQT_DIR
# only build pyqt if needed (no cached version yet)
# !!!! warning NO QUOTES and NO CURLY BRACES in the test !!!!
- if [ ! -f $PYQT_DIR/QtGui.pyi ]; then
- if [ ! -f $PYQT_DIR/QtGui-NOCACHE.pyi ]; then
echo "Building PyQt from sources using script $TRAVIS_BUILD_DIR/ci_tools/build_pyqt.sh";
rm -rf $PYQT_DIR;
source "$TRAVIS_BUILD_DIR/ci_tools/build_pyqt.sh";
Expand All @@ -93,7 +93,6 @@ after_success:

# PyQt sources+binaries
- echo "Creating PyQt+src archive" ;
export PYQT_SUF=_gpl_%SUF% ;
sudo tar czvf ${TRAVIS_BUILD_DIR}/dist/PyQt${PYQT_VER}_gpl_py${TRAVIS_PYTHON_VERSION}_${SUF}-with_src.tar.gz PyQt${PYQT_VER}-with_src >/dev/null

# PyQt binaries only (note: we do not include the lib*.so since they dont seem to be needed, they are not copied by the standard pyqt installer)
Expand Down
30 changes: 25 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,20 @@ xcopy /Y .\__init__.py "%PYQT_INSTALL_DIR%"

For reference, the build options currently used to build Qt5.6.3-minimal are

### Linux

```bash
-opensource -confirm-license \
-no-icu -no-cups -no-qml-debug -no-compile-examples -no-harfbuzz -no-sql-mysql -no-sql-odbc -no-sql-sqlite -qt-pcre \
-opensource -confirm-license -prefix /home/travis/build/smarie/PyQt5-minimal/Qt5.6.3 \
-no-icu -no-cups -no-qml-debug -no-compile-examples -no-harfbuzz -no-sql-mysql -no-sql-odbc -no-sql-sqlite -qt-pcre -qt-xcb \
-skip qtlocation -skip qt3d -skip qtmultimedia -skip qtwebchannel -skip qtwayland -skip qtandroidextras -skip qtwebsockets -skip qtconnectivity -skip qtdoc -skip qtwebview -skip qtimageformats -skip qtwebengine -skip qtquickcontrols2 -skip qttranslations -skip qtxmlpatterns -skip qtactiveqt -skip qtx11extras -skip qtsvg -skip qtscript -skip qtserialport -skip qtdeclarative -skip qtgraphicaleffects -skip qtcanvas3d -skip qtmacextras -skip qttools -skip qtwinextras -skip qtsensors -skip qtenginio -skip qtquickcontrols -skip qtserialbus \
-nomake examples -nomake tests -nomake tools
```

### Windows

```cmd
-opensource -confirm-license -platform win32-g++ -release -prefix %QT_DIR% \
-no-compile-examples -no-sql-mysql -no-sql-odbc -no-sql-sqlite -no-icu -no-cups -no-harfbuzz -no-incredibuild-xge -no-ssl -no-openssl -no-dbus -no-audio-backend -no-qml-debug -no-native-gestures -opengl desktop \
-skip qtlocation -skip qt3d -skip qtmultimedia -skip qtwebchannel -skip qtwayland -skip qtandroidextras -skip qtwebsockets -skip qtconnectivity -skip qtdoc -skip qtwebview -skip qtimageformats -skip qtwebengine -skip qtquickcontrols2 -skip qttranslations -skip qtxmlpatterns -skip qtactiveqt -skip qtx11extras -skip qtsvg -skip qtscript -skip qtserialport -skip qtdeclarative -skip qtgraphicaleffects -skip qtcanvas3d -skip qtmacextras -skip qttools -skip qtwinextras -skip qtsensors -skip qtenginio -skip qtquickcontrols -skip qtserialbus \
-nomake examples -nomake tests -nomake tools
```
Expand All @@ -147,14 +158,23 @@ For reference, the build options currently used to build Qt5.6.3-minimal are

For reference, the build options currently used to build PyQt5.6-minimal are

### Linux

```bash
--confirm-license \
--no-python-dbus --no-qml-plugin --no-qsci-api --no-tools \
--disable QtHelp --disable QtMultimedia --disable QtMultimediaWidgets --disable QtNetwork --disable QtOpenGL --disable QtPrintSupport --disable QtQml --disable QtQuick --disable QtSql --disable QtSvg --disable QtTest --disable QtWebKit --disable QtWebKitWidgets --disable QtXml --disable QtXmlPatterns --disable QtDesigner --disable QAxContainer --disable QtDBus --disable QtWebSockets --disable QtWebChannel --disable QtNfc --disable QtBluetooth --disable QtX11Extras --disable QtQuickWidgets --disable _QOpenGLFunctions_2_0 --disable _QOpenGLFunctions_2_1 --disable _QOpenGLFunctions_4_1_Core
```

Notes:
Note: on linux, PyQt is patched so that Makefiles generated by Qt's qmake are able to find the libraries. Indeed the generated makefiles only contain `-rpath` which seems not sufficient for the linker to find the libraries - we therefore add `-L`. This may be linked to the following [issue](https://forum.qt.io/topic/59670/how-to-compile-qt-with-relative-runpath-paths) ? The patch file used can be found in `ci_tools/`, there is one per version.

### Windows

* on linux, PyQt is patched so that Makefiles generated by Qt's qmake are able to find the libraries. Indeed the generated makefiles only contain `-rpath` which seems not sufficient for the linker to find the libraries - we therefore add `-L`. This may be linked to the following [issue](https://forum.qt.io/topic/59670/how-to-compile-qt-with-relative-runpath-paths) ? The patch file used can be found in `ci_tools/`, there is one per version.
```cmd
--confirm-license \
--no-python-dbus --no-qml-plugin --no-qsci-api --no-tools \
--disable QtHelp --disable QtMultimedia --disable QtMultimediaWidgets --disable QtNetwork --disable QtOpenGL --disable QtPrintSupport --disable QtQml --disable QtQuick --disable QtSql --disable QtSvg --disable QtTest --disable QtWebKit --disable QtWebKitWidgets --disable QtXml --disable QtXmlPatterns --disable QtDesigner --disable QAxContainer --disable QtDBus --disable QtWebSockets --disable QtWebChannel --disable QtNfc --disable QtBluetooth --disable QtX11Extras --disable QtQuickWidgets --disable _QOpenGLFunctions_2_0 --disable _QOpenGLFunctions_2_1 --disable _QOpenGLFunctions_4_1_Core \
--spec=win32-g++ --verbose
```

* On windows PyQt is patched so that Makefiles generated by Qt's qmake contain an additional CXXFLAG -D_hypot=hypot to fix an issue with mingw64's math library.
Note: on windows PyQt is patched so that Makefiles generated by Qt's qmake contain an additional CXXFLAG `-D_hypot=hypot` to fix a known issue with mingw64's math library, see [here](https://stackoverflow.com/a/29489843/7262247) and [here](https://stackoverflow.com/a/12918400/7262247).
2 changes: 1 addition & 1 deletion ci_tools/build_install_qt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ sudo apt-get install libglu1-mesa-dev -y

cd $QT_SRC_DIR
echo "(d) Configuring Qt in $PWD"
sudo ./configure -opensource -confirm-license -prefix $QT_DIR -no-icu -no-cups -no-qml-debug -no-compile-examples -no-harfbuzz -no-sql-mysql -no-sql-odbc -no-sql-sqlite -qt-pcre -skip qtlocation -skip qt3d -skip qtmultimedia -skip qtwebchannel -skip qtwayland -skip qtandroidextras -skip qtwebsockets -skip qtconnectivity -skip qtdoc -skip qtwebview -skip qtimageformats -skip qtwebengine -skip qtquickcontrols2 -skip qttranslations -skip qtxmlpatterns -skip qtactiveqt -skip qtx11extras -skip qtsvg -skip qtscript -skip qtserialport -skip qtdeclarative -skip qtgraphicaleffects -skip qtcanvas3d -skip qtmacextras -skip qttools -skip qtwinextras -skip qtsensors -skip qtenginio -skip qtquickcontrols -skip qtserialbus -nomake examples -nomake tests -nomake tools
sudo ./configure -opensource -confirm-license -prefix $QT_DIR -no-icu -no-cups -no-qml-debug -no-compile-examples -no-harfbuzz -no-sql-mysql -no-sql-odbc -no-sql-sqlite -qt-pcre -qt-xcb -skip qtlocation -skip qt3d -skip qtmultimedia -skip qtwebchannel -skip qtwayland -skip qtandroidextras -skip qtwebsockets -skip qtconnectivity -skip qtdoc -skip qtwebview -skip qtimageformats -skip qtwebengine -skip qtquickcontrols2 -skip qttranslations -skip qtxmlpatterns -skip qtactiveqt -skip qtx11extras -skip qtsvg -skip qtscript -skip qtserialport -skip qtdeclarative -skip qtgraphicaleffects -skip qtcanvas3d -skip qtmacextras -skip qttools -skip qtwinextras -skip qtsensors -skip qtenginio -skip qtquickcontrols -skip qtserialbus -nomake examples -nomake tests -nomake tools

## Note: to get the list of modules (to use with -skip): find . -regextype sed -maxdepth 1 -regex "./qt[^b^\.].*"
## Note: -no-dbus does not work, it still looks for it later in the compilation
Expand Down
5 changes: 3 additions & 2 deletions ci_tools/build_pyqt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,16 @@ tar -xvf $PYQT_ARCHIVE.tar.gz >/dev/null
ls -la
mv $TRAVIS_BUILD_DIR/$PYQT_ARCHIVE $PYQT_DIR

echo "(c) Installing PyQt dependencies "
echo "(c) Installing PyQt dependencies (not sure they are needed, these are Qt dependencies)"
sudo apt-get install libxcb*
# from https://wiki.qt.io/Install_Qt_5_on_Ubuntu: install opengl libraries so as to be able to build QtGui
sudo apt-get install mesa-common-dev
sudo apt-get install libglu1-mesa-dev -y

cd $PYQT_DIR
echo "(d) Patching PyQt configure.py in $PWD"
# apply our HACK patch to fix the generated makefiles
patch ./configure.py < ../ci_tools/pyqt$PYQT_VER_SHORT-$PYQT_VER-configure.py.patch
patch ./configure.py < ../ci_tools/pyqt$PYQT_VER_MAJOR-$PYQT_VER-configure.py.patch

echo "(e) Configuring PyQt in $PWD"
python configure.py --no-python-dbus --no-qml-plugin --no-qsci-api --no-tools --confirm-license --disable QtHelp --disable QtMultimedia --disable QtMultimediaWidgets --disable QtNetwork --disable QtOpenGL --disable QtPrintSupport --disable QtQml --disable QtQuick --disable QtSql --disable QtSvg --disable QtTest --disable QtWebKit --disable QtWebKitWidgets --disable QtXml --disable QtXmlPatterns --disable QtDesigner --disable QAxContainer --disable QtDBus --disable QtWebSockets --disable QtWebChannel --disable QtNfc --disable QtBluetooth --disable QtX11Extras --disable QtQuickWidgets --disable _QOpenGLFunctions_2_0 --disable _QOpenGLFunctions_2_1 --disable _QOpenGLFunctions_4_1_Core
Expand Down

0 comments on commit 57e3b61

Please sign in to comment.