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