This is the mail archive of the gcc-help@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]

Re: help with installing gcc in os x please.


fwyzard: thanks very much for such a thorough response :)

If you don't have a particular reason, I'd suggest you to download GCC 3.2.1, which is the latest released version.
i've downloaded and used gcc-core-3.2.1

i went for the core version as i only want c compilation capabilities from the gcc that i'm trying to install. not all the other capabilities like c++ and the others. and i think you only need the gcc-core file for that.

Just curious. What version of GCC comes with apple dev tools ?
gcc -v should tell you.
Thread model: posix
Apple Computer, Inc. GCC version 1161, based on gcc version 3.1 20020420 (prerelease)

i'm using os x 10.2
10.3 has been released, and there's a new developer tools, i noticed (which as you know contains apple's gcc), so there may now be a newer version of apple's gcc. not sure.


Step 1: Configure

The first step is the configuration: this stage sets things up to build GCC for your particular machine and usage, eg.: if you want to use it to compile for that same machine [native compiler] or to build binaries that will run on a different kind of machine (the target) [cross compiler]. You could alse make on a machine A a compiler that will run on machine B building binaries for machine C. :-)
slightly separate question - this isn't what i'm trying to achieve at the moment, but i'd really like to know for future:
if the target machine and your machine are both macs and both running os x (but maybe not the same version of os x, but say at least both 10.2 or higher) is it ok to copy the compiled gcc from your machine to another machine? copy gcc after it's been compiled on one machine, over to a similar but different machine?

Hopefully you'l get no errors :-).
step 1 - no errors :)


Step 2: Bootstrap.

If you get no errors, wow, you only need to intall it, now !
.....
......
.....
In file included from ../../../gccfolder/gcc/intl/dcigettext.c:58:
../include/stdlib.h:84: syntax error before "rune_t"
make[3]: *** [dcigettext.o] Error 1
make[2]: *** [intl.all] Error 1
make[1]: *** [stage2_build] Error 2
make: *** [bootstrap] Error 2

Looking around I found that, in order to actually build GCC, you MIGHT need o apply a ptch to a system header.
I'm saying MIGHT because maybe this has been fixed in the latet GCC or MacOS X release.
If while bootstrapping you get errors about some undefined types, you can try to fix it applying this patch
yup, did the patch part which resulted in this response:

patching file gcc/ginclude/stddef.h
Hunk #1 succeeded at 239 (offset -3 lines).
Hunk #3 succeeded at 294 (offset -3 lines).

so that looks good.


OK, lets assume you eventually got a working compiler....
i *think* i did. this was the last few lines of the output from 'make bootstrap':

CONFIG_H="config.h auto-host.h ../../gccfolder/gcc/../include/ansidecl.h ../../gccfolder/gcc/config/rs6000/rs6000.h ../../gccfolder/gcc/config/darwin.h ../../gccfolder/gcc/config/rs6000/darwin.h defaults.h insn-constants.h insn-flags.h" MACHMODE_H="machmode.h machmode.def" \
LIB1ASMSRC='' \
MAKEOVERRIDES= \
-f libgcc.mk all
for d in libgcc soft-float libgcc/soft-float; do \
if [ -d $d ]; then true; else /bin/sh ../../gccfolder/gcc/mkinstalldirs $d; fi; \
done
if [ -f stmp-dirs ]; then true; else touch stmp-dirs; fi
echo timestamp > stmp-multilib

so it doesn't look like it went wrong there. there were a *massive* amount of various warnings within all the output while it was working away though. not sure if that's ok or not. but no apparent outright errors.


 You need to install it.
This is easily done, with

make install
got a bit stuck here.

