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

Cannot build against Python.framework on macOS #188

Open
James-Hudson3010 opened this issue Feb 22, 2021 · 4 comments
Open

Cannot build against Python.framework on macOS #188

James-Hudson3010 opened this issue Feb 22, 2021 · 4 comments

Comments

@James-Hudson3010
Copy link

On macOS, it is common to have a python installation which creates Python.framework. For example, the .dmg installers from python.org will do this. It can also be done using pyenv with (for example):

PYTHON_CONFIGURE_OPTS="--enable-framework" pyenv install 3.8.5

If I use a build from pyenv with the Python.framework (version does not appear to matter) and then call autogen, I get the following error:

configure: error: in `/Users/jamesh/depot_localsoftware/libplist':
configure: error:
  Could not link test program to Python. Maybe the main Python library has been
  installed in some non-standard library path. If so, pass it to configure,
  via the LIBS environment variable.
  Example: ./configure LIBS="-L/usr/non-standard-path/python/lib"
  ============================================================================
   ERROR!
   You probably have to install the development version of the Python package
   for your distribution.  The exact name of this package varies among them.
  ============================================================================

I did try as it suggested and set the LIBS variable to various paths, but that did not help. Looking at config.log, I saw the source the failure:

configure:18078: clang -o conftest -g -O2  -I/Users/jamesh/.pyenv/versions/3.8.5/Python.framework/Versions/3.8/include/python3.8  -Wl,-stack_size,1000000  -framework CoreFoundation Python.framework/Versions/3.8/Python conftest.c  -L/Users/jamesh/.pyenv/versions/3.8.5/lib -lpython3.8 -lintl -ldl   -framework CoreFoundation  -lintl -ldl   -framework CoreFoundation  >&5
clang: error: no such file or directory: 'Python.framework/Versions/3.8/Python'

If I try the line manually with the full path to Python.framework/Versions/3.8/Python, it will find what it needs. Although, conftest.c will then not be found...I am not sure where that file comes from.

It is unclear how to call autogen so libplist will build in this context.

Note, that the sysconfig module can be used to obtain the information needed to understand how Python was installed on macOS. Some relevant variables are:

PYTHONFRAMEWORK = "Python"
PYTHONFRAMEWORKDIR = "Python.framework"
PYTHONFRAMEWORKINSTALLDIR = "/Users/jamesh/.pyenv/versions/3.8.5/Python.framework"
PYTHONFRAMEWORKPREFIX = "/Users/jamesh/.pyenv/versions/3.8.5"

when Python.framework is not being used, these variables are:

PYTHONFRAMEWORK = ""
PYTHONFRAMEWORKDIR = "no-framework"
PYTHONFRAMEWORKINSTALLDIR = ""
PYTHONFRAMEWORKPREFIX = ""
@jagdish24
Copy link

@James-Hudson3010 Have you found any solution yet? I am getting same.

@nikias
Copy link
Member

nikias commented Dec 10, 2021

This is what I do for the github actions build workflow:
https://github.com/libimobiledevice/libplist/blob/master/.github/workflows/build.yml#L63-L77

@LangeZhao
Copy link

try
export PYTHON=python3
then
./autogen.sh

@Ren-Qan
Copy link

Ren-Qan commented Nov 8, 2022

try
./autogen.sh CFLAGS="-arch arm64 -arch x86_64 -mmacosx-version-min=10.11" --without-cython

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

5 participants