1.. _BUILD:llvm:
2
3LLVM backend
4############
5
6.. rubric:: Requirements
7
8* GCC (Gnu Compiler Collection)
9* GNAT (Ada compiler for GCC)
10* LLVM (Low-Level-Virtual Machine) and CLANG (Compiler front-end for LLVM): 3.5, 3.8, 3.9, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0 or 11.0
11
12.. _BUILD:llvm:GNAT:
13
14GCC/GNAT: GNU/Linux or Windows (MinGW/MSYS2)
15============================================
16
17.. HINT:: You need to install LLVM (usually depends on ``libedit``, see :ghdlsharp:`29`). Debugging is supported with LLVM 3.5 or ``>=6``.
18
19GHDL is configured by ``configure`` and built by ``make``.
20
21* First, GHDL needs to be configured. It is common to specify a ``PREFIX``
22  (installation directory like ``/usr/local`` or ``/opt/ghdl``). Set the proper
23  arg, ``./configure --with-llvm-config``, to select LLVM backend. If
24  ``llvm-config`` is not in your path, you can specify it:
25  ``./configure --with-llvm-config=LLVM_INSTALL/bin/llvm-config``.
26
27* Next, ``make`` starts the compilation process.
28
29* Finally, ``make install`` installs GHDL into the installation directory
30  specified by ``PREFIX``.
31
32.. rubric:: Example:
33
34.. code-block:: Bash
35
36   $ cd <ghdl>
37   $ mkdir build
38   $ cd build
39   $ ../configure --with-llvm-config --prefix=PREFIX
40   $ make
41   $ make install
42
43.. HINT:: If you want to have stack backtraces on errors (like assert failure or index of out bounds), you need to configure and build ``libbacktrace`` from GCC (you don't need to configure GCC). Then add the following arg to configure: ``--with-backtrace-lib=/path-to-gcc-build/libbacktrace/.libs/libbacktrace.a``
44