Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fork relocatable-python for native packaging #5

Open
AkechiShiro opened this issue Sep 2, 2022 · 1 comment
Open

Fork relocatable-python for native packaging #5

AkechiShiro opened this issue Sep 2, 2022 · 1 comment

Comments

@AkechiShiro
Copy link
Contributor

AkechiShiro commented Sep 2, 2022

@viferga to package natively for macOS, we need to fork and maintain our own relocatable Python, this repo : https://github.com/gregneagle/relocatable-python

Also merging these two PRs :

@brillard1
Copy link
Contributor

brillard1 commented Apr 4, 2023

On utilzing the relocatable-python for native packaging, it successfully creates the python framework object for the target version till 3.9.9 [Listed here]

To check if the framework is universal or not, run the universal script in terminal

./python_universal_tester.sh 3.x.x [enter python version]

It produces the following output:

Using Python 3.9.9
      90 libraries (*.so and *.dylib) found in the framework; only        0 are universal!
.
.
.
Python.framework/Versions/3.9.9/Resources/Python.app/Contents/MacOS/Python is not universal!
Python.framework/Versions/Current/Python is not universal!
Python.framework/Versions/Current/bin/python3.9.9 is not universal!

The above issues arise due since the current Python framework is not built as a universal binary, which means it only supports a single architecture. This poses a problem as our users may be using different architectures, and we want our framework to be compatible with all of them. The following issues have been identified:

  • Lack of support for building universal Python frameworks
  • Failure to compile libraries for both arm64 and x86_64 architectures
  • Libraries compiled for a specific architecture may cause issues when used on another architecture

To address these issues and build a universal Python framework, the following can be potential solutions:

  • Use the ./configure --enable-universalsdk flag when building Python to ensure it is built as a universal binary.
  • Use the lipo tool to merge the architecture-specific libraries into a single universal library. This can be done by adding a script to our build process that calls lipo after each library is built. [here]
  • Ensure that any third-party libraries used by our framework are also built as universal binaries or, alternatively, provide separate builds for each architecture.

By following these steps, we can create a universal Python framework that is compatible with multiple architectures and can be used by a wider range of users.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants