Newsgroups: comp.os.linux.announce
From: hlu@eecs.wsu.edu
Subject: FAQ: gcc/libc
Message-ID: <1993Feb17.050620.7235@tc.cornell.edu>
Date: Wed, 17 Feb 1993 05:06:20 GMT
Approved: linux-announce@tc.cornell.edu (Matt Welsh)

Read the release notes before read this file.

------
QUESTION: What compiler should I use for Linux?

ANSWER: You should only use the same version on tsx-11.mit.edu 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.

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

ANSWER: It's on tsx-11.mit.edu under /pub/Linux/GCC and under
pub/linux/GCC. You may find it on the other sites. Since gcc 2.3.3,
you can compile it yourself out of box from any gnu ftp sites. Just
unpack the source code and do

	configure [i386-linux|i486-linux]

You should follow the instructions in INSTALL.

QUESTION: Where is the latest official Linux C library?

ANSWER: It's on tsx-11.mit.edu under /pub/Linux/GCC and under
pub/linux/GCC. You may find it on the other sites.

QUESTION: What are the contents of them?

ANSWER: Please read the current release note and ChangeLog for
details.

QUESTION: How do I install them?

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: Where can I get the gcc manual?

ANSWER: You can get man pages and manual come with the gcc source code
on any gnu ftp sites. You should find gcc-man.tar.z on tsx-11 which
has man pages for gcc.

QUESTION: What options can I use for gcc?

ANSWER: Read the manual. There is one special flag for Linux, -static
tells gcc to use the static libraries. The default is the jump table
version of shared libraries.

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

ANSWER: The same place you find this file. It is called lib-xx.yy.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: It *does* work in a manner which POSIX allows; unfortunately,
pre-POSIX code frequently assumes that malloc(0) will not return
0 -- the standard version of malloc under Linux *does* return 0.
By including <stdlib.h>, you get a definition of malloc which behaves
more traditionally.  If you define NO_FIX_MALLOC, then you will get
the default (non-traditional) form.  If you are trying to develop POSIX
compliant code under Linux, you should probably define NO_FIX_MALLOC to
ensure that your code doesn't make assumptions about malloc() which
will not work on other systems.  (Note: NO_FIX_MALLOC is specific to
Linux.)

(Provided by Phil.Richards@prg.oxford.ac.uk. Thanks.)

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.

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.

Please also read ChangeLog for the latest enhancement.

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

>From Steve Robbins  --  steve@nyongwa.cam.org

--------
I like "POSIX Programmer's Guide", by Donald Lewine.  Its essentially
a list of POSIX functions' man pages, with a very brief guide in the
beginning of a few things.  It's published by O'Reilly & Associates,
Inc.
--------

QUESTION: How can I get bsd style signal?

ANSWER: Use -D__USE_BSD_SIGNAL.

--------------
H.J.
hlu@eecs.wsu.edu
02/15/93

-- 
Send submissions for comp.os.linux.announce to: linux-announce@tc.cornell.edu
