Re: compilation issues on Py3.5, os x 10.10.5

Ronald Oussoren <[email protected]> Sun, 07 Aug 2016 13:16:23 +0200
Newsgroups gmane.comp.python.pyobjc.devel
Message-ID <[email protected]>
> On 07 Aug 2016, at 12:54, Ronald Oussoren <[email protected]> wrote:
> 
>> 
>> On 07 Aug 2016, at 11:22, Ronald Oussoren <[email protected] <mailto:[email protected]>> wrote:
>> 
>>> 
>>> On 02 Aug 2016, at 12:13, Diez B. Roggisch <[email protected] <mailto:[email protected]>> wrote:
>>> 
>>> Hi,
>>> 
>>> back at work, I tried your below suggestion.
>>> 
>>> 
>>> It falis with 
>>> 
>>>     running build_ext
>>>     building 'CoreFoundation._inlines' extension
>>>     creating build/temp.macosx-10.6-intel-3.5/Modules
>>>     /usr/bin/clang -fno-strict-aliasing -Wsign-compare -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -arch i386 -arch x86_64 -g -Ibuild/temp.macosx-10.6-intel-3.5/pyobjc-include -I/Library/Frameworks/Python.framework/Versions/3.5/include/python3.5m -c Modules/_CoreFoundation_inlines.m -o build/temp.macosx-10.6-intel-3.5/Modules/_CoreFoundation_inlines.o -DPyObjC_BUILD_RELEASE=1010
>>>     In file included from Modules/_CoreFoundation_inlines.m:2:
>>>     /Library/Frameworks/Python.framework/Versions/3.5/include/python3.5m/Python.h:25:10: fatal error: 'stdio.h' file not found
>>>     #include <stdio.h>
>>>              ^
>>>     1 error generated.
>>>     error: command '/usr/bin/clang' failed with exit status 1
>> 
>> That’s annoying. I don’t understand why the build does not use the SDK inside the Xcode.app package on your machine.
> 
> I might be onto something. Did you install the command-line tools package? I installed both Xcode 7.2 and the command-line tools (using “xcode-select —install”) and that gives me the same error.  The same VM did work properly before I installed the command-line tools.
> 
> I don’t know yet how to work around this problem, the compiler command-lines are the same on both machines. 

The patch below fixes the issue for me. I haven’t checked yet if this does the right thing on any system other than one running Xcode 7.2 with the command tools installed.

--- pyobjc_setup.py.orig	2016-08-07 04:03:55.000000000 -0700
+++ pyobjc_setup.py	2016-08-07 04:13:22.000000000 -0700
@@ -284,6 +284,9 @@
     except (ImportError, NameError):
         pass
 
+
+
+
     cc = oldcc = get_config_var('CC').split()[0]
     cc = _find_executable(cc)
     if cc is not None and os.path.basename(cc).startswith('gcc'):
@@ -377,6 +380,16 @@
     if 'clang' in get_config_var('CC'):
         cflags.append('-Wno-deprecated-declarations')
 
+    CFLAGS = get_config_var('CFLAGS')
+    if '-isysroot' not in CFLAGS and os.path.exists('/usr/include/stdio.h'):
+        # We're likely on a system with de Xcode Command Line Tools.
+        # Explicitly use an SDK
+        data = os.popen('xcodebuild -version -sdk macosx Path').read()
+        data = data.strip()
+        if data:
+            cflags.append('-isysroot')
+            cflags.append(data)
+
     #if os_level != '10.4':
     #    if os.path.exists('/usr/include/stdio.h'):
     #        # only tweak the SDK when using the command-line tools

> 
> Ronald
> 
> 
>> 
>> Ronald
>> 
>>> 
>>> Cheers,
>>> 
>>> Diez
>>> 
>>>> On 30 Jul 2016, at 10:01, Ronald Oussoren <[email protected] <mailto:[email protected]>> wrote:
>>>> 
>>>>> 
>>>>> On 30 Jul 2016, at 09:44, Ronald Oussoren <[email protected] <mailto:[email protected]>> wrote:
>>>>> 
>>>>>> 
>>>>>> On 28 Jul 2016, at 15:43, Diez B. Roggisch <[email protected] <mailto:[email protected]>> wrote:
>>>>>> 
>>>>>> Hi,
>>>>>> 
>>>>>> I get the problem quoted below after trying to install pyobjc on my 10.10.5 System, Xcode version 7.2 into a vanilla Python3.5
>>>>>> 
>>>>>> Googling resulted in http://stackoverflow.com/questions/37525929/python-pyobjc-idtopythonprotocolnsurlsessionstreamdelegate-error <http://stackoverflow.com/questions/37525929/python-pyobjc-idtopythonprotocolnsurlsessionstreamdelegate-error>, which again on a vanilla Python 3.5 succeeds installing, but gives the second error below.
>>>>>> 
>>>>>> Any suggestions are welcome.
>>>>> 
>>>>> For some reason PyObjC thinks it is building with the OSX 10.10 SDK, while it is building with an older SDK. Because of this it tries to reference a symbol that isn’t present in the SDK that is used.   The “-isysroot /“ flag in the output below explains the behavior, setup.py cannot deduce the SDK used from the sysroot parameter and therefore assumes the SDK version matches the OSX version.
>>>> 
>>>> I just noticed some old code in the setup.py files for PyObjC that could cause this error. I’ll be testing on older OSX releases once I finish my work on 10.12 support and will try to remove or fix that old code when I do so.
>>>> 
>>>> Could you check if you have a file named “/usr/include/stdio.h” on your system? If so, please try building without this file (basically: move or rename it, then build PyObjC, then restore the file). 
>>>> 
>>>> Ronald
>>> 
>>> ------------------------------------------------------------------------------
>>> _______________________________________________
>>> Pyobjc-dev mailing list
>>> [email protected] <mailto:[email protected]>
>>> https://lists.sourceforge.net/lists/listinfo/pyobjc-dev <https://lists.sourceforge.net/lists/listinfo/pyobjc-dev>
>> 
>> ------------------------------------------------------------------------------
>> _______________________________________________
>> Pyobjc-dev mailing list
>> [email protected] <mailto:[email protected]>
>> https://lists.sourceforge.net/lists/listinfo/pyobjc-dev <https://lists.sourceforge.net/lists/listinfo/pyobjc-dev>
> ------------------------------------------------------------------------------
> _______________________________________________
> Pyobjc-dev mailing list
> [email protected] <mailto:[email protected]>
> https://lists.sourceforge.net/lists/listinfo/pyobjc-dev <https://lists.sourceforge.net/lists/listinfo/pyobjc-dev>

------------------------------------------------------------------------------

_______________________________________________
Pyobjc-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pyobjc-dev