Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 427538 - sys-devel/prelink fails to link with elfutils[threads]
Summary: sys-devel/prelink fails to link with elfutils[threads]
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Toolchain Maintainers
URL:
Whiteboard:
Keywords:
Depends on: 427222
Blocks:
  Show dependency tree
 
Reported: 2012-07-21 19:13 UTC by argonovsky
Modified: 2012-07-22 20:37 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Patch which adds proper linker flag (prelink-lpthread.patch,247 bytes, text/plain)
2012-07-21 19:13 UTC, argonovsky
Details

Note You need to log in before you can comment on or make changes to this bug.
Description argonovsky 2012-07-21 19:13:29 UTC
Created attachment 318840 [details]
Patch which adds proper linker flag

Hello,

Ok, I noticed that this bug is caused by #427524.
Every available prelink's version in portage fails to compile
because of undefined references to pthread functions:

/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.1/../../../../lib64/libelf.a(elf_begin.o):function file_read_elf: error: undefined reference to 'pthread_rwlock_init'
/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.1/../../../../lib64/libelf.a(elf_begin.o):function __libelf_read_mmaped_file: error: undefined reference to 'pthread_rwlock_init'
/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.1/../../../../lib64/libelf.a(elf_begin.o):function __libelf_read_mmaped_file: error: undefined reference to 'pthread_rwlock_init'
/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.1/../../../../lib64/libelf.a(elf_begin.o):function read_file: error: undefined reference to 'pthread_rwlock_init'
/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.1/../../../../lib64/libelf.a(elf_begin.o):function lock_dup_elf.7838: error: undefined reference to 'pthread_rwlock_unlock'
/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.1/../../../../lib64/libelf.a(elf_begin.o):function lock_dup_elf.7838: error: undefined reference to 'pthread_rwlock_wrlock'
/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.1/../../../../lib64/libelf.a(elf_begin.o):function elf_begin: error: undefined reference to 'pthread_rwlock_rdlock'
/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.1/../../../../lib64/libelf.a(elf_begin.o):function elf_begin: error: undefined reference to 'pthread_rwlock_unlock'
/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.1/../../../../lib64/libelf.a(elf_end.o):function elf_end: error: undefined reference to 'pthread_rwlock_wrlock'
/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.1/../../../../lib64/libelf.a(elf_end.o):function elf_end: error: undefined reference to 'pthread_rwlock_unlock'
/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.1/../../../../lib64/libelf.a(elf_end.o):function elf_end: error: undefined reference to 'pthread_rwlock_rdlock'
/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.1/../../../../lib64/libelf.a(elf_end.o):function elf_end: error: undefined reference to 'pthread_rwlock_wrlock'
/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.1/../../../../lib64/libelf.a(elf_end.o):function elf_end: error: undefined reference to 'pthread_rwlock_unlock'
/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.1/../../../../lib64/libelf.a(elf_end.o):function elf_end: error: undefined reference to 'pthread_rwlock_destroy'
/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.1/../../../../lib64/libelf.a(elf32_getehdr.o):function getehdr_impl: error: undefined reference to 'pthread_rwlock_wrlock'
/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.1/../../../../lib64/libelf.a(elf32_getehdr.o):function elf32_getehdr: error: undefined reference to 'pthread_rwlock_rdlock'
/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.1/../../../../lib64/libelf.a(elf64_getehdr.o):function elf64_getehdr: error: undefined reference to 'pthread_rwlock_rdlock'

The solution is modifying `configure' script and adding -lpthread flag
to `LIBS' variable (as shown in my ugly, attached patch).

NOTE: It does not matter if we're trying compilation with 'highly unstable' (masked) gcc version or stable one. It never works.
Comment 1 SpanKY gentoo-dev 2012-07-22 18:07:42 UTC
don't cc people directly
Comment 2 SpanKY gentoo-dev 2012-07-22 20:37:46 UTC
should be all set now in the tree; thanks for the report!

Commit message: Link against pthreads when elfutils is built with USE=threads
http://sources.gentoo.org/sys-devel/prelink/prelink-20111012.ebuild?r1=1.3&r2=1.4