Python problems on OS X
Andrew Butterfield
Andrew.Butterfield at scss.tcd.ie
Wed Nov 18 11:59:02 UTC 2020
Hi Anders,
> On 18 Nov 2020, at 10:13, Anders Montonen <Anders.Montonen at iki.fi> wrote:
>
> It seems you’re running into this issue: https://bugs.python.org/issue3588 <https://bugs.python.org/issue3588>
Thanks for pointing me to this - it inspired the following command-line interaction
```
:- which python
/Library/Frameworks/Python.framework/Versions/2.7/bin/python
rqmts-spec-level
:- /Library/Frameworks/Python.framework/Versions/2.7/bin/python
Python 2.7.18 (v2.7.18:8d21aa21f2, Apr 19 2020, 20:48:48)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import distutils.sysconfig
>>> print(distutils.sysconfig.get_config_var('LINKFORSHARED'))
-u _PyMac_Error Python.framework/Versions/2.7/Python
>>> print(distutils.sysconfig.get_config_var('PYTHONFRAMEWORKDIR'))
Python.framework
>>> print(distutils.sysconfig.get_config_var('PYTHONFRAMEWORKPREFIX'))
/Library/Frameworks
>>> quit()
:- which python3
/Library/Frameworks/Python.framework/Versions/3.8/bin/python3
rqmts-spec-level
:- /Library/Frameworks/Python.framework/Versions/3.8/bin/python3
Python 3.8.6 (v3.8.6:db455296be, Sep 23 2020, 13:31:39)
[Clang 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import distutils.sysconfig
>>> print(distutils.sysconfig.get_config_var('PYTHONFRAMEWORKDIR'))
Python.framework
>>> print(distutils.sysconfig.get_config_var('LINKFORSHARED'))
-Wl,-stack_size,1000000 -framework CoreFoundation Python.framework/Versions/3.8/Python
>>> print(distutils.sysconfig.get_config_var('PYTHONFRAMEWORKPREFIX'))
/Library/Frameworks
>>> quit()
```
The issue does seem that LINKFORSHARED is mis-configured for 2.7, but looks Ok for 3.8
> GDB uses this script to duplicate the functionality of python-config: https://sourceware.org/git/?p=binutils-gdb.git;a=blob;f=gdb/python/python-config.py <https://sourceware.org/git/?p=binutils-gdb.git;a=blob;f=gdb/python/python-config.py>
> It was patched upstream (in 2013!) to deal with this: https://hg.python.org/cpython/rev/bab708624dc4/ <https://hg.python.org/cpython/rev/bab708624dc4/> (current version:
This patch leads to the following:
```
:- /Library/Frameworks/Python.framework/Versions/2.7/bin/python
Python 2.7.18 (v2.7.18:8d21aa21f2, Apr 19 2020, 20:48:48)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import distutils.sysconfig
>>> print(distutils.sysconfig.get_config_var('PYTHONFRAMEWORK'))
Python
>>> print(distutils.sysconfig.get_config_var('Py_ENABLE_SHARED'))
0
>>> print(distutils.sysconfig.get_config_var('LIBPL'))
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/config
```
I got this all to work on this machine when it was OS X Mojave, and then broke it when some tool I installed with `brew`
decided it needed its own version of python2.7
Upgrading to Catalina did not fix this, but I know that people have built RTEMS on Catalina.
Perhaps I should try to re-install 2.7 from Python.org <http://python.org/> ?
> https://hg.python.org/cpython/file/2.7/Misc/python-config.in <https://hg.python.org/cpython/file/2.7/Misc/python-config.in>)
>
> Regards,
> Anders Montonen
--------------------------------------------------------------------
Andrew Butterfield Tel: +353-1-896-2517 Fax: +353-1-677-2204
Lero at TCD, Head of Software Foundations & Verification Research Group
School of Computer Science and Statistics,
Room G.39, O'Reilly Institute, Trinity College, University of Dublin
http://www.scss.tcd.ie/Andrew.Butterfield/
--------------------------------------------------------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/users/attachments/20201118/963bad7b/attachment-0001.html>
More information about the users
mailing list