After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 766337 - Please update the OS version to SDK version mapping in jhbuildrc-gtk-osx-custom-example
Please update the OS version to SDK version mapping in jhbuildrc-gtk-osx-cust...
Status: RESOLVED FIXED
Product: gtk-osx
Classification: Other
Component: General
unspecified
Other Linux
: Normal normal
: ---
Assigned To: GTK Mac Integration Maintainers
GTK Mac Integration Maintainers
Depends on:
Blocks:
 
 
Reported: 2016-05-12 16:59 UTC by Rafal Luzynski
Modified: 2016-05-13 15:21 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Rafal Luzynski 2016-05-12 16:59:39 UTC
GTK will not build on OS X using the documentation: https://wiki.gnome.org/Projects/GTK+/OSX/Building which says to run gtk-osx-build-setup.sh script which prepares all. Instead you need to fix .jhbuilrc-custom manually. .jhbuildrc-custom by default will be a plain copy of gtk-osx/jhbuildrc-gtk-osx-custom-example made by gtk-osx-build-setup.sh. The reason why it will not work is that OS version is mapped to the required SDK version incorrectly.

A similar change was made in this commit: https://git.gnome.org/browse/gtk-osx/commit/?id=c512eebe9074ffea4fe8f1fd5d5da5c6089a0f54 but note that even that was incorrect. Here is what it does:

if _osx_version >= 9.0:
    _target = "10.7"
elif _osx_version >= 8.0:
    _target = "10.7"
elif _osx_version >= 7.0:
    _target = "10.7"
elif _osx_version >= 6.0:
    _target = "10.6"

_osx_version is the first part of `uname -r` result minus 4; in my case `uname -r` prints 14.1.0 so _osx_version = 14 - 4 = 10.

Even in the older systems it is incorrect because it should not repeat "10.7" three times but use the correct target SDK version "10.9" for _osx_version >= 9.0 and "10.8" for _osx_version >= 8.0. Also should start with the newer OS versions: _osx_version >= 10.0 requires _target = "10.10" and so on. I have also tested this on the Darwin version 12.5.0 which required SDK="10.8".

Is it safe to assume that _osx_version x.y (Darwin x+4.mm.nn) will always require SDK _target = "10.x"? It would solve the problem once and forever. Otherwise please update the script to support at least already released OS versions: let _osx_version >= 11.0 require _target "10.11", _osx_version >= 10.0 _target "10.10" and so on.
Comment 1 John Ralls 2016-05-12 17:36:43 UTC
Thanks for noticing. I've changed it to _target="10.%d" % _osx_version that will provide the right answer without requiring further maintenance, at least until Apple decides that OS X deserves a major version bump.

It's never safe to assume anything with Apple. That said, the line in question is supposed to set the build for the OS X version the build is running on. 

Up through the 10.10 SDK there were stub libraries in SDK_foo/usr/lib which included version information for the library so that even if -macosx_version_min was set to an earlier version dyld would refuse to run the program on an earlier version because the versions on the actual dylibs in /usr/lib were older than the required version from the stub. That meant that the earliest version of OS X that would run any program was determined by the SDK chosen. In jhbuildrc-gtk-osx-example-custom you'll see some commented-out examples of calling setup_sdk() for earlier SDKs.

With SDK 10.11 and Xcode7 Apple introduced a new linking mechanism that might get around that problem, but I haven't yet tested to see if building with it setting -macosx-version-min=10.7 will produce a binary that will actually run on 10.7.
Comment 2 Rafal Luzynski 2016-05-13 15:21:53 UTC
Thank you, I confirm that this works correctly.