Issue 38429: Failed to compile with --enable-framework on macOS on master

Created on 2019-10-10 08:47 by Haruka Ma, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (7) msg354348 - (view) Author: Haruka Ma (Haruka Ma) Date: 2019-10-10 08:47
Since commit https://github.com/python/cpython/commit/c02b41b1fb115c87693530ea6a480b2e15460424 , some syntax errors are preventing cpython from compiling with --enable-framework on. 

Specifically, the errors are in Modules/getpath.c on line 1134 and 1165.

I've made some inline comments on github as well.
msg354359 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-10-10 10:11
Oh, I expected that we had macOS buildbots building Python with --enable-framework. Thanks for the reporting the issue.

I wrote PR 16695 which should fix the issue, but I cannot test my fix right now.
msg354361 - (view) Author: Haruka Ma (Haruka Ma) Date: 2019-10-10 10:54
I'm now getting double free on the same function:

https://pastebin.com/zHWCtTuV (with debug on)
msg354367 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-10-10 11:59
Hum, getpath.c seems to use deprecated APIs:

./Modules/getpath.c:1098:20: warning: 'NSModuleForSymbol' is deprecated: first deprecated in macOS 10.5 - dladdr() [-Wdeprecated-declarations]
    pythonModule = NSModuleForSymbol(NSLookupAndBindSymbol("_Py_Initialize"));
                   ^
/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/mach-o/dyld.h:193:21: note: 'NSModuleForSymbol' has been explicitly marked deprecated here
extern NSModule     NSModuleForSymbol(NSSymbol symbol) __API_UNAVAILABLE(ios, tvos, watchos)  __OSX_DEPRECATED(10.1, 10.5, "dladdr()");
                    ^
./Modules/getpath.c:1098:38: warning: 'NSLookupAndBindSymbol' is deprecated: first deprecated in macOS 10.4 - dlsym() [-Wdeprecated-declarations]
    pythonModule = NSModuleForSymbol(NSLookupAndBindSymbol("_Py_Initialize"));
                                     ^
/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/mach-o/dyld.h:183:17: note: 'NSLookupAndBindSymbol' has been explicitly marked deprecated here
extern NSSymbol NSLookupAndBindSymbol(const char* symbolName)                                                    __API_UNAVAILABLE(ios, tvos, watchos)  __OSX_DEPRECATED(10...
                ^
./Modules/getpath.c:1101:27: warning: 'NSLibraryNameForModule' is deprecated: first deprecated in macOS 10.5 [-Wdeprecated-declarations]
    const char* modPath = NSLibraryNameForModule(pythonModule);
                          ^
/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/mach-o/dyld.h:163:21: note: 'NSLibraryNameForModule' has been explicitly marked deprecated here
extern const char*  NSLibraryNameForModule(NSModule m) __API_UNAVAILABLE(ios, tvos, watchos)  __OSX_DEPRECATED(10.1, 10.5, "");
                    ^
3 warnings generated.
msg354370 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-10-10 13:42
New changeset b6e0fc74265db96fdd0e0b8151c768c583ad80f0 by Victor Stinner in branch 'master':
bpo-38353: Fix typos in calculate_argv0_path_framework() (GH-16695)
https://github.com/python/cpython/commit/b6e0fc74265db96fdd0e0b8151c768c583ad80f0
msg354371 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-10-10 13:43
Thanks for the bug report Haruka Ma, it should now be fixed.
msg354377 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2019-10-10 13:59
W.r.t. the deprecated APIs in getpath.c: Issue15498

That issue contains an ancient patch to switch to non-deprecated APIs, but we haven't had time yet to fully test these. The issue also mentions that Apple's install of Python already switched away from the deprecated APIs, but had some issues at the time.
History Date User Action Args 2022-04-11 14:59:21adminsetgithub: 82610 2019-10-10 13:59:51ronaldoussorensetmessages: + msg354377 2019-10-10 13:43:11vstinnersetstatus: open -> closed
resolution: fixed
messages: + msg354371

stage: patch review -> resolved

2019-10-10 13:42:36vstinnersetmessages: + msg354370 2019-10-10 11:59:52vstinnersetmessages: + msg354367 2019-10-10 10:54:58Haruka Masetmessages: + msg354361 2019-10-10 10:11:35vstinnersetmessages: + msg354359 2019-10-10 10:10:48vstinnersetkeywords: + patch
stage: patch review
pull_requests: + pull_request16282 2019-10-10 09:31:05ned.deilysetnosy: + vstinner
2019-10-10 08:47:11Haruka Macreate