To build trace-cmd, several libraries should be installed after pulling the source code.
* libtraceevent
* libtracefs
Install libtraceevent
The first thing to do is pull libtraceevent source using below commands;
$ git clone git://git.kernel.org/pub/scm/libs/libtrace/libtraceevent.git
Cloning into 'libtraceevent'...
remote: Enumerating objects: 2921, done.
remote: Total 2921 (delta 0), reused 0 (delta 0), pack-reused 2921
Receiving objects: 100% (2921/2921), 776.79 KiB | 1.79 MiB/s, done.
Resolving deltas: 100% (2087/2087), done.
Next, compile libtraceevent with 'make' command;
$ cd libtraceevent/
$ make
DESCEND src libtraceevent.a
COMPILE FPIC event-parse-api.o
COMPILE FPIC event-parse.o
COMPILE FPIC event-plugin.o
...
BUILD PLUGIN plugin_cfg80211.so
BUILD PLUGIN plugin_tlb.so
GEN libtraceevent-dynamic-list
And then 'sudo make install' command is used to install libtraceevent;
$ sudo make install
[sudo] password for austindh.kim:
DESCEND src libtraceevent.a
BUILD STATIC LIB libtraceevent.a
DESCEND src libtraceevent.so
INSTALL /home/austindh.kim/osc_src/libtraceevent_src/libtraceevent/include/traceevent/event-parse.h to /usr/local/include/traceevent
INSTALL /home/austindh.kim/osc_src/libtraceevent_src/libtraceevent/include/traceevent/event-utils.h to /usr/local/include/traceevent
INSTALL /home/austindh.kim/osc_src/libtraceevent_src/libtraceevent/include/traceevent/trace-seq.h to /usr/local/include/traceevent
...
INSTALL /home/austindh.kim/osc_src/libtraceevent_src/libtraceevent/plugins/plugin_tlb.so to /usr/local/lib64/traceevent/plugins
Install libtracefs
1. Pull libtracefs source with below command and then compile with 'make' command.
$ git clone https://git.kernel.org/pub/scm/libs/libtrace/libtracefs.git/
$ make
DESCEND src libtracefs.so
COMPILE FPIC tracefs-utils.o
COMPILE FPIC tracefs-instance.o
COMPILE FPIC tracefs-events.o
COMPILE FPIC tracefs-tools.o
COMPILE FPIC tracefs-marker.o
COMPILE FPIC tracefs-kprobes.o
COMPILE FPIC tracefs-hist.o
COMPILE FPIC tracefs-filter.o
2. Use 'sudo make install' command to install libtracefs
$ sudo make install
DESCEND src libtracefs.a
BUILD STATIC LIB libtracefs.a
DESCEND src libtracefs.so
INSTALL /home/austindh.kim/osc_src/libtracefs_src/libtracefs/libtracefs.pc to /usr/local/lib/x86_64-linux-gnu/pkgconfig
INSTALL /home/austindh.kim/osc_src/libtracefs_src/libtracefs/lib/libtracefs.so.1.6.dev to /usr/local/lib64
INSTALL /home/austindh.kim/osc_src/libtracefs_src/libtracefs/include/tracefs.h to /usr/local/include/tracefs
Install libaudit-dev
Use below command to install libaudit-dev.
$ sudo apt-get install libaudit-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
...
(Reading database ... 691233 files and directories currently installed.)
Preparing to unpack .../libcap-ng-dev_0.7.7-3.1_amd64.deb ...
Unpacking libcap-ng-dev (0.7.7-3.1) ...
Selecting previously unselected package libaudit-dev:amd64.
Preparing to unpack .../libaudit-dev_1%3a2.8.2-1ubuntu1.1_amd64.deb ...
Unpacking libaudit-dev:amd64 (1:2.8.2-1ubuntu1.1) ...
Setting up libcap-ng-dev (0.7.7-3.1) ...
Setting up libaudit-dev:amd64 (1:2.8.2-1ubuntu1.1) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
Install swig
Also swig should be installed with 'sudo apt-get install swig' command.
$ sudo apt-get install swig
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
...
Preparing to unpack .../swig_3.0.12-1_amd64.deb ...
Unpacking swig (3.0.12-1) ...
Setting up swig3.0 (3.0.12-1) ...
Setting up swig (3.0.12-1) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
Install python-dev
Install python-dev with below command.
$ sudo apt-get install python-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
python-dev is already the newest version (2.7.15~rc1-1).
The following packages were automatically installed and are no longer required:
...
1. Now that I have installed all utilities to build trace-cmd, it is time to pull trace-cmd source.
$ git clone https://git.kernel.org/pub/scm/linux/kernel/git/rostedt/trace-cmd.git
2. Let's build trace-cmd with below command.
$ export PYTHON_VERS=python3
$ make all
Have zlib compression support
*************************************************************
ZSTD package not found, best compression algorithm not in use
*************************************************************
COMPILE FPIC trace-hash.o
COMPILE FPIC trace-hooks.o
COMPILE FPIC trace-input.o
COMPILE FPIC trace-output.o
COMPILE FPIC trace-recorder.o
COMPILE FPIC trace-util.o
COMPILE FPIC trace-filter-hash.o
COMPILE FPIC trace-filter.o
COMPILE FPIC trace-msg.o
...
swig -Wall -python -noproxy -I/home/austindh.kim/osc_src/trace_cmd_src/trace-cmd/include/trace-cmd -I/usr/local/include/traceevent ctracecmd.i
/usr/local/include/traceevent/event-parse.h:67: Warning 451: Setting a const char * variable may leak memory.
...
cc --shared /home/austindh.kim/osc_src/trace_cmd_src/trace-cmd/lib/trace-cmd/libtracecmd.a ctracecmd_wrap.o -o ctracecmd.so -L/home/austindh.kim/osc_src/trace_cmd_src/trace-cmd/lib/trace-cmd -ltracecmd -L/usr/local/lib64 -ltraceevent -L/usr/local/lib64 -ltracefs -ltraceevent
make[1]: Nothing to be done for 'all'.
Note: to build man pages, type "make doc"
to build unit tests, type "make test"
최근 덧글