You are not logged in.

#1 2016-07-24 17:22:12

aldyrius
Member
Registered: 2015-12-31
Posts: 17

[SOLVED] libelf (elfutils) compress/decompress function errors

Hello,

I'm trying to install a program from source and keep getting an error related to libelf.

The program is a research-modified version of Dynamips from:
https://github.com/Groundworkstech/dynamips-gdb-mod. It's a few years old and a whitepaper indicates the author had to update references to libelf too (see http://grid32.com/bb095447484a76e5c74d1 … otkits.pdf) -- however I'm running the most current elfutils for x64 linux.

$ pacman -Qi elfutils | grep Version
Version         : 0.166-1

Google search indicates the compress/decompress error message as known issue in the upstream RHEL version of elfutils, but was fixed earlier this year in version 0.166 (see https://bugzilla.redhat.com/show_bug.cg … id=1290470).

Attempting to compile the program runs for about 30 seconds and gets thru a good portion of the process, but then errors out.

Full error message output:

$ DYNAMIPS_ARCH=amd64 make -j 5
....
Linking dynamips
/usr/lib/libelf.a(elf_compress.o): In function `__libelf_compress':
(.text+0x10e): undefined reference to `deflateInit_'
/usr/lib/libelf.a(elf_compress.o): In function `__libelf_compress':
(.text+0x217): undefined reference to `deflate'
/usr/lib/libelf.a(elf_compress.o): In function `__libelf_compress':
(.text+0x2b6): undefined reference to `deflateEnd'
/usr/lib/libelf.a(elf_compress.o): In function `__libelf_compress':
(.text+0x320): undefined reference to `deflateEnd'
/usr/lib/libelf.a(elf_compress.o): In function `__libelf_compress':
(.text+0x37c): undefined reference to `deflateEnd'
/usr/lib/libelf.a(elf_compress.o): In function `__libelf_compress':
(.text+0x3ae): undefined reference to `deflateEnd'
/usr/lib/libelf.a(elf_compress.o): In function `__libelf_compress':
(.text+0x3e5): undefined reference to `deflateEnd'
/usr/lib/libelf.a(elf_compress.o): In function `__libelf_decompress':
(.text+0x477): undefined reference to `inflateInit_'
/usr/lib/libelf.a(elf_compress.o): In function `__libelf_decompress':
(.text+0x4a2): undefined reference to `inflate'
/usr/lib/libelf.a(elf_compress.o): In function `__libelf_decompress':
(.text+0x4af): undefined reference to `inflateReset'
/usr/lib/libelf.a(elf_compress.o): In function `__libelf_decompress':
(.text+0x4c3): undefined reference to `inflateEnd'
collect2: error: ld returned 1 exit status
make: *** [Makefile:229: dynamips] Error 1

The RHEL bug tracker above indicates using "lz" to fix it, I installed zlib with no change:

$ pacman -Qi zlib | grep Version
Version         : 1.2.8-4

Finally, tried re-installing base-devel just to confirm everything in there is up to date; this has no effect either.

Any idea what I should try next? Maybe there's something other than libelf or zlib involved here that I'm missing?

Any help is appreciated!

[edit: marking as solved]

Last edited by aldyrius (2016-07-24 20:28:18)

Offline

#2 2016-07-24 19:35:10

pypi
Wiki Maintainer
Registered: 2014-04-22
Posts: 250

Re: [SOLVED] libelf (elfutils) compress/decompress function errors

You just need to add -lz. libelf.a has been built against zlib, so you will need to also ensure that the linker knows to also link in zlib to supply the missing functions. Presumably someone else can explain this more coherently.

Looking at the makefile, you will need to change line 65 from

   LIBS=-L/usr/lib -L. -ldl /usr/lib/libelf.a $(PTHREAD_LIBS)

to

   LIBS=-L/usr/lib -L. -lz -ldl /usr/lib/libelf.a $(PTHREAD_LIBS)

Offline

#3 2016-07-24 19:39:52

Scimmia
Bug Wrangler
Registered: 2012-09-01
Posts: 7,436

Re: [SOLVED] libelf (elfutils) compress/decompress function errors

This is why it should be using pkg-config.

pkg-config --libs --static libelf

Offline

#4 2016-07-24 20:27:33

aldyrius
Member
Registered: 2015-12-31
Posts: 17

Re: [SOLVED] libelf (elfutils) compress/decompress function errors

pypi, it worked just like you said -- changed the Makefile and it all compiled with no errors!

I will keep in mind pkg-config for the future too.

Thank you both, marking as solved.

Offline

Board footer

Powered by FluxBB