Re: [gtk-osx-users] Gotcha building python 2.6 using setup_sdk 10.6

On Feb 14, 2013, at 2:12 PM, Richard Procter <richard n procter gmail com> wrote:

Hi all, 

I found a gotcha when building python 2.6.8 with the latest gtk-osx build 
scripts yesterday on 10.6[1] when the resultant binary surprised me by 

Python 2.6.1 (r261:67515, Jun 24 2010, 21:47:49) 
[GCC 4.2.1 (Apple Inc. build 5646)] on darwin
Type "help", "copyright", "credits" or "license" for more information.

The only thing I had changed from the stock script was: 

setup_sdk(target="10.6", sdk_version="10.6", architectures=["i386"])

(setting _gtk_osx_use_jhbuild_python = True had no effect).

Looking at .jhbuildrc, a non-native setup_sdk sets a bunch of compiler flags, 
one being:

environ_prepend("LDFLAGS", "-L" + "/Developer/SDKs/MacOSX10.6.sdk" + "/usr/lib")

, which when added to the stock .jhbuildrc-custom is sufficient to cause the problem. 

Digging deeper, yes, this causes the python binary to reference the 10.6 SDK python library.[2] 

I suspect this is ultimately an issue with python's build system giving LDFLAGS too 
high priority. My workaround is to build python 2.7 instead, which doesn't exist on 10.6.


$ <fresh checkout of gtk-osx> 
$ jhbuild build python 

without LDFLAGS: 
$ otool -L `which python` 
      /Users/rix/work/doview/development/osx/gtk-osx/test/gtk/inst/lib/libpython2.6.dylib (compatibility 
version 2.6.0, current version 2.6.0) <-- OK
      /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.2.11)
      /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 
150.0.0, current version 550.44.0)

with LDFLAGS: 
$ otool -L `which python`
      /System/Library/Frameworks/Python.framework/Versions/2.6/Python (compatibility version 2.6.0, current 
version 2.6.1) <--- System SDK!
      /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.2.0)
      /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 
150.0.0, current version 550.44.0)

Interesting. I haven't built python 2.6 in a long time; I either hadn't noticed or had forgotten. Python's 
build scripts are badly prescriptive: They handle well the use cases the Python developers have in mind and 
to heck with anyone who wants something different.

Then again, from a Python standpoint one should either use the latest 2.7 (because it's more or less 
compatible with Python3) or a recent 3.x.  So unless someone objects soon, I'll remove all Pythons earlier 
than 2.7.3 from the modulesets.

John Ralls

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]