Qt for Python/GettingStarted/X11: Difference between revisions
m (→Development) |
(Adding missing libICU issue) |
||
Line 83: | Line 83: | ||
==== Troubleshooting ==== | ==== Troubleshooting ==== | ||
* '''Wrong RUNPATH''' | |||
If the ''RUNPATH'' is wrongly setted in your Python (virtual environment), and it is pointing to the system | If the ''RUNPATH'' is wrongly setted in your Python (virtual environment), and it is pointing to the system | ||
instead of your local installation, you can ''patch'' it with a binary that PySide2 provide: | instead of your local installation, you can ''patch'' it with a binary that PySide2 provide: | ||
Line 89: | Line 90: | ||
And then proceed to re-install PySide2. | And then proceed to re-install PySide2. | ||
(you can check if the patch worked with ''readelf -d /path/to/your/python/virtualenv/binary/python'') | (you can check if the patch worked with ''readelf -d /path/to/your/python/virtualenv/binary/python'') | ||
* '''Missing libICU cause linking problems''' | |||
From 5.9+ you can get a copy of libICU specifying ''--standalone'' (but not including ''--iculib-url'') as an argument to ''setup.pu'' execution. |
Revision as of 09:49, 25 January 2018
(Page under development)
Requirements
- GCC (Linux)
- Python from https://www.python.org/downloads/ (Python 3.6 or Python 2.7)
- Qt 5.6+
- CLANG 3.9 (for 5.9+ branches)
- OpenSSL 1.0
- CMake from https://cmake.org/download/ (>= 3.1)
- LLVM
- virtualenv (optional but recommended)
- Python sphinx package for documentation (optional, pip install sphinx)
Building from sources
Setting up CLANG
- Download libclang, e.g.
wget http://download.qt.io/development_releases/prebuilt/libclang/libclang-release_39-linux-Rhel7.2-gcc5.3-x86_64.7z
- Extract the files, e.g.
7z x libclang-release_39-linux-Rhel7.2-gcc5.3-x86_64.7z
- Export the installation path to the path you choosed to place the files
export CLANG_INSTALL_DIR=$PWD/libclang
Getting PySide2
- Clonning the official repository
git clone --recursive https://codereview.qt-project.org/pyside/pyside-setup
- Checking out the version that we want to build, e.g. 5.9 (Keep in mind you need to use the same version as your Qt installation)
cd pyside-setup && git checkout 5.9
Building PySide2
- Check your Qt installation path, to specifically use that version of qmake to build PySide2:
which qmake
- Check your OpenSSL installation path, to specify it to build PySide2:
which openssl
- Build can take a few minutes, so it is recommended to use more than one CPU core (e.g. 8). Remember to replace the paths to your current qmake and openssl path:
python setup.py build --qmake=/path/to/qmake --openssl=/path/to/openssl --build-tests --ignore-git --jobs=8
Installing PySide2
- To install on the current directory, just run:
python setup.py install --qmake=/path/to/qmake --openssl=/path/to/openssl --build-tests --ignore-git --jobs=8
Test installation
- You can execute one of the examples to verify the process is properly working.
- Remember to properly set the environment variables for Qt and PySide2.
python examples/examples/widgets/widgets/tetrix.py
Development
Development happens in the 5.9 and dev branches of the pyside-setup repository.
The top level repository has the following submodules:
- sources/pyside2-tools: uic, rcc tools
- examples/
Contributions follow the standard process.
It is helpful to have debug binaries or symbols for Python available. Debug packages can be installed separately in some Linux distributions (e.g.: Ubuntu, the packages python3-dbg, libpython3-dbg provide a debug binary python3-dbg)
If your distribution does not include them, you can download python and compile it by yourself, e.g.
./configure --prefix=/your/installation/path CFLAGS="-O0 -fno-inline -fno-omit-frame-pointer -g" LDFLAGS="-O0" CPPFLAGS="-O0" OPT="-O0 -g" make make install
It is also recommended to use a Virtual Environment for testing to be able to always start from a clean base and avoid issues with write permissions in installations.
A new virtual environment can be created as follows:
virtualenv -p /usr/bin/python3-dbg testenv
Please take into consideration that the binary name might be different in your system, and that you can choose a different name for the environment instead of testenv.
Troubleshooting
- Wrong RUNPATH
If the RUNPATH is wrongly setted in your Python (virtual environment), and it is pointing to the system instead of your local installation, you can patch it with a binary that PySide2 provide:
cd pyside-setup ./patchelf --set-rpath /path/to/your/local/python/lib /path/to/your/python/virtualenv/binary/python
And then proceed to re-install PySide2. (you can check if the patch worked with readelf -d /path/to/your/python/virtualenv/binary/python)
- Missing libICU cause linking problems
From 5.9+ you can get a copy of libICU specifying --standalone (but not including --iculib-url) as an argument to setup.pu execution.