This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: help with installing gcc in os x please.
- From: "Andrea 'fwyzard' Bocci" <fwyzard at inwind dot it>
- To: Ben Dougall <bend at freenet dot co dot uk>
- Cc: gcc-help at gcc dot gnu dot org
- Date: Mon, 30 Dec 2002 15:17:29 +0100
- Subject: Re: help with installing gcc in os x please.
At 16.57 28/12/2002 +0000, Ben Dougall wrote:
about the patch. i've done it like this ('patch' being the text file name
that's in the srcdir):
patch -p1 <patch
which gave this output:
patching file gcc/ginclude/stddef.h
Hunk #1 succeeded at 239 (offset -3 lines).
patch unexpectedly ends in middle of line
Hunk #3 succeeded at 294 with fuzz 1 (offset -3 lines).
patch unexpectedly ends in middle of line - that's not good. what could
be the matter there? i notice a comment style that i recognize from c as in:
/* words words words
[...]
This is not a problem, as a patch only displays some lines of the full
file. At most, that could be a problem in the file being patched, not in
the patch itself, if the comment wasn't closed.
I don't know if "patch" has problem reading newline different from unix's
but what you see happening is strange.
I tried applying the same patch to a fresh uncompressed source tree and I
got no problems (the same
Hunk #1 succeeded at 239 (offset -3 lines).
Hunk #3 succeeded at 292 (offset -3 lines).
message that you reported).
Here's an updated patch, however:
*** 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 it in a file (say patch) in the gcc-3.2.1 folder (the source folder,
that is), and apply it with
patch -p0 < patch (or wahtever the filename).
You should only get as output:
patching file gcc/ginclude/stddef.h
with no errors, etc.
Concernig your other problem (w/ installation):
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.1796_: No
such file or directory
make[1]: *** [install-common] Error 1
make: *** [install-gcc] Error 2
mkdir: /usr/local/lib: Permission denied
shows that the problem is that you are not allowed to create the folder
/usr/local/lib ,
while the other errors follow from this folder not existing.
I don't know the policies for creating folder under MacOS X, but if it were
a Unix box, I'd say this:
"The error comes from you trying to install GCC in a system folder or any
other folder that you have not write access to.
You need to be root, or have the same administrator privileges, and have
/usr/local not readonly, for the installation to succeed."
OK, mea culpa. While instructing you in the opther mail, I forgot to tell
you about the privileges you need in order to write in system directories.
So, not my suggestions are:
1.) delete everything but the GCC source archive
2.) uncompress it again in a clean folder, which from now on I will call
the "starting" folder: you should find a folder named "gcc-3.2.1" in that
folder.
3.) save the patch from this mail in that gcc-3.2.1 folder, taking care of
not overwriting any file in there. The name "patch" is OK.
4.) from the "gcc-3.21." foder, apply the patch, running "patch -p0 <
patch" at the terminal. You should see the massage:
patching file gcc/ginclude/stddef.h
5.) (optional, but cleaner) delete the file you used for the patch (from
the terminal: rm patch).
6.) create a build folder, say "build", under the same starting folder.
From the terminal, do
mkdir build
You should now have in that folder both "gcc-3.2.1" and "build" folders,
and nothing else.
7.) configure GCC
from the starting folder
cd build
../gcc-3.2.1/configure --enable-threads=posix --enable-shared
--prefix=/usr/opt/gcc --program-prefix=fsf- --disable-libgcj
--enable-version-specific-runtime-libs --enable-languages=c
The last options will tell the framework only to build the C frontned, eg.
you will only be able to compile C programs with this compiler.
Use --enable-languages=c,c++ to also build C++ support. The other languages
that you can add are "ada, f77, java, objc".
The but-last one will put the all the libraries in a subfolder of the gcc
install folder, along with their version number. This will help you using
more than one GCC and packing it if you plan to rredistribute it, after
building.
The --disable-libgcj option disable the java libraries. If you don't use
java, you don't need them.
The --prefix option specify the install folder. I chose that /usr/opt/gcc
so that it will not conflict with system files (I hope !)
For more info, see <http://gcc.gnu.org/install/configure.html>
8.) bootstrap GCC. Simply do
make bootstrap
and wait.
9.) Now the tricky part. To install GCC out of your home, you need to be
administrator. Either log in as administrato (don't know the exact name for
MacOS X, ask some othe MacOS user).
Else, you can try to do it the Unix way: from the terminal, at the build
folder, run the command
su
It will either ask a password, or fail with some error like "command not fond".
If it fails, you need to log in as administrator, or try something else
(eg., use that -pword thing, maybe it works, ore create the /usr/opt and
/usr/opt/gcc folders manually, and hope that the others inside can be made
after you make the first).
If it asks for a password, enter the administrator password, and read on.
Assuming you somehow managed to get it right (creatign the folders
manually, using "su", logging in as administrator), now you're at the
terminal in the build folder. Do
make install
and hopefully get no errors.
To check that the installation went on alright, go in the installation
dirctory:
cd /usr/opt/gcc/bin
and try
./fsf-gcc -v
If it works, you're almost done. If not, it's A Problem TM.
10.) Adjust the search path to find your newly build GCC.
Damn, I really have no clue with this, you should ask a MacOS X user !
Anyway, the thing to do is adding "/usr/opt/gcc/bin" at the end os the PATH
list, which should be a list of folder names separated by a colon.
Mhm. Maybe I can help you, at least for running it from the command line:
Become administrator (either logging in as that, or via the "su" program,
if it exists and is worklng). Edit the file /etc/profile with a text ditor.
If you see a line like
PATH=....:$PATH:....
add
:/usr/opt/gcc/bin
at the end.
If you see one or more lines like
pathmunge /usr/bin
pathmunge /something/somthing
add
pathmunge /usr/opt/gcc/bin after
after the others, just before
unset pathmunge
.
As always, good luck, and keep me informed...