Tk Source Code

View Ticket
Login
Ticket UUID: 1d37c3e16616a0e6283ef390272f0cf483b74b5
Title: Cocoa Tk built for OS X 10.10 fails with "Mac OS X 10.10000 or later required "
Type: Bug Version: 8.6.2
Submitter: ned.deily Created on: 2014-10-20 00:18:06
Subsystem: 83. Mac OS X Build Assigned To: kevin_walzer
Priority: 5 Medium Severity: Critical
Status: Closed Last Modified: 2014-10-22 10:05:47
Resolution: Fixed Closed By: kevin_walzer
    Closed on: 2014-10-22 10:05:47
Description: (text/x-fossil-wiki)
When built on OS X 10.10 (Yosemite) or with a MACOSX_DEPLOYMENT_TARGET of 10.10, Cocoa Tk aborts during initialization due to a faulty version check.  Because the minor version number (the y of x.y.z) has now reached two digits for 10.10.x, Apple has had to incompatibility change the version numbering scheme used in its AvailabilityMacros.h which are used by Cocoa Tk.

The following test program which duplicates the relevant code from macosx/tkMacOSXInit.c illustrates the problem:

<verbatim>
#include <stdio.h>
#include <stdlib.h>
#include <sys/utsname.h>
#include <AvailabilityMacros.h>

int main() { 
    struct utsname name;
    long tkMacOSXMacOSXVersion = 0;

    uname(&name);
    printf("uname release = %s\n", name.release);
    printf("MAC_OS_X_VERSION_MIN_REQUIRED = %i\n", MAC_OS_X_VERSION_MIN_REQUIRED);
    tkMacOSXMacOSXVersion = (strtod(name.release, NULL) + 96) * 10;
	printf("tkMacOSXMacOSXVersion = %li\n", tkMacOSXMacOSXVersion);
	return 0;
}
</verbatim >

On OS X 10.8.5, the results are:

<verbatim >
uname release = 12.5.0
MAC_OS_X_VERSION_MIN_REQUIRED = 1080
tkMacOSXMacOSXVersion = 1085
</verbatim >

But on OS X 10.10, the results are:

<verbatim >
uname release = 14.0.0
MAC_OS_X_VERSION_MIN_REQUIRED = 101000
tkMacOSXMacOSXVersion = 1100
</verbatim >

Note the difference in format of MAC_OS_X_VERSION_MIN_REQUIRED.

This causes the test at [https://core.tcl.tk/tk/finfo?name=macosx/tkMacOSXInit.c] line 239 in TkpInit to fail on 10.10 with the resulting abort message referenced in the title.

There are obviously various ways to fix this for 8.6.x and 8.5.x.  It might be best to find out how Apple presumably fixed their copy of 8.5 for the 10.10 release.  As of now, [http://www.opensource.apple.com] has not yet been updated with 10.10 sources.
User Comments: kevin_walzer added on 2014-10-22 10:05:47:
Patch committed that fixes the problem; thanks for the helpful and detailed bug report and diagnosis.