[Ben-Ds-Computer:~/gcc/objdir] bend% make install
/bin/sh ../gccfolder/mkinstalldirs /usr/local /usr/local
(cd intl && make all)
make[2]: Nothing to be done for `all'.
for file in cc1 ; do \
if [ -f $file ] ; then \
rm -f /usr/local/lib/gcc-lib/powerpc-apple-darwin6.2/3.2.1/$file; \
/bin/sh /Users/bend/gcc/gccfolder/install-sh -c $file /usr/local/lib/gcc-lib/powerpc-apple-darwin6.2/3.2.1/$file; \
else true; \
fi; \
done
mkdir: /usr/local/lib: Permission denied
mkdir: /usr/local/lib/gcc-lib: No such file or directory
mkdir: /usr/local/lib/gcc-lib/powerpc-apple-darwin6.2: No such file or directory
mkdir: /usr/local/lib/gcc-lib/powerpc-apple-darwin6.2/3.2.1: No such file or directory
cp: /usr/local/lib/gcc-lib/powerpc-apple-darwin6.2/3.2.1/_inst.13869_: No such file or directory
make[1]: *** [install-common] Error 1
make: *** [install-gcc] Error 2
[Ben-Ds-Computer:~/gcc/objdir] bend%

because of the 'mkdir: /usr/local/lib: Permission denied' and the fact that os x requires a password whenever you install software in os x, i tried this:

make install -pword=mypassword

which, much to my surprise, seemed to work. here are the final lines of output from that install command:

....
....
$(MAKE) -f Makefile.in gdb-taz TOOL=gdb PACKAGE=gdb+dejagnu \
MD5PROG="$(MD5PROG)" \
SUPPORT_FILES="$(GDBD_SUPPORT_DIRS)"


# 610 files in 1007 hash buckets.
# average 0.606 files per bucket, max 4 files in one bucket.

# VPATH Search Paths

# No `vpath' search paths.

# General (`VPATH' variable) search path:
# ../gccfolder

# Finished Make data base on Mon Dec 23 17:06:14 2002

# make: Leaving directory `/Users/bend/gcc2/objdir'




i've done the process twice now, the first time without the --program-suffix=suffix modification and the second with. i just used c for the modification.

i've typed gcc -v after the first time and gccc -v after the second go - neither attempts appearing to have succeeded

gcc -v gave the same response as before the installation attempts - apple's gcc version info

and gccc -v after the second go gave 'command not found'

so i'm not sure if it's worked, and i'm not accessing it correctly, or if i'm accessing it correctly but the installation hasn't worked.




In this way you'll get gcc & co. in /usr/local/bin.
i've never quite understand that - i've seen /usr/local/bin mentioned a lot but where/what is it? i don't seem to have a folder called bin in a folder called local... anywhere. is it a kind of virtual path?! i'm guessing. what i mean is, is it something that isn't going to be represented by folders/directories that i can see like normal folders represented as icons in the finder? i guess usr may be my user name rather than 'usr', but i still can't see what that means.

so i'm not sure if it's succeeded or not. it may easily have worked and i'm just not sure how to access the new gcc rather than the apple gcc.


Depeneding on how the search path for executables is setup on you machine (remember I know about nothing about MaxOS...), you'll automatically get this new version of GCC. Or not. Read on...

And - hey - what if you wanted to keep BOTH GCCs, the apple one, and the FSF one ?
yes, i do want to be able to access both, definitely


2 more questions!: :)

how should i go about doing all this, once i've got it working, but the resulting gcc compiler only having c compiling compatibilities? - i want the final thing to be as small/compact as possible, and i'm only going to be using it for compiling c. at the moment the final objdir folder is 154mb! which seems surprisingly large to me, but if that's the size it is, then there's nothing that can be done about that. (the size of it is important to me as i'm hoping to distribute this in/with another piece of software.)

does the installation process put files outside of the objdir folder, or is the final executable gcc all contained in that objdir folder?



so i've definitely got further than before, without doubt, but still not quite there. the main question is - has it worked and i'm just not accessing it correctly? or has it not installed correctly?

thanks again for a very helpful set of instructions,

ben.


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