| 1 |
I would prefer you try using ../dwarfdump2, not this source. |
| 2 |
If you must use this for some reason, could you let me know why? |
| 3 |
Thanks. |
| 4 |
|
| 5 |
To build dwarfdump, first build libdwarf in the neighboring |
| 6 |
directory then type |
| 7 |
./configure |
| 8 |
make |
| 9 |
|
| 10 |
Installation is a bit primitive. |
| 11 |
sudo make install |
| 12 |
may or may not work. |
| 13 |
Some or all of the following might be required on Unix or Linux or MacOS: |
| 14 |
sudo mkdir -p /usr/local/share/man/man1/ |
| 15 |
sudo mkdir -p /usr/local/lib |
| 16 |
sudo mkdir -p /usr/local/bin |
| 17 |
Then retry the 'sudo make install' and (if necessary) try |
| 18 |
sudo chmod a+x /usr/local/bin/dwarfdump |
| 19 |
sudo chmod a+r /usr/local/share/man/man1/dwarfdump.1 |
| 20 |
sudo chmod a+r /usr/local/lib/dwarfdump.conf |
| 21 |
You don't really need the dwarfdump.1 man page, |
| 22 |
but you might as well have it. If the man page is not visible |
| 23 |
with 'man dwarfdump' try 'man manpath' for hints. |
| 24 |
|
| 25 |
If you don't need others using dwarfdump on your computer, |
| 26 |
just |
| 27 |
cp dwarfdump $HOME/bin/dwarfdump |
| 28 |
(by convention many people put personal executables in $HOME/bin |
| 29 |
and fix up $PATH to refer there) which suffices as 'installation'. |
| 30 |
Also |
| 31 |
cp dwarfdump.conf $HOME |
| 32 |
|
| 33 |
To use dwarf or libdwarf, you may want to install dwarf.h |
| 34 |
and libdwarf.h somewhere convenient. |
| 35 |
You can just copy those two headers to /usr/local/include by hand |
| 36 |
(or anywhere, really, that you have permission to copy to) |
| 37 |
(you may need to use -I/usr/local/include on compile lines |
| 38 |
to reference them there, but see below on configure and make). |
| 39 |
|
| 40 |
Notice that dwarf_names.c and dwarf_names.h are supplied by |
| 41 |
the release though the Makefile can and may rebuild them. |
| 42 |
Some users find it difficult to get a reliable awk(1) program, |
| 43 |
so for them these prebuilt versions may be useful. |
| 44 |
|
| 45 |
If your headers or libelf/libdwarf are not in the expected places, |
| 46 |
use the make command line to add flags and include directories. |
| 47 |
For example |
| 48 |
./configure |
| 49 |
PREINCS="-I /usr/local/include" POSTINCS="-I /home/x/include" make |
| 50 |
PREINCS content is inserted before CFLAGS as make(1) is running. |
| 51 |
POSTINCS content is added after the CFLAGS value. |
| 52 |
|
| 53 |
To set LDFLAGS, |
| 54 |
do so at configure time, for example: |
| 55 |
./configure LDFLAGS="-L /some/dir" |
| 56 |
And/or use PRELIBS and/or POSTLIBS at 'make' time similar to the use |
| 57 |
of PREINCS and POSTINCS. |
| 58 |
|
| 59 |
If the libdwarf directory |
| 60 |
has both libdwarf.so and libdwarf.a, the libdwarf.so |
| 61 |
will be picked up and |
| 62 |
"./tag_tree_build: error while loading shared libraries: |
| 63 |
libdwarf.so: cannot open shared object file: |
| 64 |
No such file or directory" |
| 65 |
will probably result. |
| 66 |
Either: remove libdwarf.so and rebuild or set |
| 67 |
the environment variable LD_LIBRARY_PATH to the directory |
| 68 |
containing the .so or use LDFLAGS to set rpath (see just below). |
| 69 |
It is perhaps simpler to ensure that the libdwarf directory |
| 70 |
only has an archive, not a shared-library. |
| 71 |
But sometimes one wants a shared library. |
| 72 |
In that case |
| 73 |
one can set ld's -rpath on the gcc command line like this: |
| 74 |
LDFLAGS="-Wl,-rpath=/some/path/libdir" |
| 75 |
so the shared library can be found at run time automatically. |
| 76 |
|
| 77 |
The same problem may arise with libelf, and the same approach |
| 78 |
will solve the problem. |
| 79 |
|
| 80 |
|
| 81 |
|
| 82 |
David Anderson. davea42 at earthlink dot net. |