Deprecated: Function create_function() is deprecated in /var/www/blog/inc/libs/clearbricks/common/lib.l10n.php on line 640

Deprecated: Function create_function() is deprecated in /var/www/blog/inc/libs/clearbricks/common/lib.http.php on line 249
Creating a MacOS X cross compiler - Grumpycoder
Flux RSS

Creating a MacOS X cross compiler

I am actually quite surprised and happy about it, but I finally managed to create a working MacOS X cross compiler under linux. This was eased a lot by this document here:, but I still had to tweak things in order to make it working properly.

So here are my steps, in case you want to redo this.

First, read the txt file above carefully. It's almost correct, but slightly out of date. First of all, I used the 3.1.4 XCode package from the apple connect site, but his method of extraction is perfectly valid. I also used the 10.4u framework, but I was installing stuff in /usr instead, which means I copied the contents of SDKs/MacOSX10.4u.sdk/usr directory into /usr/i686-apple-darwin9 directory, straight. And I copied the System one into my / directory.

About the distribution; he's right saying there's an odd behavior on a 32 bits system, and he's right saying that compiling the compiler in native 64 bits isn't working properly. So the only dev environment able to do that kind of compilation is actually CentOS x86_64. But the generated binaries were able to run properly in my 32 bits Debian system.

Then about odcctools; his last two patches aren't applying properly. I'm actually having troubles with ld64 anyway, so I'm not bothering. My configure line was:

LDFLAGS="-m32" CFLAGS="-m32"  ./configure --prefix=/usr --target=$TARGET

About GCC, I used this version here: It's a gcc 4.2.1, which is something I needed, but this one also doesn't contain libstdc++, which isn't going to help you if you want to compile C+ + code. The version he's talking about in his code is valid, and libstdc+ + compiles properly - but it's a gcc 4.0.1, which is slightly too old for my usage. So I also had to download this package here:, then I applied all the patches in the patches-4.2.1 folder onto the libstdc+ + folder, and I finally copied the whole thing over the gcc-5646.1's directory.

My gcc compilation line was this:

CFLAGS="-m32" LDFLAGS="-m32" ../gcc-5646.1/configure --prefix=/usr --disable-checking --enable-languages=c,objc,c++,obj-c++ --with-as=/usr/bin/${TARGET}-as --with-ld=/usr/bin/${TARGET}-ld --target=$TARGET --enable-static --enable-shared --disable-nls --disable-multilib

And... that was it! :)

So far my tests are reporting that everything works fine. I'll do more in-depth tests later, in order to fully check the status of the environment, but so far so good.

Also, if you want, here's a package containing the compiled binaries for linux32, which have been compiled from CentOS 5.2, but seem to work under Debian 32 bits as well:

Update: ld64 wasn't viable during compilation, but then the normal ld becomes inviable during its normal usage, since we're having 10.5 libraries. However, CentOS's OpenSSL library is a bit too specific to that platform. And gcc was compiled using ld and not ld64 by default.

All in all, here's a new ld64 binary, that I put in place of the i686-apple-darwin9-ld file, and everything seems to be working perfectly fine now:

Fatal error: Uncaught Error: [] operator not supported for strings in /var/www/blog/inc/core/class.dc.postmedia.php:61 Stack trace: #0 /var/www/blog/inc/core/ dcPostMedia->getPostMedia(Array) #1 /var/www/blog/cache/cbtpl/29/59/2959320ca61719bec433f91e69098e86.php(137): dcMedia->getPostMedia('15', NULL, 'attachment') #2 /var/www/blog/inc/libs/clearbricks/template/class.template.php(268): include('/var/www/blog/c...') #3 /var/www/blog/inc/public/class.dc.template.php(231): template->getData('post.html') #4 /var/www/blog/inc/public/lib.urlhandlers.php(122): dcTemplate->getData('post.html') #5 /var/www/blog/inc/public/lib.urlhandlers.php(523): dcUrlHandlers::serveDocument('post.html') #6 /var/www/blog/inc/libs/clearbricks/url.handler/class.url.handler.php(166): dcUrlHandlers::post('2009/12/03/Crea...') #7 /var/www/blog/inc/public/lib.urlhandlers.php(187): urlHandler->callHandler('post', '2009/12/03/Crea...') #8 /var/www/blog/inc/public/prepend.php(156): dcUrlHandlers->getDocument() #9 /var/www/blog/ind in /var/www/blog/inc/core/class.dc.postmedia.php on line 61