[PyQt] Android & the pyqtdeploy tool: the provided demo relies on undocumented libraries/headers?

Jonathan Leaders jonathan at leadersandco.com
Thu Aug 23 21:09:25 BST 2018


Hey Phil! Thank you so much for the direction. We got further by 
following your advice of using the same versions of SIP & PyQt5 that was 
found in the pyqtdeploy demo image in the docs 
<http://pyqt.sourceforge.net/Docs/pyqtdeploy/_images/pyqt-demo.png>

I'm a big fan of software that is "one-click" dev environment setup. I 
noticed I had to use specific old versions of PyQt5, Python, SIP, for 
the pyqtdeploy demo to work. It'd be interesting to add a--download-libs 
argument to demo-build.py that automatically downloads the source 
archives, since only certain versions are compatible. To help make that 
easier, here is a list of statements to download versions that are 
listed in your docs image:


# you must first run the universal Qt Installer script to install 
exactly 5.9.3
# I used qt-unified-linux-x64-3.0.5-online.run to install exactly 5.9.3 
in ~/Qt5.9.3
ln -s ~/Qt5.9.3/ src/Qt

cd src

# Download source archive required by pyqtdeploy 2.1 (only certain 
versions work)
wget https://www.python.org/ftp/python/3.6.4/Python-3.6.4.tar.xz
wget 
https://superb-sea2.dl.sourceforge.net/project/pyqt/sip/sip-4.19.6/sip-4.19.6.tar.gz
wget 
https://phoenixnap.dl.sourceforge.net/project/pyqt/PyQt5/PyQt-5.9.2/PyQt5_gpl-5.9.2.tar.gz
wget 
https://download.qt.io/archive/qt/5.9/5.9.3/single/qt-everywhere-opensource-src-5.9.3.tar.xz

# Versions that are known to fail in pyqtdeploy 2.1:
#wget https://www.python.org/ftp/python/3.6.6/Python-3.6.6.tar.xz
#wget 
http://mirrors.ocf.berkeley.edu/qt/archive/qt/5.11/5.11.1/single/qt-everywhere-src-5.11.1.tar.xz
#wget 
https://superb-sea2.dl.sourceforge.net/project/pyqt/sip/sip-4.19.12/sip-4.19.12.tar.gz
#wget 
https://phoenixnap.dl.sourceforge.net/project/pyqt/PyQt5/PyQt-5.11.2/PyQt5_gpl-5.11.2.tar.gz

cd -


The documentation aside, here's where I'm stuck now. Have you seen this 
error before? This happens after everything is built, the build 
directory is removed, and things are freezing, so it's really late in 
the process. It looks like its an issue linking:
---------------------

/home/jonny/Android/android-ndk-r17b/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-g++ 
--sysroot=/home/jonny/Android/android-ndk-r17b/platforms/android-28/arch-arm/ 
-Wl,-soname,libpyqt-demo.so 
-Wl,-rpath=/home/jonny/Qt5.9.3/5.9.3/android_armv7/lib 
-Wl,--no-undefined -Wl,-z,noexecstack -shared -o libpyqt-demo.so 
pyqtdeploy_main.o pyqtdeploy_start.o pdytools_module.o _heapqmodule.o 
_math.o _posixsubprocess.o mathmodule.o selectmodule.o timemodule.o 
qrc_pyqtdeploy.o 
-L/home/jonny/Android/android-ndk-r17b/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a 
-L/home/jonny/Android/android-ndk-r17b/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9.x 
-L/home/jonny/Projects/organic-mail/tools/pyqtdeploy-2.1/demo/sysroot-android-32/lib 
-L/home/jonny/Projects/organic-mail/tools/pyqtdeploy-2.1/demo/sysroot-android-32/lib/python3.6/site-packages 
-L/home/jonny/Projects/organic-mail/tools/pyqtdeploy-2.1/demo/sysroot-android-32/lib/python3.6/site-packages/PyQt5 
-lQtAndroidExtras -lQtCore -lQtGui -lQtNetwork -lQtWidgets -lpython3.6 
-lsip -L/home/jonny/Qt5.9.3/5.9.3/android_armv7/lib -lQt5Widgets 
-L/opt/android/android-ndk-r10e/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a 
-L/opt/android/android-ndk-r10e/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9 
-lQt5Gui -lQt5Network -lQt5AndroidExtras -lQt5Core -lGLESv2 
-lgnustl_shared -lgcc -llog -lz -lm -ldl -lc
/home/jonny/Projects/organic-mail/tools/pyqtdeploy-2.1/demo/sysroot-android-32/lib/libpython3.6.a(posixmodule.o):posixmodule.c:function 
os_makedev: error: undefined reference to 'makedev'
/home/jonny/Projects/organic-mail/tools/pyqtdeploy-2.1/demo/sysroot-android-32/lib/libpython3.6.a(posixmodule.o):posixmodule.c:function 
os_minor: error: undefined reference to 'minor'
/home/jonny/Projects/organic-mail/tools/pyqtdeploy-2.1/demo/sysroot-android-32/lib/libpython3.6.a(posixmodule.o):posixmodule.c:function 
os_major: error: undefined reference to 'major'
collect2: error: ld returned 1 exit status
Makefile:259: recipe for target 'libpyqt-demo.so' failed
make: *** [libpyqt-demo.so] Error 1

-----------

Doing some digging into the C code, it appears it has to with this block 
in line 58 of posixmodule.c 
https://github.com/python/cpython/blob/3.6/Modules/posixmodule.c:
------

#ifdef HAVE_SYS_SYSMACROS_H
/* GNU C Library: major(), minor(), makedev() */
#include <sys/sysmacros.h>
#endif

--------
I wonder if it was a recent change based on this comment in February: 
https://github.com/IntelRealSense/librealsense/pull/1114#issuecomment-362528830

Any ideas? I'm stumped on how to get the Android APK of the pyqtdeploy 
demo built. Even with the versions listed it seems to fail building.

Thanks for your time, you've been very helpful.


On 08/22/2018 02:18 PM, Phil Thompson wrote:
> On 22 Aug 2018, at 10:13 pm, Jonathan Leaders<jonathan at leadersandco.com>  wrote:
>> The missing steps in the docs would be which versions to download (it would be nice to have a series of wget commands to download  the exact versions required in the docs). I didn't see any versioning requirements in the docs, but I did see the image of versions here:http://pyqt.sourceforge.net/Docs/pyqtdeploy/demo.html
>>
>> Are these versions in the image the ones I should use?
> If you don't want to change anything, eg. the sysroot.json file.
>
>> In any case, I notice I'm using openssl-1.0.2p.tar.gz -- not sure if 1.0.2p that is the same as 1.0.2 but it is failing to build trying to find the standard library (stdlib). Perhaps because the sysroot-android-32/includedirectory is empty? Shouldn't there be *.h files in there? I tried removing the sysroot and running again but it still failed.
> The include directory is populated as the sysroot is built.
>
> Do you have a working Android development environment set up?
>
> Phil

-- 



Leaders and Company <http://leadersandco.com> 		
*Jonathan Leaders <http://jonathanleaders.com>* • Coder 
<http://www.jonnyleaders.com/programming-portfolio/> • (424) 644-7048 
<tel:4246447048>
Leaders & Company LLC <http://leadersandco.com> • Los Angeles 
<https://www.google.com/maps/place/Los+Angeles,+CA/>


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20180823/54d88e8d/attachment.html>


More information about the PyQt mailing list