beeware / Python-Apple-support

A meta-package for building a version of Python that can be embedded into a macOS, iOS, tvOS or watchOS project.
MIT License
1.1k stars 159 forks source link

Modulemap for macOS Python.xcframework #151

Closed rehatkathuria closed 2 years ago

rehatkathuria commented 2 years ago

In order to properly utilise the macOS Python.xcframework I am adding a module.modulemap with the following contents:

module Python {
  umbrella header "Python.h"
  export *
  link "Python"
}

inside Python.xcframework/macos-arm64_x86_64/Headers

However, the above warns me about certain parts of the framework not being exported. I would really appreciate it if I could get some guidance on an appropriate modulemap to ensure I'm able to use the framework on macOS.

The above, when I attempt to use the framework, as expected, results in build errors pointing to undefined symbols.

I have attached a sample project for reference:

https://github.com/rehatkathuria/BeewarePythonMacOSSampelproject

freakboy3742 commented 2 years ago

The currently supported mechanism for using this support package is to use Briefcase. While we're definitely interested in making the modifications required to turn this into a "fully compliant" macOS module, that's not a configuration we currently support.

We're open to any patches to correct this situation, though.

rehatkathuria commented 2 years ago

It looks like the modulemap wasn't the issue here. I have managed to whittle away at the symbols not being found by adding

libncurses.5.4.tbdSystemConfiguration.framework

There are still some symbols failing to be found which I think belong to libFFI.

https://github.com/rehatkathuria/BeewarePythonMacOSSampelproject/commit/01d47ca339cde851ae82a5989c00eac3982f66ec

freakboy3742 commented 2 years ago

Yes - there are a number of dependent libraries that need to be included in a project; if you generate an empty project with Briefcase, you'll be able to see a working configuration.

rehatkathuria commented 2 years ago

Final missing link was libpanel.tbd. Closing. Thanks!