undefined reference to symbol 'pthread_rwlock_wrlock@@GLIBC_2.2.5'

4,497 views
Skip to first unread message

Duy Huynh

unread,
Sep 20, 2014, 4:07:30 AM9/20/14
to caffe...@googlegroups.com
hi there,

caffe was working fine for me on ubuntu 12.04.  i did an upgrade to ubuntu 14.04 today.  i just tried to 'make all' to rebuild the code, and got this error.  does anyone know how to fix this issue?

thanks!
dh

/usr/bin/g++-4.6 .build_release/examples/mnist/convert_mnist_data.o .build_release/lib/libcaffe.a -o .build_release/examples/mnist/convert_mnist_data.bin -fPIC -DNDEBUG -O2 -I/usr/include/python2.7 -I/usr/lib/python2.7/dist-packages/numpy/core/include -I/usr/local/include -I.build_release/src -I./src -I./include -I/usr/local/cuda/include -Wall -Wno-sign-compare -L/usr/lib -L/usr/local/lib -L/usr/lib -L/usr/local/cuda/lib64 -L/usr/local/cuda/lib -lcudart -lcublas -lcurand -lpthread -lglog -lgflags -lprotobuf -lleveldb -lsnappy -llmdb -lboost_system -lhdf5_hl -lhdf5 -lopencv_core -lopencv_highgui -lopencv_imgproc -lboost_thread -lcblas -latlas
/usr/bin/ld: /usr/local/lib/libgflags.a(gflags.cc.o): undefined reference to symbol 'pthread_rwlock_wrlock@@GLIBC_2.2.5'
/lib/x86_64-linux-gnu/libpthread.so.0: error adding symbols: DSO missing from command line
collect2: ld returned 1 exit status
make: *** [.build_release/examples/mnist/convert_mnist_data.bin] Error 1

Cliff Woolley

unread,
Sep 20, 2014, 10:36:46 AM9/20/14
to Duy Huynh, caffe...@googlegroups.com

Just rebuild your libgflags with your new Ubuntu version's gcc (and glibc, by extension), and the error should go away.

--
You received this message because you are subscribed to the Google Groups "Caffe Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to caffe-users...@googlegroups.com.
To post to this group, send email to caffe...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/caffe-users/5734d038-30da-43f2-bb78-8fe628500561%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Bernardino Romera Paredes

unread,
Sep 21, 2014, 8:43:32 PM9/21/14
to caffe...@googlegroups.com, duy.hu...@gmail.com
Hi, I have the same problem after doing an update. I have rebuilt the libflags but still got the same error.
Thanks.

Duy Huynh

unread,
Sep 21, 2014, 9:13:44 PM9/21/14
to Bernardino Romera Paredes, caffe...@googlegroups.com
hey bernrdio, i finally got it working.  i just removed all the built files and did a fresh build again. 

Bernardino Romera Paredes

unread,
Sep 22, 2014, 5:46:48 AM9/22/14
to caffe...@googlegroups.com, bern...@gmail.com
I did that as well, but it does not work for me, I still got the same error.

kv

unread,
Sep 22, 2014, 11:21:14 PM9/22/14
to caffe...@googlegroups.com, bern...@gmail.com

Hi,
I encountered the same problem, and I referred to this http://stackoverflow.com/questions/19901934/strange-linking-error-dso-missing-from-command-line.
Just change the order of -lpthread and work.

Bernardino Romera Paredes

unread,
Sep 23, 2014, 6:24:39 AM9/23/14
to caffe...@googlegroups.com, bern...@gmail.com
That works, thanks!

andy nu

unread,
Oct 3, 2014, 4:05:03 PM10/3/14
to caffe...@googlegroups.com, bern...@gmail.com
Hi Bernardino,

I'm experiencing this error too, but I'm afraid I'm not following how to apply the suggestion from stack overflow to the caffe/Makefile. Could you share what you changed?

Thanks

Bernardino Romera Paredes

unread,
Oct 3, 2014, 9:57:22 PM10/3/14
to caffe...@googlegroups.com, bern...@gmail.com
Hi Andy,

What I did was to edit the Makefile to change the order of LIBRARIES (line 168), so that pthread now appears at the end rather than at the beginning:

LIBRARIES += glog gflags protobuf leveldb snappy \
    lmdb \
    boost_system \
    hdf5_hl hdf5 \
    opencv_core opencv_highgui opencv_imgproc \
    pthread

Hope it works for you.

andy nu

unread,
Oct 6, 2014, 8:31:49 AM10/6/14
to caffe...@googlegroups.com, bern...@gmail.com
Wonderful!  That worked. Thank you for the details.
Reply all
Reply to author
Forward
0 new messages