Bug 813825 - [Patch] gtest does not properly link against pthread
Summary: [Patch] gtest does not properly link against pthread
Alias: None
Product: Fedora
Classification: Fedora
Component: gtest
Version: 16
Hardware: Unspecified
OS: Unspecified
Target Milestone: ---
Assignee: Akira TAGOH
QA Contact: Fedora Extras Quality Assurance
Depends On:
TreeView+ depends on / blocked
Reported: 2012-04-18 14:00 UTC by Tim Niemueller
Modified: 2012-10-16 09:18 UTC (History)
2 users (show)

Fixed In Version: gtest-1.6.0-1.fc18
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2012-10-16 09:18:42 UTC
Type: Bug

Attachments (Terms of Use)
Patch to fix linker problem (2.84 KB, patch)
2012-04-18 14:00 UTC, Tim Niemueller
no flags Details | Diff

Description Tim Niemueller 2012-04-18 14:00:43 UTC
Created attachment 578363 [details]
Patch to fix linker problem

Description of problem:
When trying to build PCL 1.5 (package pcl) on F-16 I get the following errors:
/usr/lib/gcc/x86_64-redhat-linux/4.6.2/../../../../lib64/libgtest.so: undefined reference to `pthread_key_create'
/usr/lib/gcc/x86_64-redhat-linux/4.6.2/../../../../lib64/libgtest.so: undefined reference to `pthread_getspecific'
/usr/lib/gcc/x86_64-redhat-linux/4.6.2/../../../../lib64/libgtest.so: undefined reference to `pthread_key_delete'
/usr/lib/gcc/x86_64-redhat-linux/4.6.2/../../../../lib64/libgtest.so: undefined reference to `pthread_setspecific'

This is caused by gtest not properly linking against pthread. The attached patch applies to the recent master of the gtest package repository (git am) and adds "-lpthread" to the link libraries.

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. Get src rpm from http://koji.fedoraproject.org/koji/buildinfo?buildID=311730
2. rpmbuild --rebuild pcl-1.5-1.src.rpm

Actual results:
Linker errors.

Expected results:
Successful build.

Additional info:
The patch adds a minimal patch to add the -lpthread flag.

Comment 1 Tim Niemueller 2012-09-27 17:24:27 UTC
Any idea if and when you fix this? Or has this been fixed?

Comment 2 Akira TAGOH 2012-09-28 03:01:34 UTC
Well, this issue seems not happening when building with cmake which is recommended way. new upstream version is also available but "make test" seems not passed. I'm trying to see what's wrong.

Comment 3 Fedora Update System 2012-09-28 09:18:50 UTC
gtest-1.6.0-1.fc18 has been submitted as an update for Fedora 18.

Comment 4 Fedora Update System 2012-09-28 09:34:30 UTC
gtest-1.6.0-1.fc17 has been submitted as an update for Fedora 17.

Comment 5 Fedora Update System 2012-09-28 09:35:19 UTC
gtest-1.6.0-1.fc16 has been submitted as an update for Fedora 16.

Comment 6 Terje Røsten 2012-09-28 10:28:54 UTC

can you provide some feedback on comment  #1 in

Comment 7 Akira TAGOH 2012-09-28 11:10:57 UTC
Hmm, given that they think there are the violation of the ODR in gtest itself, roughly speaking, IMHO API is to protect this case. if they give up to maintain their APIs and address some conflict then, hmm, yeah, it may be better stop shipping it in Fedora perhaps. fortunately mozc doesn't require gtest anymore. I don't mind either.

Anyway, I guess it's not introduced by 1.6.0 but just they realized and stopped "make install" since. so it should be a separate issue so far.

I'm wondering if it can be avoided with shipping the static library only?

We should open an another bug for that maybe.

Comment 8 Akira TAGOH 2012-09-28 11:15:45 UTC
FWIW I haven't ever tried to write any test cases with it. so I may be wrong.

Comment 9 Tim Niemueller 2012-09-28 11:29:45 UTC
From my side all I asked for was linking against pthread. It seems stupid to have a library that you cannot ship prebuilt. Is there a link to the reasoning behind this?

Comment 10 Akira TAGOH 2012-09-28 12:36:51 UTC
I think the above bugzilla link explains all. in addition to, if you aren't sure what's the One Definition Rule, http://en.wikipedia.org/wiki/One_Definition_Rule.

Comment 11 Fedora Update System 2012-09-28 17:22:52 UTC
Package gtest-1.6.0-1.fc18:
* should fix your issue,
* was pushed to the Fedora 18 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing gtest-1.6.0-1.fc18'
as soon as you are able to.
Please go to the following url:
then log in and leave karma (feedback).

Comment 12 Akira TAGOH 2012-10-16 09:18:42 UTC
dunno why this bug wasn't closed even though the updated package has already been pushed to the stable. anyway closing.

Note You need to log in before you can comment on or make changes to this bug.