wiki:LeopardSDKFixes

Version 8 (modified by Ionic (Mihai Moldovan), 8 years ago) (diff)

Add (theoretical) syntax highlighting to code blocks.

Leopard SDK Fixes

Leopard's SDK has a couple bugs which were never fixed in an update of Xcode or the OS. While some ports used to work around these bugs in the past, Leopard is past EndOfLife and encountering code that does not work around these issues is common. You should make these changes to the relevant files in both / and /Developer/SDKs/MacOSX10.5.sdk

Missing symbols in /usr/lib/libgcc_s.10.5.dylib

Update /usr/lib/libgcc_s.10.5.dylib to a newer version by copying it from a newer OS or SDK (to get the missing stubs for __udivti3 and others). Note that the file is installed to /usr/lib as part of the Xcode Command Line Tools on newer OS versions, but you can also copy it out of an SDK. For example, with Xcode 4.1, you might find it at:

% find /Developer -iname "libgcc_s.10.5*" -exec ls -al {} \;
wheel  40600 19 May  2009 /Developer/SDKs/MacOSX10.6.sdk/usr/lib/libgcc_s.10.5.dylib
wheel  30924 14 Jun  2011 /Developer/SDKs/MacOSX10.7.sdk/usr/lib/libgcc_s.10.5.dylib

After locating and verifying the file status, back up and copy the files:

sudo cp -pv /usr/lib/libgcc_s.10.5.dylib{,.bak}
sudo scp -pv <snow leopard or newer machine>:/usr/lib/libgcc_s.10.5.dylib /usr/lib/libgcc_s.10.5.dylib

Do this for / and use similar commands for /Developer/SDKs/MacOSX10.5.sdk/.

You will know that this worked successfully if you can compile this with clang-mp-3.4:

int main() {
   __uint128_t a = 100;
   __uint128_t b = 200;
   __uint128_t c = a / b;

  return 0;
}

Example:

clang-mp-3.4 -arch x86_64 -c ctest.cpp

Note: The above code does not build for PPC & i386 archs (as at clang-3.4 @3.4.2_9)

Incorrect __MAC_OS_X_VERSION_MAX_ALLOWED

Edit /usr/include/AvailabilityInternal.h, so ports don't try to use API that were added in Snow Leopard:

  • /usr/include/AvailabilityInternal.h

    old new  
    6060    #define __MAC_OS_X_VERSION_MIN_REQUIRED __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__
    6161    // make sure a default max version is set
    6262    #ifndef __MAC_OS_X_VERSION_MAX_ALLOWED
    63         #define __MAC_OS_X_VERSION_MAX_ALLOWED __MAC_10_6
     63        #define __MAC_OS_X_VERSION_MAX_ALLOWED 1058
    6464    #endif
    6565
    6666    // set up internal macros

You may be tempted to use __MAC_10_5 instead of 1058 to match what is done on Snow Leopard and later SDKs, but that will fail with Leopard's default toolchain because it sets the deployment target to the full OS version (eg 10.5.8), and that needs to be less than or equal to __MAC_OS_X_VERSION_MAX_ALLOWED.