python / cpython

The Python programming language
https://www.python.org/
Other
59.7k stars 28.93k forks source link

OSX Python cannot run in console #35258

Closed c620fbdd-afdb-4c9e-a103-6d5c18874e81 closed 22 years ago

c620fbdd-afdb-4c9e-a103-6d5c18874e81 commented 22 years ago
BPO 466907
Nosy @jackjansen

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields: ```python assignee = 'https://github.com/jackjansen' closed_at = created_at = labels = ['OS-mac'] title = 'OSX Python cannot run in console' updated_at = user = 'https://bugs.python.org/schwa' ``` bugs.python.org fields: ```python activity = actor = 'jackjansen' assignee = 'jackjansen' closed = True closed_date = None closer = None components = ['macOS'] creation = creator = 'schwa' dependencies = [] files = [] hgrepos = [] issue_num = 466907 keywords = [] message_count = 5.0 messages = ['6761', '6762', '6763', '6764', '6765'] nosy_count = 2.0 nosy_names = ['jackjansen', 'schwa'] pr_nums = [] priority = 'normal' resolution = None stage = None status = 'closed' superseder = None type = None url = 'https://bugs.python.org/issue466907' versions = ['Python 2.2'] ```

c620fbdd-afdb-4c9e-a103-6d5c18874e81 commented 22 years ago

OS: Mac OS X 10.1 HW: Verified on G4/733 & PowerBook G4/400Version: 'Unix' Python 2.2a4 (also seen on 2.2a3) Configured: --with-suffix=.exe --without-toolbox-glue

Python cannot run on a Mac OS X machine when the user is logged into console mode (using ">console" as login name).

Download .tar.gz, configure python as shown, make, make install. Log out of Mac OS X. Log in as console user: use ">console" as login name. Run python interactively from the shell...

Python will fail to run and emit these errors:

KCGErrorFailure: CGSNewConnection cannot connect to server KCGErrorFailure: CGSNewConnection cannot connect to server KCGErrorInvalidConnection: CGSGetEventPort: Invalid connection

I believe Python is trying to connect to the CoreGraphics server. Why? I don't know (esp. as I've NOT compiled the toolbox glue). Perhaps Python is linking to a Carbon library and the library is automatically trying to open a connection. My makefile skills are not good enough to enable me to check.

Python compiled on OS X without the toolbox glue should essentially be identical to any other 'unix' app compiled for Mac OS X. Doesn't seem to be that way.

c620fbdd-afdb-4c9e-a103-6d5c18874e81 commented 22 years ago

Logged In: YES user_id=29309

FYI. Running 'otool -l' on the Python executable shows that it is being linked to both:

/System/Library/Frameworks/Carbon.framework

and

/System/Library/Frameworks/Foundation.framework Carbon.framework links in /System/Library/Frameworks/ApplicationServices.framework/ which contains the CoreGraphics framework. I'm assuming that causes CoreGraphics to be initialized (guessing).

Why does a plain 'unix' build of Python link to both Carbon and Foundation?

c620fbdd-afdb-4c9e-a103-6d5c18874e81 commented 22 years ago

Logged In: YES user_id=29309

OK... Another Follow Up.

Checked the configure.in file and there is no --without-toolbox-glue switch for configure. There is a --disable-toolbox-glue and --enable-toolbox-glue. The line in the README that states you should use --without-toolbox-glue is incorrect. This is a bug in the documentation! (easy to fix though). I've checked the newly built executable (using --disable-toolbox-glue) with 'otool -l' and the linkage dependencies are gone. This is good.

Unfortunately when the 'make install' stage of the build fails with:

skipping 'gestalt' extension (up-to-date) dyld: ./python.exe Undefined symbols: _Gestalt _PyMac_Error make: *** [sharedmods] Error 67

jackjansen commented 22 years ago

Logged In: YES user_id=45365

Just a quick update so people know I haven't forgotten this bug. It turns out that Apple changed the Carbon.framework initialization: it used to be lazy, initializing carbon portions as needed, but since 10.1 a lot more is initialized up front, and therefore the window server is contacted.

Therefore, as of 10.1, if you are not a windowing program you cannot link against Carbon.framework anymore but must link against some of the subordinate frameworks. This was always true theoretically (it seems), but now it has suddenly become practically true as well.

But: it seems more people are bitten by this, so Apple suggested they may revert on this decision. And on the other hand I'm going to have a look at not linking with Carbon.framework but with CoreServices and/or ApplicationServices in stead.

jackjansen commented 22 years ago

Logged In: YES user_id=45365

A fix has been checked in to the repository for this. The Python core library now links against CoreServices in stead of Carbon. This should fix four related problems:

I haven't been able to verify that all these cases are now okay, but I'm 99% sure. Please reopen the bug if there are still problems.