| 1 | --- |
| 2 | id: building-from-source |
| 3 | --- |
| 4 | |
| 5 | As [previously stated](#doc-installing-lttng), LTTng is shipped as |
| 6 | three packages: LTTng-tools, LTTng-modules and LTTng-UST. LTTng-tools |
| 7 | contains everything needed to control tracing sessions, while |
| 8 | LTTng-modules is only needed for Linux kernel tracing and LTTng-UST is |
| 9 | only needed for user space tracing. |
| 10 | |
| 11 | The tarballs are available in the |
| 12 | <a href="http://lttng.org/download#build-from-source" class="ext">Download |
| 13 | section</a> of the LTTng website. |
| 14 | |
| 15 | Please refer to the `README.md` files provided by each package to |
| 16 | properly build and install them. |
| 17 | |
| 18 | <div class="tip"> |
| 19 | <p> |
| 20 | <span class="t">Tip:</span>The aforementioned <code>README.md</code> files |
| 21 | are rendered as rich text when |
| 22 | <a href="https://github.com/lttng" class="ext">viewed on GitHub</a>. |
| 23 | </p> |
| 24 | </div> |
| 25 | |
| 26 | If you're using Ubuntu, executing the following Bash script |
| 27 | installs the appropriate dependencies, clones the LTTng |
| 28 | Git repositories, builds the projects, and installs them. The sources |
| 29 | are cloned into `~/src`. Your user needs to be a sudoer for the install |
| 30 | steps to be completed. |
| 31 | |
| 32 | ~~~ text |
| 33 | #!/bin/bash |
| 34 | |
| 35 | mkdir ~/src |
| 36 | cd ~/src |
| 37 | sudo apt-get update |
| 38 | sudo apt-get -y install build-essential libtool flex bison \ |
| 39 | libpopt-dev uuid-dev libglib2.0-dev autoconf \ |
| 40 | git libxml2-dev |
| 41 | git clone git://git.lttng.org/lttng-ust.git |
| 42 | git clone git://git.lttng.org/lttng-modules.git |
| 43 | git clone git://git.lttng.org/lttng-tools.git |
| 44 | git clone git://git.lttng.org/userspace-rcu.git |
| 45 | git clone git://git.efficios.com/babeltrace.git |
| 46 | |
| 47 | cd userspace-rcu |
| 48 | ./bootstrap && ./configure && make -j 4 && sudo make install |
| 49 | sudo ldconfig |
| 50 | |
| 51 | cd ../lttng-ust |
| 52 | ./bootstrap && ./configure && make -j 4 && sudo make install |
| 53 | sudo ldconfig |
| 54 | |
| 55 | cd ../lttng-modules |
| 56 | make && sudo make modules_install |
| 57 | sudo depmod -a |
| 58 | |
| 59 | cd ../lttng-tools |
| 60 | ./bootstrap && ./configure && make -j 4 && sudo make install |
| 61 | sudo ldconfig |
| 62 | sudo cp extras/lttng-bash_completion /etc/bash_completion.d/lttng |
| 63 | |
| 64 | cd ../babeltrace |
| 65 | ./bootstrap && ./configure && make -j 4 && sudo make install |
| 66 | sudo ldconfig |
| 67 | ~~~ |