Difference between revisions of "CrossCompilingOsX"
m (fix a problem with --enable-targets) |
|||
Line 61: | Line 61: | ||
svn co http://llvm.org/svn/llvm-project/cfe/trunk clang | svn co http://llvm.org/svn/llvm-project/cfe/trunk clang | ||
cd ..; mkdir build; cd build | cd ..; mkdir build; cd build | ||
../configure --prefix=/usr/clang_3_4 --enable-optimized --enable-targets='''x86_64 | ../configure --prefix=/usr/clang_3_4 --enable-optimized --enable-targets='''x86_64,x86''' \ | ||
--disable-compiler-version-checks --host=x86_64-unknown-linux-gnu --build=x86_64-unknown-linux-gnu \ | --disable-compiler-version-checks --host=x86_64-unknown-linux-gnu --build=x86_64-unknown-linux-gnu \ | ||
--target='''x86_64-apple-darwin11.4.2''' | --target='''x86_64-apple-darwin11.4.2''' |
Revision as of 15:53, 4 June 2014
This is being worked on, please maintain your patience. I have successfully done this before but I don't remember what I did, so I will have to recreate a lot of stuff.
You need:
- a mind so deadset on cross-compiling you won't stop to think
- the Xcode .dmg for your target OS X version
- root access to your build system
- a good processor and a lot of RAM
I used Ubuntu 14.04 "Trusty Tahr" for doing the initial chroot. The process was as follows:
apt-get install dchroot debootstrap
Then edit /etc/schroot/schroot.conf with your favourite text editor, and add this at the end:
[trusty] description=Ubuntu Trusty location=/var/chroot priority=3 users=your_username groups=sbuild root-groups=root
Install a base system:
sudo debootstrap --variant=buildd --arch amd64 trusty /var/chroot/ mirror.url.com/ubuntu/
where mirror.url.com/ubuntu/ can be any of these mirrors.
Now copy your resolv.conf for internet access (required):
sudo cp /etc/resolv.conf /var/chroot/etc/resolv.conf
Bind your procfs into the chroot for gnustep:
sudo mount -o bind /proc /var/chroot/proc
Finally, chroot into your target:
sudo chroot /var/chroot
You should now have a working chroot, free for you to destroy as you see fit. (from https://help.ubuntu.com/community/BasicChroot)
To avoid pointless warnings about missing locales, do this:
apt-get install language-pack-en
Install some packages to start off with:
apt-get install sudo nano vim bzr subversion
Edit your /etc/apt/sources.list to include the universe source and update:
deb mirror.url.com/ubuntu/ trusty main deb-src mirror.url.com/ubuntu/ trusty main deb mirror.url.com/ubuntu/ trusty universe deb-src mirror.url.com/ubuntu/ trusty universe
Now install gnustep:
apt-get install gnustep gnustep-devel
This may take a while.
Next, we're going to build clang, llvm, and libc++ that target OS X.
cd /usr/src svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm cd llvm/tools svn co http://llvm.org/svn/llvm-project/cfe/trunk clang cd ..; mkdir build; cd build ../configure --prefix=/usr/clang_3_4 --enable-optimized --enable-targets=x86_64,x86 \ --disable-compiler-version-checks --host=x86_64-unknown-linux-gnu --build=x86_64-unknown-linux-gnu \ --target=x86_64-apple-darwin11.4.2 make -j4 make install
Next step: APSL headers for OSX, from Xcode, and then add libc++ compile instructions
More coming...