Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 300495 - dev-libs/protobuf missing link to libpthread
Summary: dev-libs/protobuf missing link to libpthread
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Krzysztof Pawlik (RETIRED)
Depends on:
Reported: 2010-01-10 22:04 UTC by Luke-Jr
Modified: 2010-04-17 22:04 UTC (History)
0 users

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


Note You need to log in before you can comment on or make changes to this bug.
Description Luke-Jr 2010-01-10 22:04:35 UTC
g++  -g -O2  -L/usr/lib -o protoxs perlxs_generator.o perlxs_helpers.o main.o -lprotoc -lprotobuf
/usr/lib/ undefined reference to `pthread_once'
Comment 1 Luke-Jr 2010-01-10 22:54:05 UTC
Applies to at least 2.1.0 as well
Comment 2 Krzysztof Pawlik (RETIRED) gentoo-dev 2010-01-17 11:51:55 UTC
libprotobuf.lafor 2.3.0 (just committed) contains -lpthread.
Comment 3 Luke-Jr 2010-01-17 15:12:45 UTC
Is this version stable too, or are we supposed to just tolerate the older versions being broken until it is? (the two protobuf-dependent things I have tried to build fail because of this)
Comment 4 Krzysztof Pawlik (RETIRED) gentoo-dev 2010-01-17 15:18:56 UTC
All versions of protobuf are marked as ~arch, so yes, you need to use 2.3.0.

Also you can add -lpthread on your own to link line, like:

g++  -g -O2  -L/usr/lib -o protoxs perlxs_generator.o perlxs_helpers.o main.o -lprotoc -lprotobuf -lpthread
Comment 5 Luke-Jr 2010-04-17 16:20:43 UTC
2.1.0 really should be fixed or removed...
Comment 6 Luke-Jr 2010-04-17 17:08:34 UTC
Furthermore, even 2.3.0 is still broken.
Comment 7 Krzysztof Pawlik (RETIRED) gentoo-dev 2010-04-17 21:10:26 UTC
Please define "broken" - you get errors while trying to merge something, compile on your own?
Comment 8 Luke-Jr 2010-04-17 21:17:53 UTC
I define "broken" as not complying with the relevant specifications, in this case the ELF format. A symptom of this brokenness is that non-threaded applications using libprotobuf will fail to link, including autoconf tests.

To test: ldd /usr/lib/ | grep pthread || echo BROKEN
Comment 9 Krzysztof Pawlik (RETIRED) gentoo-dev 2010-04-17 21:25:01 UTC
ELF file format has exactly nothing to do with what you're suggesting here.

Your problem seems to be coming from misunderstanding how programs/libraries depend on each other. There are some possibilities:
 * use pkg-config to find paths and libraries (and in fact this is the thing that you should do for any package/library that installs pkg-config file)
 * use -lpthread on your command line

If you still feel that there's a problem with protobuf's Makefile (linking actually) please report this upstream.
Comment 10 Luke-Jr 2010-04-17 21:52:35 UTC
Please review section 5-19 of the ELF specification:
Comment 11 Luke-Jr 2010-04-17 21:58:07 UTC
For reference, the upstream bug is
Comment 12 Krzysztof Pawlik (RETIRED) gentoo-dev 2010-04-17 22:04:44 UTC
Luke: please don't reopen this bug. If you feel so strong about this problem please create a new issue at