On Tuesday, February 17, 2015 4:40 PM, Cyd Haselton wrote:
> Some additional import failures.  I;ve compared build instructions for these 
> modules
> and can't find anything that stands out as to why one module will import and 
> the other
> doesn't:
[...]
> ImportError: dlopen failed: cannot locate symbol "PyErr_BadArgument" 
> referenced by
> "array.cpython-34m.so"...
[...]
> ImportError: dlopen failed: cannot locate symbol "PyMem_Malloc" referenced by
> "_random.cpython-34m.so"...
[...]
> ImportError: dlopen failed: cannot locate symbol "PyMem_Malloc" referenced by
> "zlib.cpython-34m.so"...
[...]
> ImportError: dlopen failed: cannot locate symbol "PySequence_GetItem" 
> referenced by
> "_bisect.cpython-34m.so"...
[...]
> ImportError: dlopen failed: cannot locate symbol "PyErr_SetNone" referenced by
> "_pickle.cpython-34m.so"...

All those missing symbols are defined in libpython3.4m.so.  I suspect that 
array.cpython-34m.so, _random.cpython-34m.so, zlib.cpython-34m.so, 
_bisect.cpython-34m.so and _pickle.cpython-34m.so were all compiled without the 
correct -lpython3 flag.  I suspect that some other imports are not displaying 
this problem because, although they also are not compiled with -lpython3, they 
aren't trying to access symbols from libpython3.4m.so.

If I'm correct, the problem here is with Android's broken dlopen().  On Linux 
(and every other Unix I'm aware of) when Executable A links B then tries to 
dlopen C, if C needs to access symbols from B it just succeeds (whether or not 
you linked C with "-lB".)  On Android you _must_ link C against "-lB" for this 
to work.  This is a known bug in Android's loader and won't be fixed, because 
the supposed security advantages of not accidentally linking something you 
didn't mean to link supposedly outweigh the disadvantages of not being able to 
correctly compile linux packages for Android.

I ran into only a few instances of these when getting Python 3.4 to cross 
compile to Android, and none with missing -lpython3 flags (most were missing 
-lm flags).  But I'm not running setup.py on the Android side.  I'm running on 
it the Linux host (using the Python interpreter on the Linux host.)

-Matt

_______________________________________________
Mobile-sig mailing list
[email protected]
https://mail.python.org/mailman/listinfo/mobile-sig

Reply via email to