Project

General

Profile

Actions

Feature #1323

closed

Include Python static libraries to build Python-C extensions with static linking

Added by Roman M. almost 9 years ago. Updated over 8 years ago.

Status:
Completed
Priority:
Normal
Assignee:
Vitaly M.
Category:
python
Target version:
Start date:
03/11/2016
Due date:
% Done:

100%

Estimated time:
CPU Architecture:
arm, arm64, mips, mips64, x86, x86_64
Host OS:
Linux, OS X, Windows
Toolchain:
Android version:

Description

Currently Python 2.7/3.5 in CrystaX NDK include only shared Python libs libpythonX.X.so. I'd like to be able to build Python-C statically-linked extensions with no external dependencies. Please include static libs libpythonX.X.a as well.

Actions #1

Updated by Dmitry M. almost 9 years ago

Yes, we've thought about it. There was several issues preventing us from doing that initially, but you're right, this is useful feature so we'd make it. I just can't promise it would be soon.

Actions #2

Updated by Dmitry M. almost 9 years ago

  • Status changed from Open to In Progress
  • Assignee changed from Dmitry M. to Vitaly M.
Actions #3

Updated by Vitaly M. over 8 years ago

step-1)
In order to have full control over static python libraries and more over to be able to play with python byte-code in any games,
first of all we need to have host pythons of the same major versions as we already have for target - python2.7 and python3.5
This task is almost done - remaining part https://tracker.crystax.net/issues/1354

step-2)
Build target python core as static library.
This static is expected to self-consistent but with one external symbol - struct _frozen PyImport_FrozenModules[]

step-3)
Now we can play with content of PyImport_FrozenModules[] and provide different levels of frozen modules:

  • level-0) Absolute minimal content for PyImport_FrozenModules - means you need nothing except static python core
  • level-1) Full content for PyImport_FrozenModules - means you have full access to python stdlib prebuilt as bytecode
  • level-2) Custom content for PyImport_FrozenModules - nearly the same what different freezing toools do (like cx_Freeze or others)
Actions #4

Updated by Vitaly M. over 8 years ago

Custom content for PyImport_FrozenModules
To make sure that everything works well here I decided to compile a completely static python interpreter without depends on any dynamic libraries. In this interpreter PyImport_FrozenModules list is filled full python-stdlib being frozen as byte-code.

Actual python-freezing tool adapted for CrystaX can be implemented lately when it is really needed - not as a part of this task.

Actions #6

Updated by Vitaly M. over 8 years ago

  • Status changed from In Progress to 3
  • % Done changed from 0 to 100
Actions #7

Updated by Dmitry M. over 8 years ago

  • Status changed from 3 to Completed

Merged and closed

Actions

Also available in: Atom PDF