Project

General

Profile

Feature #1323

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

Added by Roman Miroshnychenko about 3 years ago. Updated about 3 years ago.

Status:
Closed
Priority:
Normal
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.

History

#1 Updated by Dmitry Moskalchuk about 3 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.

#2 Updated by Dmitry Moskalchuk about 3 years ago

  • Status changed from Open to In Progress
  • Assignee changed from Dmitry Moskalchuk to Vitaly Murashev

#3 Updated by Vitaly Murashev about 3 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)

#4 Updated by Vitaly Murashev about 3 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.

#6 Updated by Vitaly Murashev about 3 years ago

  • Status changed from In Progress to Done
  • % Done changed from 0 to 100

#7 Updated by Dmitry Moskalchuk about 3 years ago

  • Status changed from Done to Closed

Merged and closed

Also available in: Atom PDF