Install gcc

From AwkwardTV
Revision as of 09:08, 8 December 2008 by Fcorthay (talk | contribs) (Install the binaries)
Jump to: navigation, search

Installing gcc is simple: you just need to have a working gcc and compile the sources...

Prerequisites

A compiled version of gcc is provided by SourceForge's High Performance Scientific Computation on Mac OS X project.

We'll also need some binaries from an Intel Mac with Tiger and Xcode tools install.

Prepare the install

The files will be installed in /usr/local/. In order not to take too much space in the smaller OSBoot partition, we'll have this directory on the Media partition.

Log into the AppleTV as root and create the directory:

mkdir /mnt/Scratch/local

If you already have a /usr/local/ directory, move it:

cp -R /usr/local/* /mnt/Scratch/local/
rm -R /usr/local

Now make a link to it:

ln -s /mnt/Scratch/local /usr/local

Install the binaries

Navigate to the directory where you downloaded gcc-intel-bin.tar.gz and uncompress it:

tar -xvzpf gcc-intel-bin.tar.gz -C /

Make a link to gcc:

ln -s /usr/local/bin/gcc /usr/bin/cc

Test it:

cc -v

From an Intel Mac with Tiger with Xcode tools installed, copy to the following files to AppleTV:

/usr/bin/as
/usr/bin/ld
/usr/bin/make
/usr/lib/bundle1.o
/usr/lib/crt1.o
/usr/lib/gcrt1.o
/usr/libexec/gcc/darwin/i386/as

From the same Mac, copy the directory /usr/include to the AppleTV's /usr/local/include.

Optional files to copy:

/usr/bin/ar
/usr/bin/libtool
/usr/bin/uniq

And:

ln -s /usr/bin/libtool /usr/bin/ranlib

Test a first compilation:

echo 'int main () { return 0; }' > /tmp/test.c
cc /tmp/test.c