139 lines
4.4 KiB
Plaintext
139 lines
4.4 KiB
Plaintext
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.
|
|
|
|
QUESTION: What are the contents of them?
|
|
|
|
ANSWER: Please read the current release note and ChangeLog 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. Also -static tells gcc
|
|
to use the static libraries, -nojump forces gcc to use the classic
|
|
shared libraries. The default is the jump table version of shared
|
|
libraries. The shared libraries for X are linked with the jump table
|
|
version of shared C library.
|
|
|
|
QUESTION: Where is the source code of the new libc.a?
|
|
|
|
ANSWER: The same place you find this file. It is called
|
|
lib-src-yy.xx.TZ.
|
|
|
|
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.
|
|
|
|
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 enhencement.
|
|
|
|
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.
|
|
--------
|