[Python-Dev] Undefined dlopen When Building Module On Android

Cyd Haselton chaselton at gmail.com
Fri Jan 23 17:50:26 CET 2015


I guess I'll keep waiting...given the zero responses I've gotten from
the android side. :-(.

In the meantime...in case anyone is interested... since I have the
working binary, I executed it and went through each command in
setup.py to see what throws the 'undefined reference to dlopen' error.
Turns out that the distutils module is the culprit...specifically
distutils.core.


On Thu, Jan 22, 2015 at 8:33 AM, Brett Cannon <brett at python.org> wrote:
> A mobile SIG is being formed, but it doesn't have a mailing list yet, else
> that would be a good place to ask this question.
>
> On Wed Jan 21 2015 at 5:54:39 PM Guido van Rossum <guido at python.org> wrote:
>>
>> Maybe try a list focused on Android development? Few people in the Python
>> core development community have any Android experience. But the issues and
>> context you offer seem to be related to the Android world, not to Python.
>> (dlopen is used by a lot of systems, not just Python.)
>>
>> On Wed, Jan 21, 2015 at 2:43 PM, Cyd Haselton <chaselton at gmail.com> wrote:
>>>
>>> On Mon, Jan 19, 2015 at 5:23 PM, Cyd Haselton <chaselton at gmail.com>
>>> wrote:
>>> > On Mon, Jan 19, 2015 at 8:51 AM, Cyd Haselton <chaselton at gmail.com>
>>> > wrote:
>>> >> Hello,
>>> >> I'm struggling with a build issue on Android; I've posted to the
>>> >> general python list with no result, so I'm re-posting here in hopes
>>> >> that someone can help.  If this is the wrong place feel free to let me
>>> >> know.
>>> >>
>>> >> I'm attempting to build Python 2.7.8 on my Android device; I'm using
>>> >> an environment that simulates a Linux filesystem within the Android
>>> >> terminal using a port of fakechroot.  Within that environment I've
>>> >> ported and/or bootstrapped a number of Linux utilities (curl, git,
>>> >> openssl, gcc)
>>> >>
>>> >> I run ./configure, then make, and the executable and library are
>>> >> built.  The problem occurs when build_ext is run; the newly built
>>> >> python executable builds, then links _struct, and immediately
>>> >> afterwards I get an 'undefined reference to dlopen' error.
>>> >>
>>> >> If I run ./python setup.py --verbose -library-dirs /path/to/lib
>>> >> --libraries='c dl m' -f, the 'undefined reference to dlopen' error is
>>> >> thrown again.
>>> >>
>>> >> If I run ./python setup.py --verbose -library-dirs /path/to/lib
>>> >> --libraries='-lc -ldl -lm' -f the build continues past _struct...even
>>> >> though ld throws the expected 'unable to find -l-lc' and other errors.
>>> >>
>>> >> Let me know if you need me to provide additional information.  Any
>>> >> help would be greatly appreciated.
>>> >>
>>> >> Cyd
>>> >
>>> >
>>> > Additionally I took a strace of the error producing command. The
>>> > following is (hopefully) a relevant portion minus the various 'no such
>>> > file' lines before the correct lib is found (which it always is)
>>> >
>>> > 16513
>>> > open("/data/data/jackpal.androidterm/kbox2/bld/python/Python-2.7.8/Lib/distutils/unixccompiler.py",
>>> > O_RDONLY|O_LARGEFILE) = 3           16513
>>> >
>>> > open("/data/data/jackpal.androidterm/kbox2/bld/python/Python-2.7.8/Lib/distutils/unixccompiler.pyc",
>>> > O_RDONLY|O_LARGEFILE) = 4       16513 vfork()
>>> >  = 16525
>>> > 16513 wait4(16525,  <unfinished ...>
>>> > 16525 open("/data/data/jackpal.androidterm/kbox2/bin/sh",
>>> > O_RDONLY|O_LARGEFILE) = 3
>>> > 16525 execve("/data/data/jackpal.androidterm/kbox2/bin/sh", ["sh",
>>> > "-c", "gcc --sysroot=/usr/gcc-4.9.2/sysroot -print-multiarch >
>>> > build/temp.linux-armv7l-2.7/multiarch 2> /dev/null"], [/* 58 vars */])
>>> > = 0
>>> >
>>> > *snip call to libc intercepted by libfakechroot*
>>> >
>>> > 16525 open("/system/lib/libc.so", O_RDONLY|O_LARGEFILE|0x80000) = 3
>>> > 16525 open("/system/lib/libm.so", O_RDONLY|O_LARGEFILE|0x80000) = 3
>>> > 16525 open("/dev/__properties__",
>>> > O_RDONLY|O_LARGEFILE|O_NOFOLLOW|0x80000) = 3
>>> > 16525 open("build/temp.linux-armv7l-2.7/multiarch",
>>> > O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE, 0666) = 3
>>> > 16525 open("/data/data/jackpal.androidterm/kbox2/dev/null",
>>> > O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE, 0666) = 3
>>> > 16525 fork()                            = 16526
>>> > 16525 wait4(-1,  <unfinished ...>
>>> > 16526 open("/acct/uid/10186/tasks", O_RDWR|O_CREAT|O_LARGEFILE, 0666)
>>> > = -1 EACCES (Permission denied)
>>> >
>>> > See attached for remainder
>>>
>>> Should I be posting this issue elsewhere?
>>> Is more information needed?
>>>
>>> _______________________________________________
>>> Python-Dev mailing list
>>> Python-Dev at python.org
>>> https://mail.python.org/mailman/listinfo/python-dev
>>>
>>> Unsubscribe:
>>> https://mail.python.org/mailman/options/python-dev/guido%40python.org
>>
>>
>>
>>
>> --
>> --Guido van Rossum (python.org/~guido)
>> _______________________________________________
>> Python-Dev mailing list
>> Python-Dev at python.org
>> https://mail.python.org/mailman/listinfo/python-dev
>> Unsubscribe:
>> https://mail.python.org/mailman/options/python-dev/brett%40python.org


More information about the Python-Dev mailing list