📄 gcc.texi
字号:
programs:@itemize @bullet@itemTell your friends and colleagues about this issue and how it threatensto ruin the computer industry.@itemMention that you are a League member in your @file{.signature}, andmention the League's email address for inquiries.@itemAsk the companies you consider working for or working with to makestatements against software monopolies, and give preference to thosethat do.@itemWhen employers ask you to sign contracts giving them copyright on yourwork, insist on a clause saying they will not claim the copyright coversimitating the interface.@itemWhen employers ask you to sign contracts giving them patent rights,insist on clauses saying they can use these rights only defensively.Don't rely on ``company policy,'' since that can change at any time;don't rely on an individual executive's private word, since that personmay be replaced. Get a commitment just as binding as the commitmentthey get from you.@itemWrite to Congress to explain the importance of these issues.@displayHouse Subcommittee on Intellectual Property2137 Rayburn BldgWashington, DC 20515Senate Subcommittee on Patents, Trademarks and CopyrightsUnited States SenateWashington, DC 20510@end display(These committees have received lots of mail already; let's give themeven more.)@end itemizeDemocracy means nothing if you don't use it. Stand up and be counted!@ifset USING@node G++ and GCC@chapter Compile C, C++, or Objective C@cindex Objective CThe C, C++, and Objective C versions of the compiler are integrated; theGNU C compiler can compile programs written in C, C++, or Objective C.@cindex GCC``GCC'' is a common shorthand term for the GNU C compiler. This is boththe most general name for the compiler, and the name used when theemphasis is on compiling C programs.@cindex C++@cindex G++When referring to C++ compilation, it is usual to call the compiler``G++''. Since there is only one compiler, it is also accurate to callit ``GCC'' no matter what the language context; however, the term``G++'' is more useful when the emphasis is on compiling C++ programs.We use the name ``GNU CC'' to refer to the compilation system as awhole, and more specifically to the language-independent part of thecompiler. For example, we refer to the optimization options asaffecting the behavior of ``GNU CC'' or sometimes just ``the compiler''.Front ends for other languages, such as Ada 9X, Fortran, Modula-3, andPascal, are under development. These front-ends, like that for C++, arebuilt in subdirectories of GNU CC and link to it. The result is anintegrated compiler that can compile programs written in C, C++,Objective C, or any of the languages for which you have installed frontends.In this manual, we only discuss the options for the C, Objective-C, andC++ compilers and those of the GNU CC core. Consult the documentationof the other front ends for the options to use when compiling programswritten in other languages.@cindex compiler compared to C++ preprocessor@cindex intermediate C version, nonexistent@cindex C intermediate output, nonexistentG++ is a @emph{compiler}, not merely a preprocessor. G++ builds objectcode directly from your C++ program source. There is no intermediate Cversion of the program. (By contrast, for example, some otherimplementations use a program that generates a C program from your C++source.) Avoiding an intermediate C representation of the program meansthat you get better object code, and better debugging information. TheGNU debugger, GDB, works with this information in the object code togive you comprehensive C++ source-level editing capabilities(@pxref{C,,C and C++,gdb.info, Debugging with GDB}).@c FIXME! Someone who knows something about Objective C ought to put in@c a paragraph or two about it here, and move the index entry down when@c there is more to point to than the general mention in the 1st par.@include invoke.texi@include install.texi@include extend.texi@node Trouble@chapter Known Causes of Trouble with GNU CC@cindex bugs, known@cindex installation trouble@cindex known causes of troubleThis section describes known problems that affect users of GNU CC. Mostof these are not GNU CC bugs per se---if they were, we would fix them.But the result for a user may be like the result of a bug.Some of these problems are due to bugs in other software, some aremissing features that are too much work to add, and some are placeswhere people's opinions differ as to what is best.@menu* Actual Bugs:: Bugs we will fix later.* Installation Problems:: Problems that manifest when you install GNU CC.* Cross-Compiler Problems:: Common problems of cross compiling with GNU CC.* Interoperation:: Problems using GNU CC with other compilers, and with certain linkers, assemblers and debuggers.* External Bugs:: Problems compiling certain programs.* Incompatibilities:: GNU CC is incompatible with traditional C.* Fixed Headers:: GNU C uses corrected versions of system header files. This is necessary, but doesn't always work smoothly.* Standard Libraries:: GNU C uses the system C library, which might not be compliant with the ISO/ANSI C standard.* Disappointments:: Regrettable things we can't change, but not quite bugs.* C++ Misunderstandings:: Common misunderstandings with GNU C++.* Protoize Caveats:: Things to watch out for when using @code{protoize}.* Non-bugs:: Things we think are right, but some others disagree.* Warnings and Errors:: Which problems in your code get warnings, and which get errors.@end menu@node Actual Bugs@section Actual Bugs We Haven't Fixed Yet@itemize @bullet@itemThe @code{fixincludes} script interacts badly with automounters; if thedirectory of system header files is automounted, it tends to beunmounted while @code{fixincludes} is running. This would seem to be abug in the automounter. We don't know any good way to work around it.@itemThe @code{fixproto} script will sometimes add prototypes for the@code{sigsetjmp} and @code{siglongjmp} functions that reference the@code{jmp_buf} type before that type is defined. To work around this,edit the offending file and place the typedef in front of theprototypes.@itemThere are several obscure case of mis-using struct, union, and enum tags that are not detected as errors by the compiler.@itemWhen @samp{-pedantic-errors} is specified, GNU C will incorrectly givean error message when a function name is specified in an expressioninvolving the comma operator.@itemLoop unrolling doesn't work properly for certain C++ programs. This isa bug in the C++ front end. It sometimes emits incorrect debug info, andthe loop unrolling code is unable to recover from this error.@end itemize@node Installation Problems@section Installation ProblemsThis is a list of problems (and some apparent problems which don'treally mean anything is wrong) that show up during installation of GNUCC.@itemize @bullet@itemOn certain systems, defining certain environment variables such as@code{CC} can interfere with the functioning of @code{make}.@itemIf you encounter seemingly strange errors when trying to build thecompiler in a directory other than the source directory, it could bebecause you have previously configured the compiler in the sourcedirectory. Make sure you have done all the necessary preparations.@xref{Other Dir}.@itemIf you build GNU CC on a BSD system using a directory stored in a SystemV file system, problems may occur in running @code{fixincludes} if theSystem V file system doesn't support symbolic links. These problemsresult in a failure to fix the declaration of @code{size_t} in@file{sys/types.h}. If you find that @code{size_t} is a signed type andthat type mismatches occur, this could be the cause.The solution is not to use such a directory for building GNU CC.@itemIn previous versions of GNU CC, the @code{gcc} driver program looked for@code{as} and @code{ld} in various places; for example, in filesbeginning with @file{/usr/local/lib/gcc-}. GNU CC version 2 looks forthem in the directory@file{/usr/local/lib/gcc-lib/@var{target}/@var{version}}.Thus, to use a version of @code{as} or @code{ld} that is not the systemdefault, for example @code{gas} or GNU @code{ld}, you must put them inthat directory (or make links to them from that directory).@itemSome commands executed when making the compiler may fail (return anon-zero status) and be ignored by @code{make}. These failures, whichare often due to files that were not found, are expected, and can safelybe ignored.@itemIt is normal to have warnings in compiling certain files aboutunreachable code and about enumeration type clashes. These files' namesbegin with @samp{insn-}. Also, @file{real.c} may get some warnings thatyou can ignore.@itemSometimes @code{make} recompiles parts of the compiler when installingthe compiler. In one case, this was traced down to a bug in@code{make}. Either ignore the problem or switch to GNU Make.@itemIf you have installed a program known as purify, you may find that itcauses errors while linking @code{enquire}, which is part of buildingGNU CC. The fix is to get rid of the file @code{real-ld} which purifyinstalls---so that GNU CC won't try to use it.@item On SLS 1.01, a Linux-based GNU system, there is a problem with@file{libc.a}: it does not contain the obstack functions. However, GNUCC assumes that the obstack functions are in @file{libc.a} when it isthe GNU C library. To work around this problem, change the@code{__GNU_LIBRARY__} conditional around line 31 to @samp{#if 1}.@itemOn some 386 systems, building the compiler never finishes because@code{enquire} hangs due to a hardware problem in the motherboard---itreports floating point exceptions to the kernel incorrectly. You caninstall GNU CC except for @file{float.h} by patching out the command torun @code{enquire}. You may also be able to fix the problem for real bygetting a replacement motherboard. This problem was observed inRevision E of the Micronics motherboard, and is fixed in Revision F.It has also been observed in the MYLEX MXA-33 motherboard.If you encounter this problem, you may also want to consider removingthe FPU from the socket during the compilation. Alternatively, if youare running SCO Unix, you can reboot and force the FPU to be ignored.To do this, type @samp{hd(40)unix auto ignorefpu}.@itemOn some 386 systems, GNU CC crashes trying to compile @file{enquire.c}.This happens on machines that don't have a 387 FPU chip. On 386machines, the system kernel is supposed to emulate the 387 when youdon't have one. The crash is due to a bug in the emulator.One of these systems is the Unix from Interactive Systems: 386/ix.On this system, an alternate emulator is provided, and it does work.To use it, execute this command as super-user:@exampleln /etc/emulator.rel1 /etc/emulator@end example@noindentand then reboot the system. (The default emulator file remains presentunder the name @file{emulator.dflt}.)Try using @file{/etc/emulator.att}, if you have such a problem on theSCO system.Another system which has this problem is Esix. We don't know whether ithas an alternate emulator that works.On NetBSD 0.8, a similar problem manifests itself as these error messages:@exampleenquire.c: In function `fprop':enquire.c:2328: floating overflow@end example@itemOn SCO systems, when compiling GNU CC with the system's compiler,do not use @samp{-O}. Some versions of the system's compiler miscompileGNU CC with @samp{-O}.@cindex @code{genflags}, crash on Sun 4@itemSometimes on a Sun 4 you may observe a crash in the program@code{genflags} or @code{genoutput} while building GNU CC. This is said tobe due to a bug in @code{sh}. You can probably get around it by running@code{genflags} or @code{genoutput} manually and then retrying the@code{make}.@itemOn Solaris 2, executables of GNU CC version 2.0.2 are commonlyavailable, but they have a bug that shows up when compiling currentversions of GNU CC: undefined symbol errors occur during assembly if youuse @samp{-g}.The solution is to compile the current version of GNU CC without@samp{-g}. That makes a working compiler which you can use to recompilewith @samp{-g}.@itemSolaris 2 comes with a number of optional OS packages. Some of thesepackages are needed to use GNU CC fully. If you did not install alloptional packages when installing Solaris, you will need to verify thatthe packages that GNU CC needs are installed.To check whether an optional package is installed, usethe @code{pkginfo} command. To add an optional package, use the@code{pkgadd} command. For further details, see the Solarisdocumentation.For Solaris 2.0 and 2.1, GNU CC needs six packages: @samp{SUNWarc},@samp{SUNWbtool}, @samp{SUNWesu}, @samp{SUNWhea}, @samp{SUNWlibm}, and@samp{SUNWtoo}. For Solaris 2.2, GNU CC needs an additional seventh package: @samp{SUNWsprot}.@itemOn Solaris 2, trying to use the linker and other tools in@file{/usr/ucb} to install GNU CC has been observed to cause trouble.For example, the linker may hang indefinitely. The fix is to remove@file{/usr/ucb} from your @code{PATH}.@item
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -