This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

installing gcc into os x instructions


HOW TO INSTALL GCC IN MAC OS X:

(in order to be able to do this you need to download gcc from the gnu gcc site and you already need to have installed apple's gcc that comes with apple's developer tools cd (this is also freely downloadable if you haven't got the cd, from apple's dev site - you need to register with them first though but it's not too painfull))

i did this using:
os x 10.2.2 (i beleive 10.2 maybe the lowest this'll work with but i'm not sure on that)
the july2002 version of dev tools (with the later november2002 update)
gcc-core-3.2.1.tar.gz (i picked core rather than the full one because i'm only interested in c, not any of the other languages)

create a folder somewhere.
put the gcc folder that you've downloaded and uncompressed in that folder just created. this folder, with the uncompressed original files in, will be refered to here from now on as srcdir and that's how it's refered to in other gcc documentation.
create another folder in the same folder that you just created, next to the srcdir folder. this folder will be refered to as objdir. (the folder names you use don't have to be literally objdir and srcdir but they can be)

so you've got two folders - the srcdir folder that has all the downloaded and uncompressed gcc files. and the objdir folder, both of which are in another folder.

open the terminal application

in the terminal type:
limit stack 800
(that results in no response)

then using:
cd foldername
navigate to the empty objdir wherever you put that on your drive. (cd=change directory).

type this (including the ../ and changing 'srcdir' to the name of the srcdir, if you've used a different name):
../srcdir/configure --enable-threads=posix --enable-shared --prefix=/usr/opt/gcc --program-prefix=fsf- --disable-libgcj --enable-version-specific-runtime-libs --enable-languages=c

(skip down to the end of these instructions for a bit about prefix)
(i guess leave off --enable-languages=c if you want all the languages?)

it'll then go through a whole series of checks which'll take a few minutes.

a patch needs to be run before anything else.
create a text file with the following text in it:

*** gcc/ginclude/stddef.h.orig 2002-12-30 13:54:24.000000000 +0100
--- gcc/ginclude/stddef.h 2002-12-30 13:56:49.000000000 +0100
***************
*** 239,244 ****
--- 239,245 ----
#ifndef _WCHAR_T_
#ifndef _BSD_WCHAR_T_
#ifndef _BSD_WCHAR_T_DEFINED_ /* Darwin */
+ #ifndef _BSD_RUNE_T_DEFINED_ /* Darwin */
#ifndef _WCHAR_T_DEFINED_
#ifndef _WCHAR_T_DEFINED
#ifndef _WCHAR_T_H
***************
*** 275,280 ****
--- 276,282 ----
#ifdef _BSD_RUNE_T_
#if !defined (_ANSI_SOURCE) && !defined (_POSIX_SOURCE)
typedef _BSD_RUNE_T_ rune_t;
+ #define _BSD_RUNE_T_DEFINED_
#define _BSD_WCHAR_T_DEFINED_
#if defined (__FreeBSD__)
/* Why is this file so hard to maintain properly? In constrast to
***************
*** 306,311 ****
--- 308,314 ----
#endif
#endif
#endif
+ #endif
#endif /* __WCHAR_T__ */
#endif /* __wchar_t__ */
#undef __need_wchar_t


save that into the srcdir folder. then navigate yourself to the srcdir folder in the terminal:
cd ../srcdir
if you're in the objdir folder
('cd ../' takes you up one level)

then type this in the terminal:
patch -p0 < [filename of the patch]

so if you named the patch text file as patchfile, you'd use:
patch -p0 < patchfile


in the terminal, get back to the objdir:
cd ../objdir

this part takes a *long* time for it to do. (g3 500mHz powerbook - about an hour, maybe more). type:
make bootstrap

after that, while in the terminal, in objdir folder type:
sudo make install

you'll then be asked for your password. this is the password that you use when installing anything in os x.
type in the password and press return.

(this part isn't necessary to installing but i found it a usefull thing to know) - to see this installation in the finder you have to open the 'usr' folder which is hidden in os x. to open the hidden folder type in the terminal:
open /usr

to make the gnu gcc available from the terminal with one command type:
setenv PATH /usr/opt/bin:$PATH

then to call this gcc, the command is:
fsf-gcc

rather than the usual:
gcc
which accesses apple's gcc

for example type (which is specified in the configure command near the start of these instructions. so you can probably use whatever prefix you want):
fsf-gcc -v
to see the version info of the new gcc.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]