gtest fuerte undefined reference when linking
Hey all,
After upgrading to ubuntu precise and fuerte I have a problem when linking my unit tests based on gtest. I get an undefined reference to pthread_key_create (see below). Seems this is a problem of gtest (http://osdir.com/ml/googletestframework/2011-10/msg00028.html)? It seems that pthread is located in /lib/i386-linux-gnu/ in stead of /usr/lib. (output of: "find /lib /usr/lib -name 'pthread'" is "/lib/i386-linux-gnu/libpthread.so.0 /lib/i386-linux-gnu/libpthread-2.15.so") This is also disturbing since I have a 64 bit system (output of "uname -m" is "x86_64")
Any idea what to do?
Tinne
/home/fiep/test/geometric_relations_semantics/geometric_semantics_kdl/lib/libgtest.a(gtest-all.cc.o): In function `testing::internal::ThreadLocal<testing::TestPartResultReporterInterface*>::CreateKey()':
/usr/include/gtest/internal/gtest-port.h:1365: undefined reference to `pthread_key_create'
/home/fiep/test/geometric_relations_semantics/geometric_semantics_kdl/lib/libgtest.a(gtest-all.cc.o): In function `testing::internal::ThreadLocal<std::vector<testing::internal::TraceInfo, std::allocator<testing::internal::TraceInfo> > >::CreateKey()':
/usr/include/gtest/internal/gtest-port.h:1365: undefined reference to `pthread_key_create'
/home/fiep/test/geometric_relations_semantics/geometric_semantics_kdl/lib/libgtest.a(gtest-all.cc.o): In function `~ThreadLocal':
/usr/include/gtest/internal/gtest-port.h:1336: undefined reference to `pthread_getspecific'
/usr/include/gtest/internal/gtest-port.h:1340: undefined reference to `pthread_key_delete'
/usr/include/gtest/internal/gtest-port.h:1336: undefined reference to `pthread_getspecific'
/usr/include/gtest/internal/gtest-port.h:1340: undefined reference to `pthread_key_delete'
/home/fiep/test/geometric_relations_semantics/geometric_semantics_kdl/lib/libgtest.a(gtest-all.cc.o): In function `testing::internal::ThreadLocal<testing::TestPartResultReporterInterface*>::GetOrCreateValue() const':
/usr/include/gtest/internal/gtest-port.h:1372: undefined reference to `pthread_getspecific'
/usr/include/gtest/internal/gtest-port.h:1379: undefined reference to `pthread_setspecific'
/usr/include/gtest/internal/gtest-port.h:1372: undefined reference to `pthread_getspecific'
/usr/include/gtest/internal/gtest-port.h:1379: undefined reference to `pthread_setspecific'
/home/fiep/test/geometric_relations_semantics/geometric_semantics_kdl/lib/libgtest.a(gtest-all.cc.o): In function `testing::internal::ThreadLocal<std::vector<testing::internal::TraceInfo, std::allocator<testing::internal::TraceInfo> > >::GetOrCreateValue() const':
/usr/include/gtest/internal/gtest-port.h:1372: undefined reference to `pthread_getspecific'
/usr/include/gtest/internal/gtest-port.h:1379: undefined reference to `pthread_setspecific'
/home/fiep/test/geometric_relations_semantics/geometric_semantics_kdl/lib/libgtest.a(gtest-all.cc.o): In function `~ThreadLocal':
/usr/include/gtest/internal/gtest-port.h:1336: undefined reference to `pthread_getspecific'
/usr/include/gtest/internal/gtest-port.h:1340: undefined reference to `pthread_key_delete'
/usr/include/gtest/internal/gtest-port.h:1336: undefined reference to `pthread_getspecific'
/usr/include/gtest/internal/gtest-port.h:1340: undefined reference to `pthread_key_delete'
/home/fiep/test/geometric_relations_semantics/geometric_semantics_kdl/lib/libgtest.a(gtest-all.cc.o): In function `testing::internal::ThreadLocal<std::vector<testing::internal::TraceInfo, std::allocator<testing::internal::TraceInfo> > >::GetOrCreateValue() const':
/usr/include/gtest/internal/gtest-port.h:1372: undefined reference to `pthread_getspecific'
/usr/include/gtest/internal/gtest-port.h:1379: undefined reference to `pthread_setspecific'
collect2: ld returned 1 exit status
make[4]: *** [../bin/utest_positionCoordinates] Error 1
make[4]: Target `CMakeFiles/utest_positionCoordinates.dir/build' not remade because of errors.
make[4]: Leaving directory `/home/fiep/test/geometric_relations_semantics/geometric_semantics_kdl/build'
make[3]: *** [CMakeFiles/utest_positionCoordinates.dir/all] Error 2
make[4]: Entering directory `/home/fiep/test/geometric_relations_semantics/geometric_semantics_kdl ...
I forgot to mention that this linking error does not occur on all my gtests. I have no idea however what the difference is between the different tests. Furthermore they are all part of the same ros package.