elfutils is a collection of utilities and libraries to read, create and modify ELF binary files, find and handle DWARF debug data, symbols, thread state and stacktraces for processes and core files on GNU/Linux. [ Also READ : What is the difference between elfutils and binutils ? ]
Note: During the compilation of elfutils, 0.176 was the the last known version. Almost all commands remains same for other versions as well.
If you are trying to compile elfutils on freshly installed ubuntu, you may need to install “m4” as,
$ sudo apt-get install m4
Download the stable release code as below,
$ wget -c ftp://sourceware.org/pub/elfutils/0.176/elfutils-0.176.tar.bz2
$ tar xvf elfutils-0.176.tar.bz2
$ cd elfutils-0.169
$ mkdir out
$ ./configure --prefix=$PWD/out
$ make install
Above command will install all the required libraries and binaries at out folder in current directory. You can change the location as you want using –prefix as mentioned above.
$ tree out/ out/ ├── bin │ ├── eu-addr2line │ ├── eu-ar │ ├── eu-elfcmp │ ├── eu-elfcompress │ ├── eu-elflint │ ├── eu-findtextrel │ ├── eu-make-debug-archive │ ├── eu-nm │ ├── eu-objdump │ ├── eu-ranlib │ ├── eu-readelf │ ├── eu-size │ ├── eu-stack │ ├── eu-strings │ ├── eu-strip │ └── eu-unstrip
If you want to try the current under development code at git, you can try below procedure, but it may or may not work, since its development source
The current elfutils source code can be checked out with:
$ git clone git://sourceware.org/git/elfutils.git
$ cd elfutils
$ automake -a
This will generate the “configure” script which we can use to configure and create makefiles as,
In the next post we will describe the details of how to cross compile the elfutils for ARM.
3 thoughts on “How to compile elfutils for x86 based platforms ?”
how to build elfutils for mips64el,did it support?
Compiling for mips64el should also work, but for that you will need a cross toolchain, and after adding toolchain “bin” to PATH, you need to start “configure” as “$ ./configure –host=arm-linux-gnueabihf –prefix=$PWD/out” [Example is for ARM, just replace with correct mips toolchain string] But you also have to resolve the dependencies like cross compilation of zlib etc.