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

2015-01-24 Thread Cyd Haselton
Closer.

make && make install ran successfully; however running the newly
installed binary results in the same error.

On Sat, Jan 24, 2015 at 5:08 PM, Frank, Matthew I
 wrote:
> Android's dlopen() works slightly differently than the normal Unix dlopen() 
> in at least two different ways.  I haven't seen your particular problem, but 
> that's probably because I'm cross-building CPython (building everything I 
> need on a Linux machine, and then copying the install directory to the 
> Android machine.)
>
> (1) When building for Android you need to explicitly include the "-ldl" flag 
> on the command line for the link step.  (In Linux the dlopen() routine is 
> included in libc, so "-ldl" is not necessary).  I suspect that some part of 
> your distutils was not linked correctly.  (Since I'm cross-building I've 
> never run distutils on the Android side, which is probably why I've not seen 
> this.)  Your best bet would be to run under a debugger and figure out which 
> line of C code in which .so file is throwing the error.  Then going back to 
> the build scripts and looking at how that .so file is getting linked.  (For 
> an example of someone else having a similar problem see for example, 
> http://stackoverflow.com/questions/25846927/git-built-on-android-throws-undefined-reference-to-dlopen-error).
>
> (2) The other possibility has to do with a quirk in Android's dlopen() 
> implementation.  On most legacy Unix systems (including Linux) when you 
> dlopen() a library Z then all the already loaded libraries A, B, C, ... are 
> searched for any dependences of Z (even if Z was not explicitly linked 
> against any of A, B, C,...).  On Android (perhaps for security reasons) 
> that's not true, if Z depends on A, then you need to have "-lA" when you link 
> Z.  An example (and patch) for this problem is 
> http://bugs.python.org/issue21668.
>
> -Matt
>
>> -Original Message-
>> From: Cyd Haselton [mailto:chasel...@gmail.com]
>> Sent: Friday, January 23, 2015 10:50 AM
>> To: Brett Cannon
>> Cc: Guido van Rossum; Python-Dev
>> Subject: Re: [Python-Dev] Undefined dlopen When Building Module On Android
>>
>> 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  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  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  wrote:
>> >>>
>> >>> On Mon, Jan 19, 2015 at 5:23 PM, Cyd Haselton 
>> >>> wrote:
>> >>> > On Mon, Jan 19, 2015 at 8:51 AM, Cyd Haselton
>> >>> > 
>> >>> > 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 

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

2015-01-24 Thread Cyd Haselton
Replies in body of message for clarity:

On Sat, Jan 24, 2015 at 5:08 PM, Frank, Matthew I
 wrote:
> Android's dlopen() works slightly differently than the normal Unix dlopen() 
> in at least two different ways.  I haven't seen your particular problem, but 
> that's probably because I'm cross-building CPython (building everything I 
> need on a Linux machine, and then copying the install directory to the 
> Android machine.)

Yeah...I have a Linux machine but it currently resides as a gunzipped
tarball on an external drive...I lack the space to decompress and use
it for building purposes.

> (1) When building for Android you need to explicitly include the "-ldl" flag 
> on the command line for the link step.  (In Linux the dlopen() routine is 
> included in libc, so "-ldl" is not necessary).  I suspect that some part of 
> your distutils was not linked correctly.  (Since I'm cross-building I've 
> never run distutils on the Android side, which is probably why I've not seen 
> this.)  Your best bet would be to run under a debugger and figure out which 
> line of C code in which .so file is throwing the error.  Then going back to 
> the build scripts and looking at how that .so file is getting linked.  (For 
> an example of someone else having a similar problem see for example, 
> http://stackoverflow.com/questions/25846927/git-built-on-android-throws-undefined-reference-to-dlopen-error).

Funny you should reference that post as I'm the one who started it; I
ported git, which required curl and openssl ports, a while ago
and...as I think I mentioned in that post...I had to go back and
re-port openssl, making sure to throw in -ldl wherever possible.

Python (which I'm building in the same environment in which I built
openssl, git and curl) is a different beast altogether.  Environment
variables that make it to the Makefile don't make it into the modules
built by setup.py, which is run by distutils, which I wasn't aware was
built alongside Python until you mentioned it just now.  Then there
are the modules in Setup...which are built or not...seemingly
independently of whether or not the line specifying the module is
commented out or not; the hack workaround is to put every module that
should be excluded in setup.py...even if it is commented out in Setup.

Obviously I'm still trying to get a handle on the Python build process.


> (2) The other possibility has to do with a quirk in Android's dlopen() 
> implementation.  On most legacy Unix systems (including Linux) when you 
> dlopen() a library Z then all the already loaded libraries A, B, C, ... are 
> searched for any dependences of Z (even if Z was not explicitly linked 
> against any of A, B, C,...).  On Android (perhaps for security reasons) 
> that's not true, if Z depends on A, then you need to have "-lA" when you link 
> Z.  An example (and patch) for this problem is 
> http://bugs.python.org/issue21668.

Thanks for the bit of info above...very useful.  I've included -lc
-ldl in the requisite places in Setup, and setup.py...although it's
entirely possible I've not added it to places that need it given that
I'm still struggling to understand the build process.

Right now I'm at the point where running configure && make finishes
successfully but throws warnings during the module build and import
process.  Running make install fails completely with the same
'undefined reference to dlopen' because, for some reason, make install
requires the sharedmods target to be rebuilt again, which fails
because setup.py fails when importing distutils.core.  Why it doesn't
do the same when running make is beyond me.

Cyd
___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


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

2015-01-24 Thread Frank, Matthew I
Android's dlopen() works slightly differently than the normal Unix dlopen() in 
at least two different ways.  I haven't seen your particular problem, but 
that's probably because I'm cross-building CPython (building everything I need 
on a Linux machine, and then copying the install directory to the Android 
machine.)

(1) When building for Android you need to explicitly include the "-ldl" flag on 
the command line for the link step.  (In Linux the dlopen() routine is included 
in libc, so "-ldl" is not necessary).  I suspect that some part of your 
distutils was not linked correctly.  (Since I'm cross-building I've never run 
distutils on the Android side, which is probably why I've not seen this.)  Your 
best bet would be to run under a debugger and figure out which line of C code 
in which .so file is throwing the error.  Then going back to the build scripts 
and looking at how that .so file is getting linked.  (For an example of someone 
else having a similar problem see for example, 
http://stackoverflow.com/questions/25846927/git-built-on-android-throws-undefined-reference-to-dlopen-error).

(2) The other possibility has to do with a quirk in Android's dlopen() 
implementation.  On most legacy Unix systems (including Linux) when you 
dlopen() a library Z then all the already loaded libraries A, B, C, ... are 
searched for any dependences of Z (even if Z was not explicitly linked against 
any of A, B, C,...).  On Android (perhaps for security reasons) that's not 
true, if Z depends on A, then you need to have "-lA" when you link Z.  An 
example (and patch) for this problem is http://bugs.python.org/issue21668.

-Matt

> -Original Message-
> From: Cyd Haselton [mailto:chasel...@gmail.com]
> Sent: Friday, January 23, 2015 10:50 AM
> To: Brett Cannon
> Cc: Guido van Rossum; Python-Dev
> Subject: Re: [Python-Dev] Undefined dlopen When Building Module On Android
> 
> 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  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  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  wrote:
> >>>
> >>> On Mon, Jan 19, 2015 at 5:23 PM, Cyd Haselton 
> >>> wrote:
> >>> > On Mon, Jan 19, 2015 at 8:51 AM, Cyd Haselton
> >>> > 
> >>> > 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

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

2015-01-23 Thread Cyd Haselton
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  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  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  wrote:
>>>
>>> On Mon, Jan 19, 2015 at 5:23 PM, Cyd Haselton 
>>> wrote:
>>> > On Mon, Jan 19, 2015 at 8:51 AM, Cyd Haselton 
>>> > 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,  
>>> > 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|0x8) = 3
>>> > 16525 open("/system/lib/libm.so", O_RDONLY|O_LARGEFILE|0x8) = 3
>>> > 16525 open("/dev/__properties__",
>>> > O_RDONLY|O_LARGEFILE|O_NOFOLLOW|0x8) = 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,  
>>> > 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@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@python.org
>> https://mail.python.org/mailman/listinfo/python-dev
>> Unsubscribe:
>> https://mail.python.org/mailman/options/python-dev/brett%40python.org
___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mai

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

2015-01-22 Thread Brett Cannon
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  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  wrote:
>
>> On Mon, Jan 19, 2015 at 5:23 PM, Cyd Haselton 
>> wrote:
>> > On Mon, Jan 19, 2015 at 8:51 AM, Cyd Haselton 
>> 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,  
>> > 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|0x8) = 3
>> > 16525 open("/system/lib/libm.so", O_RDONLY|O_LARGEFILE|0x8) = 3
>> > 16525 open("/dev/__properties__",
>> > O_RDONLY|O_LARGEFILE|O_NOFOLLOW|0x8) = 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,  
>> > 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@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@python.org
> https://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: https://mail.python.org/mailman/options/python-dev/
> brett%40python.org
>
___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


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

2015-01-21 Thread Guido van Rossum
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  wrote:

> On Mon, Jan 19, 2015 at 5:23 PM, Cyd Haselton  wrote:
> > On Mon, Jan 19, 2015 at 8:51 AM, Cyd Haselton 
> 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,  
> > 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|0x8) = 3
> > 16525 open("/system/lib/libm.so", O_RDONLY|O_LARGEFILE|0x8) = 3
> > 16525 open("/dev/__properties__",
> > O_RDONLY|O_LARGEFILE|O_NOFOLLOW|0x8) = 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,  
> > 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@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@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


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

2015-01-21 Thread Cyd Haselton
On Mon, Jan 19, 2015 at 5:23 PM, Cyd Haselton  wrote:
> On Mon, Jan 19, 2015 at 8:51 AM, Cyd Haselton  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,  
> 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|0x8) = 3
> 16525 open("/system/lib/libm.so", O_RDONLY|O_LARGEFILE|0x8) = 3
> 16525 open("/dev/__properties__",
> O_RDONLY|O_LARGEFILE|O_NOFOLLOW|0x8) = 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,  
> 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@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com