[Dwarf-Discuss] Older version of libdwarf on new Linux error 48 (stamp version error)

David Anderson davea42@linuxmail.org
Fri Jun 3 21:01:18 GMT 2022

On 6/2/22 20:32, Paul Redkoles via Dwarf-Discuss wrote:
> I have an older version of libdwarf (over 10 years). And I'm building it
> on Oracle 79 with the Intel 2020 compilers.
> Everything compiles clean (libdwarf and exe that uses the lib), but I'm
> getting error #48 when calling dwarf_next_cu_header().
> This is the dw_dle_version_stamp_error.
> The stamp version is set to 2 in the lib.
> Any idea what could be?wrong?
> This same release of libdwarf works on suse Linux 11 (2013) using Intel
> 2016 compilers.? I left all makefiles for libdwarf and the exe that uses
> the lib, the same when migrating to new setup.? Again All builds clean.
> Both machines are Intel xeon 64-bit os.
> I've also tried newer versions of libdwarf, but enough has changed that
> it broke the code that uses the older libdwarf. But I did proceed down
> that path as well. And this code can't be changed.
> I've tried lots of things with not a lot of success.
> What's strange is, if I run the binary (built on the older machine) on
> the newer machine, libdwarf works fine.
> Hopefully this is enough clues for some things I could try. ??
> Many thanks.

The compiler version is not an issue if it supports C90/C89. And
of course it does!

Error 48 (DW_DLE_VERSION_STAMP_ERROR) means the object file you are
reading seems to have an unexpected version. 2,3,4, and 5 are valid numbers.

What I suggest is to add printf  of the version before every call to
_dwarf_error() and print the version stamp involved.

Looking at libdwarf-20190529 in the libdwarf directory
you should find that error code in
dwarf_arange.c dwarf_die_deliv.c dwarf_dnames.c, and dwarf_print_lines.c

and put that printf on each error.
I have a suspicion that you will see a version of 4 or 5, and a
sufficiently old libdwarf won't support that.

But I think the following is of greater interest.

These are the last few pre-semantic-versioning libdwarf versions.
These support DWARF2,3, and 4 and the later ones have
some DWARF5 support.

All releases are on www.prevanders.net from 1999 on, see
www.prevanders.net/dwarf.html , github does not have the old ones.

For example:

      curl --output libdwarf-20210528.tar.gz

which is the last before semantic versioning and the last
with  the old interfaces.

It is quite likely that any of the above  will fix the problem
and will be compatible with the old library-calling code.
Before semantic-versioning, ie 20210528 and earlier,
we kept all old interfaces around, working, and tested (meaning
over a 20+ year period) while adding new ones to accommodate
changes in DWARF itself.

If any issues or questions arise about libbdwarf feel free to contact me
David Anderson

More information about the Dwarf-discuss mailing list