New submission from Cyd Haselton:
This is a (hopefully) complete list of patches and modifications required to
natively build Python 3.4.2 on an Android device where
patches == listed issues in this bug tracker
modifications (mods) == unsubmitted patches and/or edits made to source
CAVEATS
Cyd Haselton added the comment:
All,
Just checking in as it has been a while...is there anything I need to do on my
end for this port?
--
___
Python tracker
<http://bugs.python.org/issue23
Cyd Haselton added the comment:
On May 29, 2015 10:52:23 AM CDT, Ryan Gonzalez wrote:
>
>Ryan Gonzalez added the comment:
>
>I thought you were running the tests...
>
Which tests?
>Or was there something I had to do that I missed?
>From one of the earlier messages I po
Cyd Haselton added the comment:
Will do...if by "try the tests now" you mean "run 'make tests'"...but it may be
about a week or two as a) I'm currently in the last stages of a mono port and
b) will be working on a PIE gcc for android 5.0 after, so that I ha
Cyd Haselton added the comment:
Update:
Now that I;ve finished porting a much-needed gdb to my device, I should have
time to tackle patch and testing this weekend. Will post results when I have
them.
--
___
Python tracker
<http://bugs.python.
Cyd Haselton added the comment:
UPDATE:
Spent this past weekend fixing the broken on-device compiler. Will get to
tests this weekend
--
___
Python tracker
<http://bugs.python.org/issue23
Cyd Haselton added the comment:
I've run into an error when building python in preparation for running tests
(i. e. with --with-pydebug in the ./configure params).
./libpython3.4dm.so: undefined reference to `_PyUnicode_CheckConsistency'
It doesn't seem to be defined anywhere i
Cyd Haselton added the comment:
FYI, Figured out that running ./configure with --with-pydebug does NOT define
Py_DEBUG in pyconfig.h.
Defining it in pyconfig.h got me past the "undefined reference to
`_PyUnicode_CheckConsistency'" error, but i'm now getting this:
if
Cyd Haselton added the comment:
No...haven't upgraded to Android 5.0 yet.
On June 29, 2015 9:00:01 AM CDT, Ryan Gonzalez wrote:
>
>Ryan Gonzalez added the comment:
>
>You compiled with -fPIE and GCC, right? I know the Android Clang seems
>broken.
>
>On June 29
Cyd Haselton added the comment:
Your question about -fPIE brings up a question: How should the differences
between Android 5 and previous versions be handled in regards to this issue?
Other than mandatory -fPIE, there are changes to Android[s libc that may make
patches for python on Android
Cyd Haselton added the comment:
On June 30, 2015 9:20:45 AM CDT, Ryan Gonzalez wrote:
>
>Ryan Gonzalez added the comment:
>
>On June 30, 2015 8:14:34 AM CDT, Cyd Haselton
>wrote:
>>
>>Cyd Haselton added the comment:
>>
>>Your question about -fP
Cyd Haselton added the comment:
UPDATE:
Haven't forgotten about this; I'm currently (thanks to Android's new mandatory
PIE binaries requirement) rebuilding all of the necessary utilities (openssl,
curl, git, etc) so that I can clone and test.
Between the above and a sharp incre
Cyd Haselton added the comment:
UPDATE:
Build environment is up and running; cloning repo now.
--
___
Python tracker
<http://bugs.python.org/issue23496>
___
___
Cyd Haselton added the comment:
Build complete. Unfortunately while some of the tests complete successfully,
the run ends in a segfault (see attached log)
--
Added file: http://bugs.python.org/file40002/py_test_results.log
___
Python tracker
<h
Cyd Haselton added the comment:
I'm compiling for ARM, not ARM64, on an armv7 device.
On July 23, 2015 7:10:35 PM CDT, Russell Keith-Magee
wrote:
>
>Russell Keith-Magee added the comment:
>
>What hardware architecture are you compiling for? If it's ARM64, and
>you
Cyd Haselton added the comment:
I assume so; I'm using whatever is pulled frommy fork of the git repo.
I've actually run into a different error that occured when i rebuilt to include
readline support; when I run ./python -m test I;m getting "ImportError: no
module name
Cyd Haselton added the comment:
As soon as I build a PIE gdb I can.
And right now, running ./python -m test throws the ImportError...so I'll
need to resolve that first
On Jul 25, 2015 12:38 PM, "Ryan Gonzalez" wrote:
>
> Ryan Gonzalez added the comment:
>
> So...I
Cyd Haselton added the comment:
Finally found a hacky fix for the "no module named _struct found"; I copied all
Modules/*.cpython-34m.so objects to Lib.
Unfortunately I still get a segfault error when test_ctypes is run:
[ 83/390/11] test_ctypes
Fatal Python error: Segmentation faul
Cyd Haselton added the comment:
A nominal bump before starting to re-build a PIE gdb to debug the segfault above
--
___
Python tracker
<http://bugs.python.org/issue23
Cyd Haselton added the comment:
After struggling to get helpful output from gdb it is looking like it will not
be possible due to the lack of debugging symbols in the libs on the android
device.
Still investigating.
--
___
Python tracker
<h
Cyd Haselton added the comment:
I thought porting gdb would be the difficult part of getting debug info. I was
so wrong.
Here is what I have so far, after lengthy consultation of the gdb manual. Bear
with me...it's basically a copy & paste of gdb session output:
(gdb) run
Startin
Cyd Haselton added the comment:
Result:
(gdb) bt
#0 0xb6a63cc8 in ?? ()
#1 0xb6a5feb0 in ?? ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
--
___
Python tracker
<http://bugs.python.org/issue23
Cyd Haselton added the comment:
No...compiled with GCC 4.9.2
On August 17, 2015 9:39:55 AM CDT, Ryan Gonzalez wrote:
>
>Ryan Gonzalez added the comment:
>
>Wait, did you compile this with Clang?
>
>On August 17, 2015 9:24:50 AM CDT, Cyd Haselton
> wrote:
>>
>&
Cyd Haselton added the comment:
A few questions for Russell:
>What hardware architecture are you compiling for? If it's ARM64, and you're
>not using a trunk version of libffi, that segfault in test_ctypes is to be
>expected.
Does this mean I can safely ignore the segfau
Cyd Haselton added the comment:
Question for Ryan Gonzalez:
Given this information...
On August 20, 2015 8:03:13 PM CDT, Russell Keith-Magee
wrote:
>
>Russell Keith-Magee added the comment:
>
>>>What hardware architecture are you compiling for? If it's ARM64, and
&g
Cyd Haselton added the comment:
Thanks Ryan.
Running ./python -m test (with the edit to the __init__.py for ctypes) produces
the following error:
[151/390/18] test_hash
Fatal Python error: Bus error
Current thread 0xb6f72ec8 (most recent call first):
File "/bld/pyt/cpython-android/Lib
Cyd Haselton added the comment:
Update:
I found this bug report (https://bugs.python.org/issue23786) and re-compiled
python with -mno-unaligned-access as mentioned. test_hash still throws a bus
error.
Back to drawing boardsuggestions welcome
Cyd Haselton added the comment:
On August 22, 2015 2:47:42 PM CDT, Ryan Gonzalez wrote:
>
>Ryan Gonzalez added the comment:
>
>I'm assuming gdb still doesn't work?
It does. I just don't know it well enough to know if the errors are something
I'm doing wrong o
Cyd Haselton added the comment:
UPDATE:
Still working on the test_hash issue; not making much progress
QUESTION
Does gdb have to be configured with the --with-python switch in order to debug
the python binary correctly?
--
___
Python tracker
<h
Cyd Haselton added the comment:
Ryan,
Here's the results after the edit to the ctypes test. I also re-compiled gdb
with python support, which is why this took so long
(gdb) file ./python
Load new symbol table from "./python"? (y or n) y
Reading symbols from ./python...done.
Cyd Haselton added the comment:
Still battling this bus error issue. Recompiling gdb --with-python did not
help; I still cannot get any useful info out of it. I suspect it may be due to
this error:
setpgrp failed in child: No such process
but I'm not sure.
At this point I'm go
Cyd Haselton added the comment:
UPDATE: Before downloading/building Google gdb source I ran test_gdb.py, which
failed completely. Details of those tests are attached.
--
Added file: http://bugs.python.org/file40586/test_gdb.log
___
Python tracker
Cyd Haselton added the comment:
UPDATE: Finslly rebuilding Python from github clone after having to factory
reset my tablet for reasons (root access). Hopefully build and tests will
benefit from paving and starting over.
--
___
Python tracker
Cyd Haselton added the comment:
Unfortunately, in spite of the other minor issues that resolved,I am still
getting a bus error when the hash test runs.
Before I dive back into trying to get gdb working to debug this, is there any
way to skip this test to see of the others run
Cyd Haselton added the comment:
GDB debugging isn't going to happen any time soon; all of the gdb tests fail.
I re-compiled with the --with-pydebug option, thinking that would help, but it
won't build; I get the following error when the newly built python starts to
build packag
Cyd Haselton added the comment:
Pretty sure there are binaries, but the python binary can't build its own
modules.
I'm using GCC 4.9.2 on Android L...which means it is a PIE and that Python is
being built as a PIE
--
___
Python trac
Cyd Haselton added the comment:
Key note: it looks like the config option --with-hash-algorithm does nothing;
python is still built with the siphash hash algorithim even though I specified
fnv and, in pyconfig.h:
/* Define hash algorithm for str, bytes and memoryview. SipHash24: 1, FNV: 2
Cyd Haselton added the comment:
The attached g-zipped file contains the first set of patches required to build
Python 3.4.2 from source in the environment specified in the origonal post.
Will post the second/final set ASAP
--
Added file:
http://bugs.python.org/file38209/python-3.4.2
Cyd Haselton added the comment:
Apologies for the tarball, but all patches within are related to this "issue"
Removing tarball and will re-post individual, cleaned-up patches, grouped by
issue.
Ryan, can you re-do patch for pythonrun.c? If not. I
Changes by Cyd Haselton :
Removed file:
http://bugs.python.org/file38209/python-3.4.2-androidpatches-1.tar.gz
___
Python tracker
<http://bugs.python.org/issue23
Cyd Haselton added the comment:
Thanks for the suggestion Victor, however I've only ported git to this
environment; the most I;ve used it is to run 'git clone' to pull source from a
repo. The recommendation from the mobile-sig mailing list is...given my lack of
familiarity
Cyd Haselton added the comment:
Thanks for that suggestion R. David...that would be ideal given the 2.x
requirements of Mercurial would mean i'd need to re-port Python before tackling
a port of Mercurial.
I'll wait until Ryan chimes in before I start serious work with git, jus
Cyd Haselton added the comment:
Thanks Ryan.
Should I create a branch off the master at github and patch there or just clone
the master and patch?
--
___
Python tracker
<http://bugs.python.org/issue23
Cyd Haselton added the comment:
...or, should I fork the 3.4 branch? If so, which one...3.4 or origin/3.4?
--
___
Python tracker
<http://bugs.python.org/issue23
Cyd Haselton added the comment:
Ethan,
The binary produced runs in the KBOX environment. It can be copied between
devices provided the target device has the KBOX environment installed.
Victor et al,
I read https://docs.python.org/devguide/devcycle.html#indevbranch a couple of
times and
Cyd Haselton added the comment:
Given Stephan's comments regarding Android support I'm beginning to think that
I may have bitten off more than I can chew. Is there an option between
'constant work' and 'zero contribution'?
I am not by any means an Android
Cyd Haselton added the comment:
Stefan,
I wouldn't know if they're reported to the same bug tracker...it's possible
they aren't. Additionally it's possible that the lack of locale support in
libc isn't considered a bug.
Ethan,
Given Victor's recommendat
Cyd Haselton added the comment:
How does this sound?
* I'll clone the fork of the 3.4 branch I made in github, build and patch.
* Ryan will (as best as he can) grab said patches, regenerate them for the bug
tracker or forward port them to 3.5 (in github? to Mercurial)
* I'll figu
Cyd Haselton added the comment:
>Well, why don't you try? :)
Resource optimization.
--
___
Python tracker
<http://bugs.python.org/issue23496>
___
___
Py
Cyd Haselton added the comment:
>Fine, I'm also optimizing and the "fix" isn't going into libmpdec.
>Android can use the Python version of decimal.
Er, ok. Not entirely sure what this means, mostly because the handful of spare
cycles not allocated to a) getting a fork
Cyd Haselton added the comment:
*ALL Android devices have /dev/ptmx (adb even assumes it)...should the
*configure script be modified to skip that check if cross-compiling for
*Android?
Yes, definitely. See the mods to pyconfig.h here"
https://code.google.com/p/python-for-android
Cyd Haselton added the comment:
Ryan,
Thanks. First commit in; all fixes for Android's broken mbstowcs, new
plat-android and plat-android/DLFCN.py.
What are you trying to build?
--
___
Python tracker
<http://bugs.python.org/is
Cyd Haselton added the comment:
Ryan,
Sounds good. I think I've got all of the bug tracker patches
committed/pushed...now I need to do all of the other edits. Aiming to be
finished by Friday/Saturday.
--
___
Python tracker
<http://bugs.py
Cyd Haselton added the comment:
Ryan,
I believe I've gotten all non-configure dependent commits in.
How do you want me to handle post-configure edits I;ve made to get Python
working (i.e. changes to pyconfig.h, Modules/Setup...)
--
___
P
Cyd Haselton added the comment:
Ryan,
Edits made to files generated or modified by running ./configure. Example:
pyconfig.h.
--
___
Python tracker
<http://bugs.python.org/issue23
Cyd Haselton added the comment:
I understand; I haven't made the edits to these files but the edits are needed
in order for the Android build to work properly.
How do you want me to handle them? I can post the expected values here as a
diff, or just as plain
Cyd Haselton added the comment:
I can...
./configure --prefix=/usr/python --enable-shared --without-ensurepip
...but configure didn't set up pyconfig.h correctly with those options. There
are some changes I had to make post-configure to pyconfig.h and others when I
initially built p
Cyd Haselton added the comment:
Ryan,
Here are the changes to pyconfig.h. I left out this
#define ANDROID 1
because GCC 4.8.x and up have -mandroid -mbionic that define __ANDROID__ so
I've been using that.
#define HAVE_BROKEN_MBSTOWCS 1
#undef HAVE_DEV_PTMX
#undef HAVE_GETHOSTBYNAME_R
#
Cyd Haselton added the comment:
Ryan,
What version of Android and KBOX are you using? Are you cross-compiling?
If not could you post the output of printenv from within KBOX here?
--
___
Python tracker
<http://bugs.python.org/issue23
Cyd Haselton added the comment:
Ryan,
There are utilities you'll need in the KBOX environment, some of which may not
be available at the KBOX download site.
You'll need to download the make, gcc 4.8.0 and gawk packages from the download
site, and vim and/or nano depending on your
Cyd Haselton added the comment:
Dog just died unexpectedly, behind on photograph project, need to start on
Python tutorial, have a chat in a different language on Sunday I need to prep
for and its patch day tomorrow.
So yeah. Completely understand
Cyd Haselton added the comment:
Ryan,
Has anyone taken you up on the non-KBOX testing?
Do you need me to test the patches within the KBOX environment?
--
___
Python tracker
<http://bugs.python.org/issue23
Cyd Haselton added the comment:
Ryan,
>From where do you want me to download Python for testing?
I'm assuming I need to test by a) downloading an unpatched 3.4.2, b) applying
patches, c) running ./configure && make && make install.. If this is
Cyd Haselton added the comment:
Ryan,
For now I'll make the edits to pyconfig.h manually after downloading the zip
from the tip and running configure with necessary params.
I'll do my best to get this done this weekend, but it may have to wait u
Cyd Haselton added the comment:
Hey Ryan,
Just now patching downloaded/unzipped tip and was wondering if there was an
order in which patches should be applied.
I ask because i'm getting the following when applying the
android_segfault_fix.patch
/bld/python/cpython-3.4/cpython-3.4/P
Cyd Haselton added the comment:
UPDATE: I found the file in github, under master, in Python/. It's not in the
3.4 or origin/3.4 branches...aren't we working on those? Or does it not matter?
--
___
Python tracker
<http://bugs.python.o
Cyd Haselton added the comment:
>From previous post:
**
How does this sound?
* I'll clone the fork of the 3.4 branch I made in github, build and patch.
* Ryan will (as best as he can) grab said patches, regenerate them for the bug
tracker or forward port them to
Cyd Haselton added the comment:
issue_20306.patch won't install; attempting to do so yields the following:
patching file configure.ac
Hunk 56 FAILED 4944/4944.
AC_MSG_RESULT($ENSUREPIP)
AC_SUBST(ENSU
Cyd Haselton added the comment:
Latest error:
gcc --sysroot=/usr/gcc-4.9.2/sysroot -c -Wno-unused-result -Wsign-compare
-Wunreachable-code -DNDEBUG -g -O3 -Wall -Wstrict-prototypes
-Werror=declaration-after-statement -I. -IInclude -I./Include
-DPy_BUILD_CORE -o Objects
Cyd Haselton added the comment:
Thanks Ryan, the patch worked.
Latest error (when building Modules/pwdmodule.c:)
^
./Modules/pwdmodule.c:86:2: error: stray '#' in program
+#endif
^
./Modules/pwdmodule.c:86:3: error: 'endif' undeclared (first use in this
function)
+#
Cyd Haselton added the comment:
Will do, re: removing the '+'.
Also, attempted to apply the updated patch and got the following:
/bld/python/cpython-master $ patch -p1 < issue_20306\ \(1\).patch
patching file Modules/pwdmodule.c
Possibly reversed hunk 1 at 244
Hunk 1 FAILED 79/
Cyd Haselton added the comment:
Update: Removing the random '+' on line 87 of pwdmodule.c allowed the build to
continue but it failed again with the following during or soon after linking:
Objects/unicodeobject.o: In function `PyUnicode_EncodeLocale':
/bld/python/cpython
Cyd Haselton added the comment:
Perhaps the 'include androidfn.h' should be removed from pythonrun.c? Or the
function definition added to the androidfn.h?
(IANACC)
--
___
Python tracker
<http://bugs.python.o
Cyd Haselton added the comment:
FYI, running 'make clean' && make does not resolve the last reported issue.
Trying 'make distclean' && ./configure && make.
--
___
Python
Cyd Haselton added the comment:
H. That patch failed to apply:
Possibly reversed hunk 1 at 1582
Hunk 1 failed 35/35
--
___
Python tracker
<http://bugs.python.org/issue23
Cyd Haselton added the comment:
Hello Ryan,
Error from latest patch:
Python/pythonrun.c:44:8: error: conflicting types for 'android_mbstowcs'
size_t android_mbstowcs(wchar_t *dest, char * in, int maxlen) {
^
In file included from Python/pythonrun.c:18:0:
Include/androidfn.h:
Cyd Haselton added the comment:
Done, but got this error:
Python/pythonrun.c: In function 'android_wcstombs':
Python/pythonrun.c:67:5: error: expected ';' before 'if'
if (c >= 0xdc800 && c <= 0xdcff)
^
Python/pythonrun.c:62:11: warning: vari
Cyd Haselton added the comment:
Thanks Ryan.
(Probably should remove original androidfn.h patch; patch complains with 'file
already exists' if I don't delete Include/androidfn.h before applying the
latest patch)
--
___
Python
Cyd Haselton added the comment:
FYI, even with patches applied to main.c and python.c, the newly-built python
binary segfaults in the same location.
I'll tear down and re-do everything (git clone master, patch, configure and
make) but I may not get to it until next we
Cyd Haselton added the comment:
Unfortunately starting from scratch did not solve the issue. Still getting a
segfault when the newly built binary tries to run sysconfig
--
___
Python tracker
<http://bugs.python.org/issue23
Cyd Haselton added the comment:
Ryan,
Here's the output from addr2line
bld/python/cpython-master/cpython $ addr2line -C -f -e
/lib/libpython3.5m.so.1.0 0008f42c
_PyMem_RawStrdup
/bld/python/cpython-master/cpython/Objects/obmalloc.
Cyd Haselton added the comment:
Do you have the time/means to create a quick patch for that?
I ask because even a simple flip like that becomes a major pain when working
with nano on a tablet.
If not, I'll start on it. Just thought I&
Cyd Haselton added the comment:
Ryan,
Sorry...same problem.
Segmentation fault
generate-posix-vars failed
make: *** [pybuilddir.txt] Error 1
/bld/python/cpython-master/cpython $ addr2line -C -f -e
/lib/libpython3.5m.so.1.0 0008f42c
_PyMem_RawStrdup
/bld/python/cpython-master/cpython/Objects
Cyd Haselton added the comment:
Ryan,
Found the missing fix.
In ./Programs/python.c
#ifndef __ANDROID__
oldloc = _PyMem_RawStrdup(setlocale(LC_ALL, NULL));
if (!oldloc) {
fprintf(stderr, "out of memory\n");
Cyd Haselton added the comment:
Patch for python.c that prevents segfault on Android
--
Added file: http://bugs.python.org/file39135/python.patch
___
Python tracker
<http://bugs.python.org/issue23
Cyd Haselton added the comment:
Ryan,
That fix is in the android_segfault patch, but it's for frozenmain.c not
python.c
I cloned from master on Fri/Sat. Will double-check commit tomorrow but I think
the problem is with the unpatched pyt
Cyd Haselton added the comment:
Ryan,
There's not a python.c in the ./Programs file?
--
___
Python tracker
<http://bugs.python.org/issue23496>
___
___
Pytho
Cyd Haselton added the comment:
FYI, I'm on commit c917493dc4ea2c32371da861aca2235f0a08e68e
--
___
Python tracker
<http://bugs.python.org/issue23496>
___
___
Cyd Haselton added the comment:
Ryan,
Completely forgot to download and apply it, but based on what I see there are a
few things that need to be corrected.
1) -python3.4m needs to be changed to -python3.5m...or the appropriate
versioning variable.
2) colons at the end of the elif lines in
Cyd Haselton added the comment:
Still working at this; I can't get the readline module to work. It is built
successfully but importing it produces the following error:
Traceback (most recent call last):
File "", line 1, in
ImportError: dlopen failed: could not load library
Cyd Haselton added the comment:
Finally got readline to work with this build, but since the fixes are to the
readline source tree I'm not sure if they should go here.
With that plus whatever fixes to patches I suggested previously, I think this
build works. What would be the next step
Cyd Haselton added the comment:
On a related note, I managed to get pip working with this build...minus some
errors with verbose mode. I first had to make some edits to setup.py and
Modules/Setup so that the build would find and make the _ssl and lzip modules.
After running make install, I
92 matches
Mail list logo