[PyQt] pyqtdeploy, Android and extensions

Robert Kent rob at gulon.co.uk
Tue Apr 12 10:59:47 BST 2016


Sorry to bump my own threads again...

Same issue I was experiencing yesterday persists, namely that the 
extension module that I am trying to load is unable to find symbols that 
should be available through my android application, thus:

ImportError:
   dlopen failed: cannot locate symbol "PyMem_Free" referenced by 
numpy.core.multiarray.so

I have checked that my application (libpyqt5_android_test.so) has the 
required, unmangled symbol using nm. I have also checked (to the best of 
my ability/knowledge) that this isn't some red herring caused by the 
library that I am loading i.e a different error masked by python. I have 
also tried loading the library by a) placing it next to the app and 
letting pyqtdeploy load it, b) loading it via imp.load_module and c) 
loading it using ExtensionFileLoader as well as changing the .so files 
location in case this was a factor.

My question is this: why can my library not find symbols that, in 
theory, should be available from the object calling it?

Any thoughts or suggestions on how to either fix or find out more 
information would be really appreciated.

Thanks very much, Rob

On 11/04/2016 12:38, Robert Kent wrote:
> If I run 'nm' on my applications output .so file then I can see that 
> 'PyMem_Free' is exported as an unmangled symbol, so why can the numpy 
> .so being imported not find it during dlopen()?
>
> Any one got any experience with this?
>
> All help and suggestions appreciated.
>
> Thanks, Rob
>
> On 11/04/2016 11:45, Robert Kent wrote:
>> Ok, so a kind of success! If I add HAVE_DYNAMIC_LOADING to pyconfig.h 
>> then it loads the .so file... finally!
>>
>> However, it now complains that it can't find a symbol...
>>
>> ImportError:
>>   dlopen failed: cannot locate symbol "PyMem_Free" referenced by 
>> numpy.core.multiarray.so
>>
>> Any thoughts anyone?
>>
>> On 11/04/2016 10:41, Phil Thompson wrote:
>>> On 11 Apr 2016, at 10:31 am, Robert Kent <rob at gulon.co.uk> wrote:
>>>> I definitely went back and re-compiled Python on Friday to ensure I 
>>>> had used this switch... Which defines etc. should be set by this 
>>>> flag to allow C extension loading?
>>> It should define HAVE_DYNAMIC_LOADING and also cause dynload_shlib.c 
>>> to be compiled and linked.
>>>
>>> Phil
>>>
>>>> On 11/04/2016 10:28, Phil Thompson wrote:
>>>>> On 11 Apr 2016, at 10:22 am, Robert Kent <rob at gulon.co.uk> wrote:
>>>>>> Hi Phil,
>>>>>>
>>>>>> Sorry to bump a thread, but anyone got any more ideas re. cause 
>>>>>> or anything else I can attempt? Why would it be that python (imp) 
>>>>>> doesn't know how to load C extensions as the traceback implies? 
>>>>>> Are there any defines that need changing in pyconfig for example 
>>>>>> to allow this?
>>>>> Yes, but this should be taken care of when using 
>>>>> --enable-dynamic-loading with pyqtdeploycli.
>>>>>
>>>>> Phil
>>
>> _______________________________________________
>> PyQt mailing list    PyQt at riverbankcomputing.com
>> https://www.riverbankcomputing.com/mailman/listinfo/pyqt
>
> _______________________________________________
> PyQt mailing list    PyQt at riverbankcomputing.com
> https://www.riverbankcomputing.com/mailman/listinfo/pyqt



More information about the PyQt mailing list