wiki:LeopardSDKFixes

Version 4 (modified by potmj (Michael Pot), 8 years ago) (diff)

I am trying to get this wiki to work for me, but my Xcode 3.2 on a SL machine has exactly the same libgcc_s.10.5.dylib as the Leopard 3.1 Xcode! The information needs to include better details of the required libgcc and what exact systems might have it, or where it can be obtained from (or patch file). These changes are intended to help more novice users proceed with maintaining their installed macports ports and dependencies with the updates. I have just upgraded the SL machine to Lion & installed the oldest Xcode for it (4.1), but I still can't find the required libgcc_s10.5.dylib - I don't know which newer version this wiki is referring to or where to find it. Do I need to do something special in Xcode 4.1 to populate it?

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 from (33620 19 Feb 2008 - Xcode 3.1), to a newer version from a newer OS [Xcode? version?] (to get the missing stubs for __udivti3 and others):

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;
}

Save to a file - e.g. ctest.cpp and compile with an active version of macports clang & llvm

someuser% sudo port select --set clang mp-clang-3.4
Selecting 'mp-clang-3.4' for 'clang' succeeded. 'mp-clang-3.4' is now active.
someuser% clang --version
clang version 3.4.2 (tags/RELEASE_34/dot2-final)
Target: i386-apple-darwin9.8.0
Thread model: posix
someuser% clang ctest.cpp
ctest.cpp:2:4: error: unknown type name '__uint128_t'
   __uint128_t a = 100;

So this is a fail at the moment

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.orig    2015-01-11 17:31:10.000000000 -0800
+++ /usr/include/AvailabilityInternal.h 2015-01-05 04:15:01.000000000 -0800
@@ -60,7 +60,7 @@
     #define __MAC_OS_X_VERSION_MIN_REQUIRED __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__
     // make sure a default max version is set
     #ifndef __MAC_OS_X_VERSION_MAX_ALLOWED
-        #define __MAC_OS_X_VERSION_MAX_ALLOWED __MAC_10_6
+        #define __MAC_OS_X_VERSION_MAX_ALLOWED 1058
     #endif
 
     // 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.