| 1 | <html>
|
|---|
| 2 |
|
|---|
| 3 | <head>
|
|---|
| 4 | <title>GCC Frequently Asked Questions</title>
|
|---|
| 5 | </head>
|
|---|
| 6 |
|
|---|
| 7 | <body>
|
|---|
| 8 |
|
|---|
| 9 | <h1>GCC Frequently Asked Questions</h1>
|
|---|
| 10 |
|
|---|
| 11 | <p>The latest version of this document is always available at
|
|---|
| 12 | <a href="http://www.gnu.org/software/gcc/faq.html">http://www.gnu.org/software/gcc/faq.html</a>.</p>
|
|---|
| 13 |
|
|---|
| 14 | <p>This FAQ tries to answer specific questions concerning GCC. For
|
|---|
| 15 | general information regarding C, C++, resp. Fortran please check the
|
|---|
| 16 | <a href="http://www.eskimo.com/~scs/C-faq/top.html">comp.lang.c FAQ</a>,
|
|---|
| 17 | <a href="http://www.research.att.com/~austern/csc/faq.html">comp.std.c++
|
|---|
| 18 | FAQ</a>,
|
|---|
| 19 | and the <a href="http://www.fortran.com/fortran/info.html">Fortran
|
|---|
| 20 | Information page</a>.</p>
|
|---|
| 21 |
|
|---|
| 22 | <p>Other GCC-related FAQs:
|
|---|
| 23 | <a href="http://gcc.gnu.org/onlinedocs/libstdc++/faq/index.html">
|
|---|
| 24 | libstdc++-v3</a>, and
|
|---|
| 25 | <a href="http://gcc.gnu.org/java/faq.html">GCJ</a>.</p>
|
|---|
| 26 |
|
|---|
| 27 | <hr />
|
|---|
| 28 | <h1>Questions</h1>
|
|---|
| 29 | <ol>
|
|---|
| 30 | <li><a href="#general">General information</a>
|
|---|
| 31 | <ol>
|
|---|
| 32 | <li><a href="#gcc">What is the relationship between GCC and EGCS?</a></li>
|
|---|
| 33 | <li><a href="#cygnus">What is the relationship between GCC and Cygnus / Red Hat?</a></li>
|
|---|
| 34 | <li><a href="#open-development">What is an open development model?</a></li>
|
|---|
| 35 | <li><a href="#bugreport">How do I report a bug?</a></li>
|
|---|
| 36 | <li><a href="#support">How do I get a bug fixed or a feature added?</a></li>
|
|---|
| 37 | <li><a href="#platforms">Does GCC work on my platform?</a></li>
|
|---|
| 38 | </ol></li>
|
|---|
| 39 |
|
|---|
| 40 | <li><a href="#installation">Installation</a>
|
|---|
| 41 | <ol>
|
|---|
| 42 | <li><a href="#multiple">How to install multiple versions of GCC</a></li>
|
|---|
| 43 | <li><a href="#rpath">Dynamic linker is unable to find GCC libraries</a></li>
|
|---|
| 44 | <li><a href="#rpath">libstdc++/libio tests fail badly with --enable-shared</a></li>
|
|---|
| 45 | <li><a href="#gas">GCC can not find GNU as/GNU ld</a></li>
|
|---|
| 46 | <li><a href="#environ">cpp: Usage:... Error</a></li>
|
|---|
| 47 | <li><a href="#optimizing">Optimizing the compiler itself</a></li>
|
|---|
| 48 | </ol></li>
|
|---|
| 49 |
|
|---|
| 50 | <li><a href="#testsuite">Testsuite problems</a>
|
|---|
| 51 | <ol>
|
|---|
| 52 | <li><a href="#dejagnu">Unable to run the testsuite</a></li>
|
|---|
| 53 | <li><a href="#testoptions">How do I pass flags like
|
|---|
| 54 | <code>-fnew-abi</code> to the testsuite?</a></li>
|
|---|
| 55 | <li><a href="#multipletests">How can I run the test suite with multiple options?</a></li>
|
|---|
| 56 | </ol></li>
|
|---|
| 57 |
|
|---|
| 58 | <li><a href="#old">Older versions of GCC</a>
|
|---|
| 59 | <ol>
|
|---|
| 60 | <li><a href="#2.95sstream">Is there a stringstream / sstream for GCC 2.95.2?</a></li>
|
|---|
| 61 | </ol></li>
|
|---|
| 62 |
|
|---|
| 63 | <li><a href="#misc">Miscellaneous</a>
|
|---|
| 64 | <ol>
|
|---|
| 65 | <li><a href="#friend">Friend Templates</a></li>
|
|---|
| 66 | <li><a href="#dso"><code>dynamic_cast</code>, <code>throw</code>, <code>typeid</code> don't work with shared libraries</a></li>
|
|---|
| 67 | <li><a href="#generated_files">Why do I need autoconf, bison, xgettext, automake, etc?</a></li>
|
|---|
| 68 | <li><a href="#picflag-needed">Why can't I build a shared library?</a></li>
|
|---|
| 69 | <li><a href="#vtables">When building C++, the linker says my constructors, destructors or virtual tables are undefined, but I defined them</a></li>
|
|---|
| 70 | <li><a href="#incremental">Will GCC someday include an incremental linker?</a></li>
|
|---|
| 71 | </ol></li>
|
|---|
| 72 | </ol>
|
|---|
| 73 |
|
|---|
| 74 |
|
|---|
| 75 | <hr />
|
|---|
| 76 | <a name="general"></a>
|
|---|
| 77 | <h1>General information</h1>
|
|---|
| 78 |
|
|---|
| 79 | <h2><a name="gcc">What is the relationship between GCC and EGCS?</a></h2>
|
|---|
| 80 |
|
|---|
| 81 | <p>In 1990/1991 gcc version 1 had reached a point of stability. For the
|
|---|
| 82 | targets it could support, it worked well. It had limitations inherent in
|
|---|
| 83 | its design that would be difficult to resolve, so a major effort was made
|
|---|
| 84 | to resolve those limitiations and gcc version 2 was the result.</p>
|
|---|
| 85 |
|
|---|
| 86 | <p>When we had gcc2 in a useful state, development efforts on gcc1 stopped
|
|---|
| 87 | and we all concentrated on making gcc2 better than gcc1 could ever be. This
|
|---|
| 88 | is the kind of step forward we wanted to make with the EGCS project when it
|
|---|
| 89 | was formed in 1997.</p>
|
|---|
| 90 |
|
|---|
| 91 | <p>In April 1999 the Free Software Foundation officially halted
|
|---|
| 92 | development on the gcc2 compiler and appointed the EGCS project as the
|
|---|
| 93 | official GCC maintainers. The net result was a single project which
|
|---|
| 94 | carries forward GCC development under the ultimate control of the
|
|---|
| 95 | <a href="steering.html">GCC Steering Committee</a>.</p>
|
|---|
| 96 |
|
|---|
| 97 |
|
|---|
| 98 | <hr />
|
|---|
| 99 | <h2><a name="cygnus">What is the relationship between GCC and Cygnus / Red Hat?</a></h2>
|
|---|
| 100 |
|
|---|
| 101 | <p>It is a common mis-conception that Red Hat controls GCC either
|
|---|
| 102 | directly or indirectly.</p>
|
|---|
| 103 |
|
|---|
| 104 | <p>While Red Hat does donate hardware, network connections, code and
|
|---|
| 105 | developer time to GCC development, Red Hat does not control GCC.</p>
|
|---|
| 106 |
|
|---|
| 107 | <p>Overall control of GCC is in the hands of the
|
|---|
| 108 | <a href="steering.html">GCC Steering Committee</a>
|
|---|
| 109 | which includes people from a variety of different organizations and
|
|---|
| 110 | backgrounds. The purpose of the steering committee is to make
|
|---|
| 111 | decisions in the best interest of GCC and to help ensure that no
|
|---|
| 112 | individual or company has control over the project.</p>
|
|---|
| 113 |
|
|---|
| 114 | <p>To summarize, Red Hat contributes to the GCC project, but does not exert
|
|---|
| 115 | a controlling influence over GCC.</p>
|
|---|
| 116 |
|
|---|
| 117 | <hr />
|
|---|
| 118 | <h2><a name="open-development">What is an open development model?</a></h2>
|
|---|
| 119 |
|
|---|
| 120 | <p>We are using a bazaar style
|
|---|
| 121 | <a href="#cathedral-vs-bazaar"><b>[1]</b></a>
|
|---|
| 122 | approach to GCC development: we make snapshots publicly available to
|
|---|
| 123 | anyone who wants to try them; we welcome anyone to join
|
|---|
| 124 | the development mailing list. All of the discussions on the
|
|---|
| 125 | development mailing list are available via the web. We're going to be
|
|---|
| 126 | making releases with a much higher frequency than they have been made
|
|---|
| 127 | in the past.</p>
|
|---|
| 128 |
|
|---|
| 129 | <p>In addition to weekly snapshots of the GCC development sources, we
|
|---|
| 130 | have the sources readable from a CVS server by anyone. Furthermore we
|
|---|
| 131 | are using remote CVS to allow remote maintainers write access to the
|
|---|
| 132 | sources.</p>
|
|---|
| 133 |
|
|---|
| 134 | <p>There have been many potential GCC developers who were not able to
|
|---|
| 135 | participate in GCC development in the past. We want these people to
|
|---|
| 136 | help in any way they can; we ultimately want GCC to be the best compiler
|
|---|
| 137 | in the world.</p>
|
|---|
| 138 |
|
|---|
| 139 | <p>A compiler is a complicated piece of software, there will still be
|
|---|
| 140 | strong central maintainers who will reject patches, who will demand
|
|---|
| 141 | documentation of implementations, and who will keep the level of
|
|---|
| 142 | quality as high as it is today. Code that could use wider testing may
|
|---|
| 143 | be integrated--code that is simply ill-conceived won't be.</p>
|
|---|
| 144 |
|
|---|
| 145 | <p>GCC is not the first piece of software to use this open development
|
|---|
| 146 | process; FreeBSD, the Emacs lisp repository, and the Linux kernel are
|
|---|
| 147 | a few examples of the bazaar style of development.</p>
|
|---|
| 148 |
|
|---|
| 149 | <p>With GCC, we are adding new features and optimizations at a
|
|---|
| 150 | rate that has not been done since the creation of gcc2; these
|
|---|
| 151 | additions inevitably have a temporarily destabilizing effect.
|
|---|
| 152 | With the help of developers working together with this bazaar style
|
|---|
| 153 | development, the resulting stability and quality levels will be better
|
|---|
| 154 | than we've had before.</p>
|
|---|
| 155 |
|
|---|
| 156 | <blockquote>
|
|---|
| 157 | <a name="cathedral-vs-bazaar"><b>[1]</b></a>
|
|---|
| 158 | We've been discussing different development models a lot over the
|
|---|
| 159 | past few months. The paper which started all of this introduced two
|
|---|
| 160 | terms: A <b>cathedral</b> development model versus a <b>bazaar</b>
|
|---|
| 161 | development model. The paper is written by Eric S. Raymond, it is
|
|---|
| 162 | called ``<a
|
|---|
| 163 | href="http://www.tuxedo.org/~esr/writings/cathedral-bazaar/">The
|
|---|
| 164 | Cathedral and the Bazaar</a>''. The paper is a useful starting point
|
|---|
| 165 | for discussions.
|
|---|
| 166 | </blockquote>
|
|---|
| 167 |
|
|---|
| 168 |
|
|---|
| 169 | <hr />
|
|---|
| 170 | <h2><a name="bugreport">How do I report a bug?</a></h2>
|
|---|
| 171 |
|
|---|
| 172 | <p>There are complete instructions <a href="bugs.html">here</a>.</p>
|
|---|
| 173 |
|
|---|
| 174 |
|
|---|
| 175 | <hr />
|
|---|
| 176 | <h2><a name="support">How do I get a bug fixed or a feature added?</a></h2>
|
|---|
| 177 |
|
|---|
| 178 | <p>There are lots of ways to get something fixed. The list below may be
|
|---|
| 179 | incomplete, but it covers many of the common cases. These are listed
|
|---|
| 180 | roughly in order of increasing difficulty for the average GCC user,
|
|---|
| 181 | meaning someone who is not skilled in the internals of GCC, and where
|
|---|
| 182 | difficulty is measured in terms of the time required to fix the bug.
|
|---|
| 183 | No alternative is better than any other; each has its benefits and
|
|---|
| 184 | disadvantages.</p>
|
|---|
| 185 |
|
|---|
| 186 | <ul>
|
|---|
| 187 | <li>Hire someone to fix it for you. There are various companies and
|
|---|
| 188 | individuals providing support for GCC. This alternative costs
|
|---|
| 189 | money, but is relatively likely to get results.</li>
|
|---|
| 190 |
|
|---|
| 191 | <li><a href="bugs.html">Report the problem to the GCC GNATS bug tracking system</a>
|
|---|
| 192 | and hope that someone will be kind
|
|---|
| 193 | enough to fix it for you. While this is certainly possible, and
|
|---|
| 194 | often happens, there is no guarantee that it will. You should
|
|---|
| 195 | not expect the same response from this method that you would see
|
|---|
| 196 | from a commercial support organization since the people who read
|
|---|
| 197 | GCC bug reports, if they choose to help you, will be volunteering their
|
|---|
| 198 | time. This alternative will work best if you follow the directions
|
|---|
| 199 | on <a href="bugs.html">submitting bugreports</a>.</li>
|
|---|
| 200 |
|
|---|
| 201 | <li>Fix it yourself. This alternative will probably bring results,
|
|---|
| 202 | if you work hard enough, but will probably take a lot of time,
|
|---|
| 203 | and, depending on the quality of your work and the perceived
|
|---|
| 204 | benefits of your changes, your code may or may not ever make it
|
|---|
| 205 | into an official release of GCC.</li>
|
|---|
| 206 | </ul>
|
|---|
| 207 |
|
|---|
| 208 | <hr />
|
|---|
| 209 |
|
|---|
| 210 | <h2><a name="platforms">Does GCC work on my platform?</a></h2>
|
|---|
| 211 |
|
|---|
| 212 | <p>The host/target specific installation notes for GCC include information
|
|---|
| 213 | about known problems with installing or using GCC on particular platforms.
|
|---|
| 214 | These are included in the sources for a release in INSTALL/specific.html,
|
|---|
| 215 | and the <a href="http://gcc.gnu.org/install/specific.html">latest version</a>
|
|---|
| 216 | is always available at the GCC web site.
|
|---|
| 217 | Reports of <a href="http://gcc.gnu.org/buildstat.html">successful builds</a>
|
|---|
| 218 | for several versions of GCC are also available at the web site.</p>
|
|---|
| 219 |
|
|---|
| 220 | <hr />
|
|---|
| 221 | <a name="installation"></a>
|
|---|
| 222 | <h1>Installation</h1>
|
|---|
| 223 |
|
|---|
| 224 | <h2><a name="multiple">How to install multiple versions of GCC</a></h2>
|
|---|
| 225 |
|
|---|
| 226 | <p>It may be desirable to install multiple versions of the compiler on
|
|---|
| 227 | the same system. This can be done by using different prefix paths at
|
|---|
| 228 | configure time and a few symlinks.</p>
|
|---|
| 229 |
|
|---|
| 230 | <p>Basically, configure the two compilers with different --prefix options,
|
|---|
| 231 | then build and install each compiler. Assume you want "gcc" to be the latest
|
|---|
| 232 | compiler and available in /usr/local/bin; also assume that you want "gcc2"
|
|---|
| 233 | to be the older gcc2 compiler and also available in /usr/local/bin.</p>
|
|---|
|
|---|