This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [DSO missing from command line] gcc-c++ error


On 2019-09-20 10:24 -0500, Segher Boessenkool wrote:
> [ Please don't top-post. ]
> 
> On Fri, Sep 20, 2019 at 06:16:45PM +0300, Vassilena Treneva wrote:
> > On Fri, Sep 20, 2019 at 1:58 PM Segher Boessenkool <
> > segher@kernel.crashing.org> wrote:
> > > On Fri, Sep 20, 2019 at 01:42:21PM +0300, Vassilena Treneva wrote:
> > > > I am using the same versions of gcc-c++ and glibc (gcc-c++ 4.8.5 & glibc
> > > > 2.17) on RHEL7 and CENTOS7, but I get a compile time error ONLY on
> > > CENTOS7:
> > > > /usr/bin/ld: CMakeFiles/GTest.Test.dir/gtest/gtest-all.cc.o: *undefined
> > > > reference to symbol 'pthread_key_delete@@GLIBC_2.2.5'*
> > > > //usr/lib64/libpthread.so.0:
> > > > *error adding symbols: DSO missing from command line*
> > > 
> > > It says you should have -lpthread on your link command line.  Do you?
> > 
> > Yes, I think I have the proper flag added.
> > 
> > CMAKE file looks like this:
> > 
> > SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Werror=maybe-uninitialized
> > -std=gnu++0x --coverage -fprofile-arcs -ftest-coverage -lpthread")
> 
> But does it show up on the link command line, and where?  What actual
> command is run?
> 
> Maybe you should ask this question on some CMake list or forum?

I guess CMAKE_CXX_LINK_FLAGS need to be set to include -pthread.

I always find cmake difficult to be used :(.
-- 
Xi Ruoyao <xry111@mengyan1223.wang>
School of Aerospace Science and Technology, Xidian University


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]