[issue23670] Modifications to support iOS as a cross-compilation target

Todd Rovito report at bugs.python.org
Sun Jan 1 21:41:47 EST 2017


Todd Rovito added the comment:

Russell, this is excellent work!!!!  I am truly amazed that within a couple of hours I had Python built and running for the iOS simulator this is a feat I didn't think was possible.  Perspective on me I am very familiar with Linux, C, and Python but know very little about iOS and XCode keep that in mind when reviewing my comments.

MacOS: 10.12.2
Xcode: 8.2.1 (8C1002)
iOS: 10.2 (14C89)
Python source code: 3.5.1

I applied your last patch file name 20160217.diff.  The first issue I ran into was clock_settime() is unavailable in iOS so I went into timemodule.c line 164 and commented out the line:
ret = clock_settime((clocked_t)clk_id, &tp);
then added this line
ret = 0;

Next I think a more serious problem was with Python/random.c line 92 "Python/random.c:92:19: error: implicit declaration of function 'getentropy' is invalid in C99 [-Werror,-Wimplicit-function-declaration]"

So I did the same thing as above commented out the lines with the getentropy function and added a line of res = 0.  Who needs entropy anyway?  I wonder if this problem is related to issue 29057 (http://bugs.python.org/issue29057).

Next in your README file you list a file called main.c when the actual code is main.m.

Next main.m was not compiling with Xcode so I replaced with this line after looking at your Python-iOS-template project on GitHub, as I am not qualified to make these types of changes:

-line 31 was not compiling so I replaced:
wpython_home = Py_DecodeLocale([python_home UTF8String], NULL);

-line 54 had a similar error so I replaced:
python_argv[0] = Py_DecodeLocale(main_script, NULL);

-line 56 had a similar error so I replaced with this line:
python_argv[i] = Py_DecodeLocale(argv[i], NULL);

-line 89 comment it out to remove the assertion failure, I am not sure what
this line is supposed to do but no assertion failure seems like a better result.

I didn't want to blindly attach a diff as I don't understand the Apple lingo but I wanted to provide feedback in the hope that it helps get this patch committed so iOS becomes a target for CPython in the near future.  Thanks!

----------
nosy: +Todd.Rovito

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue23670>
_______________________________________


More information about the Python-bugs-list mailing list