[PyQt] pyqtdeploy: include C-extension with multiple source files
Phil Thompson
phil at riverbankcomputing.com
Wed Jul 20 17:26:38 BST 2016
On 20 Jul 2016, at 3:00 pm, Thijs Triemstra <lists at collab.nl> wrote:
>
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On 16-07-16 17:26, Phil Thompson wrote:
>>
>> You need to build it externally and tell pyqtdeploy about the
>> static library.
>>
>> Phil
>>
>
> Thanks for the reply Phil. Finally managed to cross-compile Python for
> ARM so I could built an ARM version of the C-extension. This produced
> an .so file but when I try to load the .so dynamically from my
> application binary it throws errors like:
>
> File ":/foo/ui/__init__.py", line 100, in main
> File "bootstrap.py", line 969, in _find_and_load
> File "bootstrap.py", line 958, in _find_and_load_unlocked
> File "bootstrap.py", line 664, in _load_unlocked
> File "bootstrap.py", line 634, in _load_backward_compatible
> File ":/RPi/GPIO/__init__.py", line 23, in <module>
> File "bootstrap.py", line 969, in _find_and_load
> File "bootstrap.py", line 958, in _find_and_load_unlocked
> File "bootstrap.py", line 664, in _load_unlocked
> File "bootstrap.py", line 634, in _load_backward_compatible
> File ":/imp.py", line 242, in load_module
> File ":/imp.py", line 342, in load_dynamic
> File "bootstrap.py", line 693, in _load
> File "bootstrap.py", line 666, in _load_unlocked
> File "bootstrap.py", line 577, in module_from_spec
> File "bootstrap_external.py", line 903, in create_module
> File "bootstrap.py", line 222, in _call_with_frames_removed
> Uncaught exception <class 'ImportError'>: /opt/foo-pi/RPi._GPIO.so:
> undefined symbol: PyArg_ParseTupleAndKeywords
>
> Any idea? How do I tell pyqtdeploy about the static library?
You've compiled the C extension as a dynamically loaded module, not a static library. Your Python build needs to support the loading of dynamic modules and make the symbols visble to those modules.
Phil
More information about the PyQt
mailing list