From: hlu@phys1.physics.wsu.edu (Hongjiu Lu)
Newsgroups: comp.os.linux
Subject: FAQ for gcc 2.2.2d
Date: 17 Aug 92 00:28:13 GMT
Organization: Washington State University


-- 
H.J.
Gcc/libc maintainer for Linux.
---------
QUESTION: What compiler should I use for Linux?

ANSWER: You should only use the same version on tsx-11.mit.edu or
fgb1.fgb.mw.tu-muenchen.de under /pub/linux/GCC. If you want to use
the testing release, first join the GCC channel on the Linux mailing
list, and then send a note to hlu@eecs.wsu.edu. Don't use gcc older
than the one on tsx-11.mit.edu or fgb1.fgb.mw.tu-muenchen.de.

QUESTION: Where is the latest official gcc 2.xx for Linux?

ANSWER: It's on tsx-11.mit.edu under /pub/Linux/GCC and
fgb1.fgb.mw.tu-muenchen.de under pub/linux/GCC. You may find it on the
other sites. There are 4 files, 2.xxdb.tar.Z, 2.xxg1.tar.Z,
2.xxlib.tar.Z and 2.xxmisc.tar.Z. Another file, binutils.tar.Z, is not
the part of gcc 2.xx, but used by gcc 2.xx. It contains all the binary
utilities you need to run gcc 2.xx.  You should read the release note
to see if you should get the new binutils.tar.Z.

QUESTION: What are the contents of them?

ANSWER: 2.xxdb.tar.Z contains libg.a (compiled with -g), libc_p.a and
jump table stuffs. 2.xxg1.tar.Z contains libg.a compiled with -g1.
2.xxlib.tar.Z contains cc1 and cc1plus. 2.xxmisc.tar.Z contains gcc
2.xx drivers, cpp, header files, libraries, manual pages and
installation instructions.

Another file, XXXXinc.tar.Z, where XXXX is the current version number
of Linux kernel, has all the header files to replace the header files 
from kernel. 

YOU MUST INSTALL IT.
YOU MUST INSTALL IT.
YOU MUST INSTALL IT.
YOU MUST INSTALL IT.
YOU MUST INSTALL IT.

To use gcc 2.xx, you have to put the header files from kernel source of
version XXXX on line. Please read README for details.

QUESTION: How do I install it?

ANSWER: Read README and release notes.

QUESTION: What are the main differences with the old release?

ANSWER: Read README and release notes.

QUESTION: Can I use the old version of gcc?

ANSWER: Please get rid of gcc older than gcc 2.2.2. Starting from
gcc 2.2.2, you can do

	gcc -V xxxx

where xxxx is the version number. Please read `release.xxxx' for
detail. There is one catch in gcc 2.2.2d, setjmp/longjmp is changed,
so the old header files is not compatible with gcc 2.2.2. Before you
install gcc 2.2.2d, please do

cp /usr/include/setjmp.h /usr/lib/gcc-lib/i386-linux/2.2.2/include

where /usr/include/setjmp.h is come with gcc 2.2.2.

QUESTION: Is stdio ANSI compatible?

ANSWER: Yes, please test it.

QUESTION: Is g++ in 2.xx?

ANSWER: Yes.

QUESTION: How do I use gcc?

ANSWER: Read manual page, gcc.ps or gcc.man in /usr/install/gcc2.

QUESTION: What options can I use for gcc?

ANSWER: Read manual page, gcc.ps or gcc.man. -O3, -O4, -O5 or even
higher should work with 2.xx. -O3 is said to be the best. Don't ask me
why. Try it yourself. I was told you could manipulate those
optimization flags to get the best performance. Also -static tells gcc
to use the static libraries. The default is the shared libraries.

QUESTION: Where is the source code of the new libc.a?

ANSWER: The same place you find this file. It is called libc-2.xx.tar.Z.

QUESTION: Why does g++ complain, even die?

ANSWER: You need "expr", which is in GNU shell utilities 1.6, echo (?)
and sed.

QUESTION: How do I generate code for 486?

ANSWER: Add -m486 to CFLAGS.

QUESTION: I heard malloc (0) wouldn't work with Linux, what should I
do?

ANSWER: include <stdlib.h> and don't define NO_FIX_MALLOC.

QUESTION: Why does gcc say "xxxxx..h not found"?

ANSWER: see QUESTION: What are the contents of them?

QUESTION: I really followed every step in the documentation, but when
I do "make", why does it say "don't how to make xxxxxx"?

ANSWER: The dependency in Makefile is dated, you need to make a new
one. Please get some guide on make and read Makefile. For the kernel
sources, please do

cd src/linux
make dep

QUESTION: How do I compile programs under Linux?

ANSWER: The Linux C library is trying to be ANSI/POSIX compliant. It
is also very compatible with SYSV and BSD. The C library is loaded
with SYSV and BSD functions. There are three exceptions:

1. signal in Linux is POSIX.
2. tty in Linux is POSIX.
3. time functions are POSIX, plus a few BSD and SYSV extensions.
4. setjmp/longjmp functions are POSIX. But you can use -D__FAVOR_BSD
   to make it BSD or use sigsigjmp/siglongjmp.

When you compile a program under Linux, your best bet is include all
the appropriate header files and use -Wall. All the usable functions
and global variables are declared in the corresponding header files.
YOU SHOULD NOT DEFINE ANY functions or global variables OF THE LINUX C
LIBRARY IN YOUR CODE IF YOU WANT TO USE THE SHARED LIBRARIES.

After saying all those, you now should know you can compile a program
with -D_POSIX_SOURCE or -D_GNU_SOURCE (read <features.h> for details).
With a few modifications you can even use -DSYSV, -DUSG or -DBSD. Some
codes need to define -DSTDC_HEADERS for ANSI C compiler like gcc here.

Please read the header files for details. Maybe you should get a book
on POSIX. Any suggestion of the book list?

To use malloc () and calloc () safely under Linux, please include
<stdlib.h> and don't define NO_FIX_MALLOC.

BTW, gcc -traditional should work with gcc 2.2.2d or above.
Newsgroups: comp.os.linux