/libdwarf

Mirror of https://sourceforge.net/projects/libdwarf/

Primary LanguageCOtherNOASSERTION

This is README.md

BUILDING from a git clone of the source tree with configure

in source base dir, do x=pwd sh autogen.sh rm -rf /tmp/empty mkdir /tmp/empty cd /tmp/empty # CFLAGS and enable-wall and # dwarfgen and dwarfexample are optional. CFLAGS='-g -O0' $x/configure
--enable-dwarfexample --enable-dwarfgen
--enable-wall make make check

BUILDING from a git clone of the source tree with cmake

where code is the directory name for the libdwarf project

rm -rf /tmp/bld mkdir /tmp/bld cd /tmp/bld cmake -DDO_TESTING=ON -DBUILD_DWARFEXAMPLE=ON
-DBUILD_DWARFGEN=ON /path/to/code ctest -R self

The following does not necessarily work. ?

To build using CMake one might do

  • cd /a/b/libdwarf-1
  • configure: cmake . -B_Release -DCMAKE_BUILD_TYPE=Release
  • build: cmake --build _Release --target dd
  • (optionally install): sudo cmake --build _Release --target install

for autotools builds, see README

Using autotools

IGNORE THE FOLLOWING. NEEDS REWRITE

Building in Source Tree

cd /a/b/libdwarf-1
./configure
make dd
#You may need to be root to do the following copy commands
cp dwarfdump/dwarfdump      /usr/local/bin
cp dwarfdump/dwarfdump.conf /usr/local/lib
#The following is optional, not needed to run dwarfdump
#when doing the default build.
cp libdwarf/libdwarf.a      /usr/local/lib

Building Out of Source Tree

mkdir /var/tmp/dwarfex
cd /var/tmp/dwarfex
/a/b/libdwarf-1/configure
make dd

In this case the source directory is not touched and all objects and files created are under /var/tmp/dwarfex

NOTE: When building out of source tree the source tree must be cleaned of any files created by a build in the source tree. This is due to the way GNU Make VPATH works.

Build All

To build all the tools (including dwarfgen and dwarfexample) use --target all on CMake or make all on autotools. There are known small compile-time issues with building dwarfgen on MaxOSX and most don't need to build dwarfgen.

Options

By default configure compiles and uses libdwarf.a. With -Dshared=ON (CMake) or --enable-shared (autotools) appended to the configure step, both libdwarf.a and libdwarf.so are built. The runtimes built will reference libdwarf.so.

With -Dnonshared=FALSE (CMake) or --disable-nonshared (autotools) appeded to the configure step, libdwarf.so is built and used; libdwarf.a is not built.

Sanity checking: Recent gcc has some checks that can be done at runtime. -fsanitize=undefined which are turned on here by --enable-sanitize at build time.

Distributing

When ready to create a new source distribution do a build and then make dist

David Anderson. Updated May 2021