FS#40364 - [elfutils] prelink seems to require the static version of libelf

Attached to Project: Arch Linux
Opened by Alexander F. Rødseth (xyproto) - Wednesday, 14 May 2014, 17:12 GMT
Last edited by Laurent Carlier (lordheavy) - Monday, 19 May 2014, 16:22 GMT
Task Type Bug Report
Category Packages: Extra
Status Closed
Assigned To Laurent Carlier (lordheavy)
Architecture All
Severity Medium
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 1
Private No

Details

Hi!

elfutils contains the libelf library. However, when attempting to compile prelink, the following message appears:

/usr/bin/ld: cannot find -lelf

When compiling a small test C program with -lelf, it works great. The problem is that prelink seems to need to compile with the static version of libelf. When specifing the file itself with -l:/usr/lib/libelf.so.1 instead of just -lelf, I get the following error:

/usr/bin/ld: attempted static link of dynamic object `/usr/lib/libelf.so.1'

This happens even if ./configure is run with --disable-static.

Here is the full commandline that fails, when specifying the libelf.so.1 file:

gcc -Wall -Wno-pointer-sign -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector --param=ssp-buffer-size=4 -Wl,-O1 -Wl,--sort-common -Wl,--as-needed -Wl,-z -Wl,relro -o prelink -static cache.o conflict.o cxx.o doit.o exec.o execle_open.o get.o gather.o layout.o main.o prelink.o reloc.o space.o undo.o undoall.o verify.o canonicalize.o md5.o sha.o checksum.o data.o dso.o dwarf2.o fptr.o hashtab.o mdebug.o stabs.o crc32.o arch-i386.o arch-alpha.o arch-ppc.o arch-ppc64.o arch-sparc.o arch-sparc64.o arch-x86_64.o arch-mips.o arch-s390.o arch-s390x.o arch-arm.o arch-sh.o arch-ia64.o -l:/usr/lib/libelf.so.1

It seems to me that readlink insists on compiling prelink with -static, no matter what.

Would it be possible to include the static .a libraries in the elfutils, in order to try to solve this?

If you know a better method, that would be appreciated as well. I've tried all sorts of trickery, environment variables, different versions of autoconf, running autoreconf, compiling with clang etc etc. The worst result so far is that the compilation just used up all available memory like a fork bomb.


Various info:

* 64-bit Arch Linux
* elfutils 0.158-2
* the prelink PKGBUILD in community / svn


Steps to reproduce:
* Check out the prelink PKGBUILD
* Build in a chroot, or for a more fine-grained approach:
- makepkg
- cd src/prelink/src
- make


I think static library files in the elfutils package might solve this, but any suggestions are appreciated. Thanks!
This task depends upon

Closed by  Laurent Carlier (lordheavy)
Monday, 19 May 2014, 16:22 GMT
Reason for closing:  Fixed
Additional comments about closing:  elfutils-0.158-3
Comment by Alexander F. Rødseth (xyproto) - Thursday, 15 May 2014, 14:29 GMT
One of the comments in one of the build scripts in the build directory mentions that static libs might be built even though --disable-static was passed.

I have no idea why they would do this, but a reasonable assumption might be that static libraries really are needed for prelink to compile.

Loading...