Hi All,
For those of you who are still trying to support older OS X releases, you might like to know that I’ve investigated this further. The good news is that Xcode 6 still works with the older plugin formats, build tool configuration files etc. so follow the same approach with Xcode 6 as I indicated with Xcode 5 previously http://lists.apple.com/archives/darwin-kernel/2014/May/msg00017.html My environment now incudes Xcode 6.1.1 on top of 5.0.3, 4.6.2, and 3.2.6, and I can build on all SDKs and platforms from OS X 10.4
[Qweeg:MacOSX.platform/Developer/SDKs] chrisc% pwd /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs [Qweeg:MacOSX.platform/Developer/SDKs] chrisc% ls -l total 40 drwxr-xr-x@ 5 chrisc 170 Oct 3 06:16 MacOSX10.10.sdk/ lrwxr-xr-x 1 root 33 Dec 21 11:37 MacOSX10.4u.sdk@ -> /Xcode-3_2_6/SDKs/MacOSX10.4u.sdk lrwxr-xr-x 1 root 32 Dec 21 11:37 MacOSX10.5.sdk@ -> /Xcode-3_2_6/SDKs/MacOSX10.5.sdk lrwxr-xr-x 1 root 32 Dec 21 11:37 MacOSX10.6.sdk@ -> /Xcode-3_2_6/SDKs/MacOSX10.6.sdk lrwxr-xr-x 1 root 104 Dec 21 11:37 MacOSX10.7.sdk@ -> /Applications/Xcode-4_6_2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk lrwxr-xr-x 1 root 104 Dec 21 11:37 MacOSX10.8.sdk@ -> /Applications/Xcode-5_0_2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk drwxr-xr-x@ 5 chrisc 170 Aug 27 04:20 MacOSX10.9.sdk/
There is one major new gotcha. It seems that Apple has removed the deprecated map_fd() system call from OS X 10.10.1 (and probably 10.10.0 but I have not tested it) and so /Xcode-3_2_6/usr/bin/ld_classic, the 32 bit old linker, crashes when you attempt to use it to link a 10.4/10.5 compatible kernel extension. I managed to work around this by downloading the Xcode 3.1.4 cc-tools source from http://www.opensource.apple.com/release/developer-tools-314/ and hacking the environment and makefiles enough to be able to build ld.NEW under OS X 10.6.8, 32 bit mode and Xcode 3.2.6. (Virtual machines are a wonderful thing!)
Once I was able to build the ld_build target in cctools-698.1/ld/Makefile, I modified ld.c and pass1.c replacing the map_fd() calls with mmap (…PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_FILE..,). This successfully links a 10.4 compatible kernel extension under OS X 10.10 using Xcode 6/5/4/3 together.
Here’s my primitive script that sets up enough of the environment to build these things properly:. Some of this stuff may be redundant. I was going for quick & dirty! #!/bin/csh # Using OS X 10.6, 32 bit mode, Xcode 3.2.6 build tools setenv RC_ARCHS i386 setenv RC_CFLAGS "-arch i386" setenv LTO setenv RC_OS macos setenv BUILD_DYLIBS YES setenv TRIE setenv RC_MAJOR_RELEASE_TRAIN Leopard setenv EFITOOLS setenv SDK_ROOT /Developer/SDKs/MacOSX10.6.sdk/ cd cctools-698.1/libstuff make cd ../.. cd cctools-698.1/libmacho make cd ../.. cd cctools-698.1/ld make ld_build cd ../.. cp cctools-698.1/ld/ld_dir/ld.NEW ld_classic ls -l ld_classic
As you can see, I’ve disabled building major components (LTO has something to do with llvm for example) so if you need more of the fully functional ld_classic, you’ll have to go further than me. Some of what I did may not have been necessary (32 bit mode environment, additional makefile hacking in the ld and libstuff directories for force 32 bit Intel architecture) but as I said, I just needed something quick & dirty at this stage to build the kernel extension.
Incidentally, it seems that Apple still require ld_classic for iPhone development: [Qweeg:MacOSX.platform/Developer/SDKs] chrisc% find /Applications -name ld_classic -print /Applications/Xcode-4_6_2.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ld_classic /Applications/Xcode-5_0_2.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ld_classic /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ld_classic [Qweeg:MacOSX.platform/Developer/SDKs] chrisc% so I consider the failure of all these versions of ld_classic to work (just like the original) to be a bug. I have filed Apple Bug report #19360409: “ld_classic generates SIGTRAP under OS X 10.10.1 because map_fd() has been removed”
|