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

"Diez B. Roggisch" <[email protected]> Mon, 8 Aug 2016 11:06:15 +0200
Newsgroups gmane.comp.python.pyobjc.devel
Message-ID <[email protected]>
Hi Ronald,


>> 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. 


I did install commandline tools, as a large part of daily development comprises C++ work.

I will try & use your patch, and give feedback on the results soon.

Cheers,

Diez



> 
> 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] <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