|
| 1 | +.. _packaging: |
| 2 | + |
| 3 | +======================== |
| 4 | +Advice on Packaging LLVM |
| 5 | +======================== |
| 6 | + |
| 7 | +.. contents:: |
| 8 | + :local: |
| 9 | + |
| 10 | +Overview |
| 11 | +======== |
| 12 | + |
| 13 | +LLVM sets certain default configure options to make sure our developers don't |
| 14 | +break things for constrained platforms. These settings are not optimal for most |
| 15 | +desktop systems, and we hope that packagers (e.g., Redhat, Debian, MacPorts, |
| 16 | +etc.) will tweak them. This document lists settings we suggest you tweak. |
| 17 | + |
| 18 | +LLVM's API changes with each release, so users are likely to want, for example, |
| 19 | +both LLVM-2.6 and LLVM-2.7 installed at the same time to support apps developed |
| 20 | +against each. |
| 21 | + |
| 22 | +Compile Flags |
| 23 | +============= |
| 24 | + |
| 25 | +LLVM runs much more quickly when it's optimized and assertions are removed. |
| 26 | +However, such a build is currently incompatible with users who build without |
| 27 | +defining ``NDEBUG``, and the lack of assertions makes it hard to debug problems |
| 28 | +in user code. We recommend allowing users to install both optimized and debug |
| 29 | +versions of LLVM in parallel. The following configure flags are relevant: |
| 30 | + |
| 31 | +``--disable-assertions`` |
| 32 | + Builds LLVM with ``NDEBUG`` defined. Changes the LLVM ABI. Also available |
| 33 | + by setting ``DISABLE_ASSERTIONS=0|1`` in ``make``'s environment. This |
| 34 | + defaults to enabled regardless of the optimization setting, but it slows |
| 35 | + things down. |
| 36 | + |
| 37 | +``--enable-debug-symbols`` |
| 38 | + Builds LLVM with ``-g``. Also available by setting ``DEBUG_SYMBOLS=0|1`` in |
| 39 | + ``make``'s environment. This defaults to disabled when optimizing, so you |
| 40 | + should turn it back on to let users debug their programs. |
| 41 | + |
| 42 | +``--enable-optimized`` |
| 43 | + (For svn checkouts) Builds LLVM with ``-O2`` and, by default, turns off |
| 44 | + debug symbols. Also available by setting ``ENABLE_OPTIMIZED=0|1`` in |
| 45 | + ``make``'s environment. This defaults to enabled when not in a |
| 46 | + checkout. |
| 47 | + |
| 48 | +C++ Features |
| 49 | +============ |
| 50 | + |
| 51 | +RTTI |
| 52 | + LLVM disables RTTI by default. Add ``REQUIRES_RTTI=1`` to your environment |
| 53 | + while running ``make`` to re-enable it. This will allow users to build with |
| 54 | + RTTI enabled and still inherit from LLVM classes. |
| 55 | + |
| 56 | +Shared Library |
| 57 | +============== |
| 58 | + |
| 59 | +Configure with ``--enable-shared`` to build |
| 60 | +``libLLVM-<major>.<minor>.(so|dylib)`` and link the tools against it. This |
| 61 | +saves lots of binary size at the cost of some startup time. |
| 62 | + |
| 63 | +Dependencies |
| 64 | +============ |
| 65 | + |
| 66 | +``--enable-libffi`` |
| 67 | + Depend on `libffi <http://sources.redhat.com/libffi/>`_ to allow the LLVM |
| 68 | + interpreter to call external functions. |
| 69 | + |
| 70 | +``--with-oprofile`` |
| 71 | + |
| 72 | + Depend on `libopagent |
| 73 | + <http://oprofile.sourceforge.net/doc/devel/index.html>`_ (>=version 0.9.4) |
| 74 | + to let the LLVM JIT tell oprofile about function addresses and line |
| 75 | + numbers. |
0 commit comments