Misha Brukman | a653885 | 2003-11-06 21:55:44 +0000 | [diff] [blame] | 1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" |
| 2 | "http://www.w3.org/TR/html4/strict.dtd"> |
| 3 | <html> |
| 4 | <head> |
| 5 | <title>LLVM: Frequently Asked Questions</title> |
| 6 | <style> |
| 7 | @import url("llvm.css"); |
| 8 | .question { font-weight: bold } |
| 9 | .answer { margin-left: 2em } |
| 10 | </style> |
| 11 | </head> |
| 12 | <body> |
John Criswell | c310f62 | 2003-10-13 16:13:06 +0000 | [diff] [blame] | 13 | |
Misha Brukman | a653885 | 2003-11-06 21:55:44 +0000 | [diff] [blame] | 14 | <div class="doc_title"> |
| 15 | LLVM: Frequently Asked Questions |
| 16 | </div> |
| 17 | |
| 18 | <ol> |
| 19 | <li><a href="#license">License</a> |
| 20 | <ol> |
| 21 | <li>Why are the LLVM source code and the front-end distributed under different |
| 22 | licenses?</li> |
| 23 | <li>Does the University of Illinois Open Source License really qualify as an |
| 24 | "open source" license?</li> |
| 25 | <li>Can I modify LLVM source code and redistribute the modified source?</li> |
| 26 | <li>Can I modify LLVM source code and redistribute binaries or other tools |
| 27 | based on it, without redistributing the source?</li> |
| 28 | </ol></li> |
| 29 | |
| 30 | <li><a href="#source">Source code</a> |
| 31 | <ol> |
| 32 | <li>In what language is LLVM written?</li> |
| 33 | <li>How portable is the LLVM source code?</li> |
| 34 | </ol></li> |
| 35 | |
| 36 | <li><a href="#build">Build Problems</a> |
| 37 | <ol> |
| 38 | <li>When I run configure, it finds the wrong C compiler.</li> |
| 39 | <li>I compile the code, and I get some error about <tt>/localhome</tt>.</li> |
| 40 | <li>The <tt>configure</tt> script finds the right C compiler, but it uses the |
| 41 | LLVM linker from a previous build. What do I do?</li> |
| 42 | <li>When creating a dynamic library, I get a strange GLIBC error.</li> |
| 43 | <li>I've updated my source tree from CVS, and now my build is trying to use a |
| 44 | file/directory that doesn't exist.</li> |
| 45 | <li>I've modified a Makefile in my source tree, but my build tree keeps using |
| 46 | the old version. What do I do?</li> |
| 47 | <li>I've upgraded to a new version of LLVM, and I get strange build |
| 48 | errors.</li> |
| 49 | <li>I've built LLVM and am testing it, but the tests freeze.</li> |
| 50 | <li>Why do test results differ when I perform different types of builds?</li> |
| 51 | </ol></li> |
John Criswell | 76c1e38 | 2003-11-18 16:08:49 +0000 | [diff] [blame^] | 52 | |
| 53 | <li><a href="#cfe">GCC Front End</a> |
| 54 | <ol> |
| 55 | <li> |
| 56 | When I compile software that uses a configure script, the configure script |
| 57 | thinks my system has all of the header files and libraries it is testing |
| 58 | for. How do I get configure to work correctly? |
| 59 | </li> |
| 60 | |
| 61 | <li> |
| 62 | When I compile code using the LLVM GCC front end, it complains that it |
| 63 | cannot find crtend.o. |
| 64 | </li> |
| 65 | </ol> |
| 66 | </li> |
Misha Brukman | a653885 | 2003-11-06 21:55:44 +0000 | [diff] [blame] | 67 | </ol> |
| 68 | |
| 69 | <!-- *********************************************************************** --> |
| 70 | <div class="doc_section"> |
| 71 | <a name="license">License</a> |
| 72 | </div> |
| 73 | <!-- *********************************************************************** --> |
| 74 | |
| 75 | <div class="question"> |
| 76 | <p>Why are the LLVM source code and the front-end distributed under different |
| 77 | licenses?</p> |
| 78 | </div> |
| 79 | |
| 80 | <div class="answer"> |
| 81 | <p>The C/C++ front-ends are based on GCC and must be distributed under the GPL. |
| 82 | Our aim is to distribute LLVM source code under a <em>much less restrictive</em> |
| 83 | license, in particular one that does not compel users who distribute tools based |
| 84 | on modifying the source to redistribute the modified source code as well.</p> |
| 85 | </div> |
| 86 | |
| 87 | <div class="question"> |
| 88 | <p>Does the University of Illinois Open Source License really qualify as an |
| 89 | "open source" license?</p> |
| 90 | </div> |
| 91 | |
| 92 | <div class="answer"> |
| 93 | <p>Yes, the license is <a |
| 94 | href="http://www.opensource.org/licenses/UoI-NCSA.php">certified</a> by the Open |
| 95 | Source Initiative (OSI).</p> |
| 96 | </div> |
| 97 | |
| 98 | <div class="question"> |
| 99 | <p>Can I modify LLVM source code and redistribute the modified source?</p> |
| 100 | </div> |
| 101 | |
| 102 | <div class="answer"> |
| 103 | <p>Yes. The modified source distribution must retain the copyright notice and |
| 104 | follow the three bulletted conditions listed in the <a |
| 105 | href="http://llvm.cs.uiuc.edu/releases/1.0/LICENSE.TXT">LLVM license</a>.</p> |
| 106 | </div> |
| 107 | |
| 108 | <div class="question"> |
| 109 | <p>Can I modify LLVM source code and redistribute binaries or other tools based |
| 110 | on it, without redistributing the source?</p> |
| 111 | </div> |
| 112 | |
| 113 | <div class="answer"> |
| 114 | <p>Yes, this is why we distribute LLVM under a less restrictive license than |
| 115 | GPL, as explained in the first question above.</p> |
| 116 | </div> |
| 117 | |
| 118 | <!-- *********************************************************************** --> |
| 119 | <div class="doc_section"> |
| 120 | <a name="source">Source Code</a> |
| 121 | </div> |
| 122 | <!-- *********************************************************************** --> |
| 123 | |
| 124 | <div class="question"> |
| 125 | <p>In what language is LLVM written?</p> |
| 126 | </div> |
| 127 | |
| 128 | <div class="answer"> |
| 129 | <p>All of the LLVM tools and libraries are written in C++ with extensive use of |
| 130 | the STL.</p> |
| 131 | </div> |
| 132 | |
| 133 | <div class="question"> |
| 134 | <p>How portable is the LLVM source code?</p> |
| 135 | </div> |
| 136 | |
| 137 | <div class="answer"> |
| 138 | <p>The LLVM source code should be portable to most modern UNIX-like operating |
| 139 | systems. Most of the code is written in standard C++ with operating system |
| 140 | services abstracted to a support library. The tools required to build and test |
| 141 | LLVM have been ported to a plethora of platforms.</p> |
| 142 | |
| 143 | <p>Some porting problems may exist in the following areas:</p> |
| 144 | |
| 145 | <ul> |
| 146 | |
| 147 | <li>The GCC front end code is not as portable as the LLVM suite, so it may not |
| 148 | compile as well on unsupported platforms.</li> |
| 149 | |
| 150 | <li>The Python test classes are more UNIX-centric than they should be, so |
| 151 | porting to non-UNIX like platforms (i.e. Windows, MacOS 9) will require some |
| 152 | effort.</li> |
| 153 | |
| 154 | <li>The LLVM build system relies heavily on UNIX shell tools, like the Bourne |
| 155 | Shell and sed. Porting to systems without these tools (MacOS 9, Plan 9) will |
| 156 | require more effort.</li> |
| 157 | |
| 158 | </ul> |
| 159 | |
| 160 | </div> |
| 161 | |
| 162 | <!-- *********************************************************************** --> |
| 163 | <div class="doc_section"> |
| 164 | <a name="build">Build Problems</a> |
| 165 | </div> |
| 166 | <!-- *********************************************************************** --> |
| 167 | |
| 168 | <div class="question"> |
| 169 | <p>When I run configure, it finds the wrong C compiler.</p> |
| 170 | </div> |
| 171 | |
| 172 | <div class="answer"> |
| 173 | |
| 174 | <p>The <tt>configure</tt> script attempts to locate first <tt>gcc</tt> and then |
| 175 | <tt>cc</tt>, unless it finds compiler paths set in <tt>CC</tt> and <tt>CXX</tt> |
| 176 | for the C and C++ compiler, respectively.</p> |
| 177 | |
| 178 | <p>If <tt>configure</tt> finds the wrong compiler, either adjust your |
| 179 | <tt>PATH</tt> environment variable or set <tt>CC</tt> and <tt>CXX</tt> |
| 180 | explicitly.</p> |
| 181 | |
| 182 | </div> |
| 183 | |
| 184 | <div class="question"> |
| 185 | <p>I compile the code, and I get some error about <tt>/localhome</tt>.</p> |
| 186 | </div> |
| 187 | |
| 188 | <div class="answer"> |
| 189 | |
| 190 | <p>There are several possible causes for this. The first is that you didn't set |
| 191 | a pathname properly when using <tt>configure</tt>, and it defaulted to a |
| 192 | pathname that we use on our research machines.</p> |
| 193 | |
| 194 | <p>Another possibility is that we hardcoded a path in our Makefiles. If you see |
| 195 | this, please email the LLVM bug mailing list with the name of the offending |
| 196 | Makefile and a description of what is wrong with it.</p> |
| 197 | |
| 198 | </div> |
| 199 | |
| 200 | <div class="question"> |
| 201 | <p>The <tt>configure</tt> script finds the right C compiler, but it uses the |
| 202 | LLVM linker from a previous build. What do I do?</p> |
| 203 | </div> |
| 204 | |
| 205 | <div class="answer"> |
| 206 | <p>The <tt>configure</tt> script uses the <tt>PATH</tt> to find executables, so |
| 207 | if it's grabbing the wrong linker/assembler/etc, there are two ways to fix |
| 208 | it:</p> |
| 209 | |
| 210 | <ol> |
| 211 | |
| 212 | <li><p>Adjust your <tt>PATH</tt> environment variable so that the correct |
| 213 | program appears first in the <tt>PATH</tt>. This may work, but may not be |
| 214 | convenient when you want them <i>first</i> in your path for other |
| 215 | work.</p></li> |
| 216 | |
| 217 | <li><p>Run <tt>configure</tt> with an alternative <tt>PATH</tt> that is |
| 218 | correct. In a Borne compatible shell, the syntax would be:</p> |
| 219 | |
| 220 | <p><tt>PATH=<the path without the bad program> ./configure ...</tt></p> |
| 221 | |
| 222 | <p>This is still somewhat inconvenient, but it allows <tt>configure</tt> |
| 223 | to do its work without having to adjust your <tt>PATH</tt> |
| 224 | permanently.</p></li> |
| 225 | |
| 226 | </ol> |
| 227 | |
| 228 | </div> |
| 229 | |
| 230 | <div class="question"> |
| 231 | <p>When creating a dynamic library, I get a strange GLIBC error.</p> |
| 232 | </div> |
| 233 | |
| 234 | <div class="answer"> |
| 235 | <p>Under some operating systems (i.e. Linux), libtool does not work correctly if |
| 236 | GCC was compiled with the --disable-shared option. To work around this, install |
| 237 | your own version of GCC that has shared libraries enabled by default.</p> |
| 238 | </div> |
| 239 | |
| 240 | <div class="question"> |
| 241 | <p>I've updated my source tree from CVS, and now my build is trying to use a |
| 242 | file/directory that doesn't exist.</p> |
| 243 | </div> |
| 244 | |
| 245 | <div class="answer"> |
| 246 | <p>You need to re-run configure in your object directory. When new Makefiles |
| 247 | are added to the source tree, they have to be copied over to the object tree in |
| 248 | order to be used by the build.</p> |
| 249 | </div> |
| 250 | |
| 251 | <div class="question"> |
| 252 | <p>I've modified a Makefile in my source tree, but my build tree keeps using the |
| 253 | old version. What do I do?</p> |
| 254 | </div> |
| 255 | |
| 256 | <div class="answer"> |
| 257 | |
| 258 | <p>If the Makefile already exists in your object tree, you |
| 259 | can just run the following command in the top level directory of your object |
| 260 | tree:</p> |
| 261 | |
| 262 | <p><tt>./config.status <relative path to Makefile></tt><p> |
| 263 | |
| 264 | <p>If the Makefile is new, you will have to modify the configure script to copy |
| 265 | it over.</p> |
| 266 | |
| 267 | </div> |
| 268 | |
| 269 | <div class="question"> |
| 270 | <p>I've upgraded to a new version of LLVM, and I get strange build errors.</p> |
| 271 | </div> |
| 272 | |
| 273 | <div class="answer"> |
| 274 | |
| 275 | <p>Sometimes, changes to the LLVM source code alters how the build system works. |
| 276 | Changes in libtool, autoconf, or header file dependencies are especially prone |
| 277 | to this sort of problem.</p> |
| 278 | |
| 279 | <p>The best thing to try is to remove the old files and re-build. In most |
| 280 | cases, this takes care of the problem. To do this, just type <tt>make |
| 281 | clean</tt> and then <tt>make</tt> in the directory that fails to build.</p> |
| 282 | |
| 283 | </div> |
| 284 | |
| 285 | <div class="question"> |
| 286 | <p>I've built LLVM and am testing it, but the tests freeze.</p> |
| 287 | </div> |
| 288 | |
| 289 | <div class="answer"> |
| 290 | |
| 291 | <p>This is most likely occurring because you built a profile or release |
| 292 | (optimized) build of LLVM and have not specified the same information on the |
| 293 | <tt>gmake</tt> command line.</p> |
| 294 | |
| 295 | <p>For example, if you built LLVM with the command:</p> |
| 296 | |
| 297 | <p><tt>gmake ENABLE_PROFILING=1</tt> |
| 298 | |
| 299 | <p>...then you must run the tests with the following commands:</p> |
| 300 | |
| 301 | <p><tt>cd llvm/test<br>gmake ENABLE_PROFILING=1</tt></p> |
| 302 | |
| 303 | </div> |
| 304 | |
| 305 | <div class="question"> |
| 306 | <p>Why do test results differ when I perform different types of builds?</p> |
| 307 | </div> |
| 308 | |
| 309 | <div class="answer"> |
| 310 | |
| 311 | <p>The LLVM test suite is dependent upon several features of the LLVM tools and |
| 312 | libraries.</p> |
| 313 | |
| 314 | <p>First, the debugging assertions in code are not enabled in optimized or |
| 315 | profiling builds. Hence, tests that used to fail may pass.</p> |
| 316 | |
| 317 | <p>Second, some tests may rely upon debugging options or behavior that is only |
| 318 | available in the debug build. These tests will fail in an optimized or profile |
| 319 | build.</p> |
| 320 | |
| 321 | </div> |
| 322 | |
| 323 | <!-- *********************************************************************** --> |
John Criswell | 6ea30b0 | 2003-11-18 16:05:23 +0000 | [diff] [blame] | 324 | <div class="doc_section"> |
| 325 | <a name="cfe">GCC Front End</a> |
| 326 | </div> |
| 327 | |
| 328 | <div class="question"> |
| 329 | <p> |
| 330 | When I compile software that uses a configure script, the configure script |
| 331 | thinks my system has all of the header files and libraries it is testing for. |
| 332 | How do I get configure to work correctly? |
| 333 | </p> |
| 334 | </div> |
| 335 | |
| 336 | <div class="answer"> |
| 337 | <p> |
| 338 | The configure script is getting things wrong because the LLVM linker allows |
| 339 | symbols to be undefined at link time (so that they can be resolved during JIT |
| 340 | or translation to the C back end). That is why configure thinks your system |
| 341 | "has everything." |
| 342 | </p> |
| 343 | <p> |
| 344 | To work around this, perform the following steps: |
| 345 | </p> |
| 346 | |
| 347 | <ol> |
| 348 | <li> |
| 349 | Make sure the CC and CXX environment variables contains the full path to the |
| 350 | LLVM GCC front end. |
| 351 | </li> |
| 352 | |
| 353 | <li> |
| 354 | Make sure that the regular C compiler is first in your PATH. |
| 355 | </li> |
| 356 | |
| 357 | <li> |
| 358 | Add the string "-Wl,-native" to your CFLAGS environment variable. |
| 359 | </li> |
| 360 | </ol> |
| 361 | |
| 362 | <p> |
| 363 | This will allow the gccld linker to create a native code executable instead of |
| 364 | a shell script that runs the JIT. Creating native code requires standard |
| 365 | linkage, which in turn will allow the configure script to find out if code is |
| 366 | not linking on your system because the feature isn't available on your system. |
| 367 | </p> |
| 368 | </div> |
| 369 | |
| 370 | <div class="question" |
| 371 | <p> |
| 372 | When I compile code using the LLVM GCC front end, it complains that it cannot |
| 373 | find crtend.o. |
| 374 | </p> |
| 375 | </div> |
| 376 | |
| 377 | <div class="answer" |
| 378 | <p> |
| 379 | In order to find crtend.o, you must have the directory in which it lives in |
| 380 | your LLVM_LIB_SEARCH_PATH environment variable. For the binary distribution of |
| 381 | the LLVM GCC front end, this will be the full path of the bytecode-libs |
| 382 | directory inside of the LLVM GCC distribution. |
| 383 | </p> |
| 384 | </div> |
| 385 | <!-- *********************************************************************** --> |
| 386 | <!-- *********************************************************************** --> |
John Criswell | c310f62 | 2003-10-13 16:13:06 +0000 | [diff] [blame] | 387 | |
| 388 | <hr> |
Misha Brukman | a653885 | 2003-11-06 21:55:44 +0000 | [diff] [blame] | 389 | <div class="doc_footer"> |
| 390 | <a href="http://llvm.cs.uiuc.edu">The LLVM Compiler Infrastructure</a> |
| 391 | <br> |
| 392 | Last modified: $Date$ |
| 393 | </div> |
John Criswell | f08c5d8 | 2003-10-24 22:48:20 +0000 | [diff] [blame] | 394 | |
John Criswell | c310f62 | 2003-10-13 16:13:06 +0000 | [diff] [blame] | 395 | </body> |
| 396 | </html> |