(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); ^~~~~~~ vvfabf
The code says:
#if (defined(MACOSX_DEPLOYMENT_TARGET) && MACOSX_DEPLOYMENT_TARGET <= 1070 && MAC_OS_X_VERSION_MIN_REQUIRED <= 1070) vvfabf(tmp, dst, &count); #else vvfabsf(tmp, dst, &count); #endif
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
MAC_OS_X_VERSION_MIN_REQUIRED will have the value 1060.
For this reason Ken's suggested change is correct: the code should be:
#if (defined(MAC_OS_X_VERSION_MIN_REQUIRED) && MAC_OS_X_VERSION_MIN_REQUIRED < 1070) vvfabf(tmp, dst, &count); #else vvfabsf(tmp, dst, &count); #endif
Reopening; this breaks the iOS build (
make -f Makefile.ios).
MAC_OS_X_VERSION_MIN_REQUIREDis defined when building for iOS, with a value of 1050. But
vvfabfis not available on iOS (never has been, I think) and we should be using
vvfabsfthere. A test that also eliminates iOS is required!