[issue46248] Compilation errors on macOS

2022-01-03 Thread Sandip Shah


New submission from Sandip Shah :

macOS Monterey 12.1
Python 3.10.1

Trying to compile libplist, libimobiledevice, libimobiledevice_glue generates 
the 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 LDFLAGS environment variable."

The fix is change the following lines (570-571) in 
/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/_sysconfigdata__darwin_darwin.py

from:
'LINKFORSHARED': '-Wl,-stack_size,100  -framework CoreFoundation '
  'Python.framework/Versions/3.10/Python',
to:
'LINKFORSHARED': '-Wl,-stack_size,100  -framework CoreFoundation '
  '/Library/Frameworks/Python.framework/Versions/3.10/Python',

Also, change the following line (110) in 
/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/config-3.10-darwin

from:
LINKFORSHARED=  -Wl,-stack_size,100  -framework CoreFoundation 
$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)
to:
LINKFORSHARED=  -Wl,-stack_size,100  -framework CoreFoundation 
$(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)

It seems the problem got created from - https://bugs.python.org/issue15298 - 
and most likely it exists in all the versions of Python (it exists in the 
native Python 2.7.18 that comes with macOS too.

Thanks.

--
components: macOS
messages: 409611
nosy: ned.deily, ronaldoussoren, sandipshah
priority: normal
severity: normal
status: open
title: Compilation errors on macOS
type: compile error
versions: Python 3.11

___
Python tracker 
<https://bugs.python.org/issue46248>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46248] Compilation errors on macOS

2022-01-04 Thread Sandip Shah


Sandip Shah  added the comment:

Hi,

Like I mentioned in the ticket, I am trying to compile libplist,
libimobiledevice , and libimobiledevice-glue-1.0 on my mac.  These are
needed to do any development on a mobile device (specifically for testing /
automation).  I use Python for a lot of developmental work, and hence would
rather stick to the same framework to work on mobile devices too.

https://github.com/libimobiledevice

The project is not to "embed" Python, but to link to it, so that it can be
used for testing the app on the mobile (the tools rely on Cython).

The three tools have their own "autogen.sh" which fails with the error
mentioned in the ticket.

While researching, I had found this solution on stackexchange -
https://stackoverflow.com/questions/6490513/vim-failing-to-compile-with-python-on-os-x

Which led me to this after looking more in the python distribution files:

---
In file
/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/sysconfig.py
On line 410 - fn _generate_posix_vars

439-448
# There's a chicken-and-egg situation on OS X with regards to the
# _sysconfigdata module after the changes introduced by #15298:
# get_config_vars() is called by get_platform() as part of the
# `make pybuilddir.txt` target -- which is a precursor to the
# _sysconfigdata.py module being constructed.  Unfortunately,
# get_config_vars() eventually calls _init_posix(), which attempts
# to import _sysconfigdata, which we won't have built yet.  In order
# for _init_posix() to work, if we're on Darwin, just mock up the
# _sysconfigdata module manually and populate it with the build vars.
# This is more than sufficient for ensuring the subsequent call to
---

Let me know if you need any other information.

Thanks,

Sandip

On Tue, Jan 4, 2022 at 6:30 AM Ronald Oussoren 
wrote:

>
> Ronald Oussoren  added the comment:
>
> Part of the problem here is that most keys in the result of
> sysconfig.get_config_vars() are copied as-is from the CPython Makefile and
> pyconfig.h header file.
>
> The keys copied from the Makefile are in a lot of cases not useful for
> users of python because they contain values that are only useful while
> building CPython itself.
>
> Without knowing your use case it is hard to point you to a better
> solution, but as Ned writes in general just follow the instructions from
> the extending and embedding documentation.
>
> --
>
> ___
> Python tracker 
> <https://bugs.python.org/issue46248>
> ___
>

--

___
Python tracker 
<https://bugs.python.org/issue46248>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com