Failure to build on macOS 10.6

(Formerly Bitbucket issue 23, filed by Ken Cunningham with further notes from Ryan Schmidt)

Building Rubber Band using the default Makefile.osx fails on OS/X 10.6:

src/system/VectorOps.h:683:5: error: use of undeclared identifier 'vvfabsf'; did you mean 'vvfabf'?
    vvfabsf(tmp, dst, &count);

Ryan writes:

The code says:

    vvfabf(tmp, dst, &count);
    vvfabsf(tmp, dst, &count);

The intention of this code appears to have been to use vvfabf on 10.6 and earlier and vvfabsf on 10.7 and later [...] but that's not what the code actually does.

First of all, the condition should have been less than, not less than or equal to. But more importantly, the code bases its decision on the preprocessor define MACOSX_DEPLOYMENT_TARGET. This doesn't work because no such define exists. MACOSX_DEPLOYMENT_TARGET is not a preprocessor define but rather an environment variable which the user can set to indicate the minimum major macOS version on which the compiled software should run. If unspecified, the default (on Mac OS X 10.5 and later, which is probably as old as we care about) is for the deployment target to be equal to the major OS version on which the compile is taking place. The preprocessor define MAC_OS_X_VERSION_MIN_REQUIRED will be set to a value computed based on the MACOSX_DEPLOYMENT_TARGET environment variable (or the default, if it's not set).

For example, if I'm compiling on 10.6 without setting the MACOSX_DEPLOYMENT_TARGET environment variable, then MAC_OS_X_VERSION_MIN_REQUIRED will have the value 1060. Or if I'm compiling on any OS version 10.6 or later and set MACOSX_DEPLOYMENT_TARGET=10.6, then MAC_OS_X_VERSION_MIN_REQUIRED will have the value 1060.

For this reason Ken's suggested change is correct: the code should be:

    vvfabf(tmp, dst, &count);
    vvfabsf(tmp, dst, &count);
Assigned to
8 months ago
8 months ago
No labels applied.

~breakfastquay referenced this from #2 8 months ago

~breakfastquay REPORTED FIXED 8 months ago

Fixed in commit:0e5a0e58afd6

~breakfastquay FIXED REPORTED 8 months ago*

Reopening; this breaks the iOS build (make -f Makefile.ios).

It appears MAC_OS_X_VERSION_MIN_REQUIRED is defined when building for iOS, with a value of 1050. But vvfabf is not available on iOS (never has been, I think) and we should be using vvfabsf there. A test that also eliminates iOS is required!

~breakfastquay REPORTED FIXED 8 months ago

Fixed again in commit:7c6da77444c7 with a separate check for TARGET_OS_IPHONE.