New submission from Dmitrii Pasechnik <dimp...@gmail.com>:

Neither Xcode nor its command-line tools on macOS 10.14 Mojave come with header 
files installed in /usr/ and other "normal" directories.

This is not documented in https://devguide.python.org/setup/#macos-and-os-x

While an extra step to handle this, i.e. to install the headers, is available 
(see a discussion on https://bugs.python.org/issue34956), Apple stated that 
this workaround will disappear.

It is thus highly desirable to provide a way to deal with headers located not 
at /usr/include, but at `xcrun --show-sdk-path`/usr/include.
A small change in setup.py along the lines of the following:

--- a/setup.py
+++ b/setup.py
@@ -134,7 +134,8 @@ def macosx_sdk_root():
     cflags = sysconfig.get_config_var('CFLAGS')
     m = re.search(r'-isysroot\s+(\S+)', cflags)
     if m is None:
-        sysroot = '/'
+        import subprocess
+        sysroot = subprocess.check_output(["xcrun", 
"--show-sdk-path"]).decode("utf-8").strip('\n')
     else:
         sysroot = m.group(1)
     return sysroot
@@ -146,6 +147,7 @@ def is_macosx_sdk_path(path):
     """
     return ( (path.startswith('/usr/') and not path.startswith('/usr/local'))
                 or path.startswith('/System/')
+                or path.startswith('/Applications/')
                 or path.startswith('/Library/') )

with the necessary changes to enable various modules (see attachment for a 
complete POC diff against the current master), the result builds and passes all 
the (enabled) tests on an OSX 10.13 system with empty /usr/include and 
/usr/local/include containing only LZMA headers.

Needless to say, a proper patch would not modify Modules/Setup, it'd adjust 
configure.ac etc.

----------
components: macOS
files: noincludedirs_OSX.patch
keywords: patch
messages: 337461
nosy: dimpase, ned.deily, ronaldoussoren
priority: normal
severity: normal
status: open
title: no "proper" header files on macOS 10.14 Mojave
type: compile error
versions: Python 3.8
Added file: https://bugs.python.org/file48192/noincludedirs_OSX.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue36231>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to