[PyQt] Dynamic loading and pyqtdeplot and iOS

David Morris othalan at othalan.net
Wed May 4 17:37:13 BST 2016


Looks like you are already head of my reply: My first guess was to wonder
if the Python library is linked in.  Are you compiling a shared python
library as well?  Or linking a static Python library into the NumPy library?

No clue about your current problem.

If you want to static link NumPy, it is quite easy .... you are already
almost there if you are creating a shared library.  The trick is to
intercept the shared libarary build process and create a static library in
its place as NumPy does not build static libraries.  I've attached the file
to do this.  To use it, I set this environment variable in my makefile when
compiling NumPy.

LDSHARED=shared_to_static

Good luck!

David


On Wed, May 4, 2016 at 11:17 PM, Robert Kent <rob at gulon.co.uk> wrote:

> Hi David,
>
> Great minds think alike, I just actually took a step further by
> codesigning the module! Now I get a new error!
>
> File ":/imp.py", line 243, in load_module
> ImportError:
> dlopen(/var/mobile/Containers/Bundle/Application/E6DF5582-0426-4D83-815B-4862ABDACCB9/SpruceApp.app/
> numpy.core.multiarray.so, 2): Symbol not found: _PyBool_Type
> 15B-4862ABDACCB9/SpruceApp.app/numpy.core.multiarray.so
>   Expected in: flat namespace
>  in
> /var/mobile/Containers/Bundle/Application/E6DF5582-0426-4D83-815B-4862ABDACCB9/SpruceApp.app/
> numpy.core.multiarray.so
> Process 492 exited with status = 1 (0x00000001)
>
> This looks like I failed to link something...
>
> Anyway, I tried the static method and failed miserably, as in I managed to
> compile NumPy and make a libnumpy.a which I then linked against the
> application (via the LIBS variable in the .pro file), but python couldn't
> find (or didin't try to load/know about) the module. I would really
> appreciate a write up of this as I think this may very well be the answer
> for me too, thank you.
>
> I'm doing this with NumPy 1.9.3 as well, also manually patched.
>
> Thanks you very much indeed,
>
> Rob
>
>
> On 04/05/2016 17:11, David Morris wrote:
>
> Rob,
>
> While iOS does support dynamic modules as of version 8, that support is
> extremely limited compared to most platforms.  I have not experimented with
> it yet, however my understanding that dynamic modules must be compiled as a
> framework (not just a shared library) and must be properly signed, just
> like an app.
>
> For myself, I just compile NumPy as a static library compiled directly
> into the executable.  I can write up a description of how I did this if you
> are interested ....
>
> Out of curiosity, are you using the latest version of NumPy?  (1.11)  What
> did it take to get it compiled for iOS?  I am running version 1.9.3, but
> had to patch a few files.  I haven't looked into more recent versions yet,
> but suspect patching is necessary still ... ?
>
> David
>
> On Wed, May 4, 2016 at 10:56 PM, Robert Kent <rob at gulon.co.uk> wrote:
>
>> So, here I go again!
>>
>> Having successfully built my app and NumPy and (bits of) SciPy for
>> Android, I am now trying it on iOS... And having my usual struggle with
>> understanding how to build/load extension modules. I have managed to
>> compile NumPy for iOS and have the necessary .so files. I add them to the
>> bundle and then run the app and I get the following traceback:
>>
>> File ":/imp.py", line 243, in load_module
>> ImportError:
>> dlopen(/var/mobile/Containers/Bundle/Application/9AA43814-71DA-4544-993B-B783D83CB5B1/TestApp.app/
>> numpy.core.multiarray.so, 2): no suitable image found.  Did find:
>> 5B1/TestApp.app/numpy.core.multiarray.so: mmap() error 1 at
>> address=0x0471E000, size=0x000DC000 segment=__TEXT in Segment::map()
>> mapping
>> /var/mobile/Containers/Bundle/Application/9AA43814-71DA-4544-993B-B783D83CB5B1/TestApp.
>> Process 475 exited with status = 1 (0x00000001)
>>
>> I have no idea what this is telling me! It obviously finds image, tries
>> to load it and fails.
>>
>> Has anyone had any success is building and loading extension modules with
>> pyqtdeploy for iOS or any ideas on where to go from here. I'm guessing I've
>> compiled something incorrectly but I have no idea what/how.
>>
>> All help gratefully received,
>>
>> Rob
>> _______________________________________________
>> PyQt mailing list    PyQt at riverbankcomputing.com
>> https://www.riverbankcomputing.com/mailman/listinfo/pyqt
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20160504/bc4c6a31/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: shared_to_static
Type: application/octet-stream
Size: 1165 bytes
Desc: not available
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20160504/bc4c6a31/attachment.obj>


More information about the PyQt mailing list