This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: [DSO missing from command line] gcc-c++ error
- From: Xi Ruoyao <xry111 at mengyan1223 dot wang>
- To: Segher Boessenkool <segher at kernel dot crashing dot org>, Vassilena Treneva <treneva at gmail dot com>
- Cc: gcc-help at gcc dot gnu dot org
- Date: Sat, 21 Sep 2019 01:48:37 +0800
- Subject: Re: [DSO missing from command line] gcc-c++ error
- References: <CAG6hjyVDdc7DO0tye=LNLM4e9yZMEAjFEdmmqwy4kWfCcTXwFQ@mail.gmail.com> <20190920105756.GP9749@gate.crashing.org> <CAG6hjyXQABPVAuEfbzvxeFrZr==2cwZ2a51kjcU68Rb89wHkpg@mail.gmail.com> <20190920152446.GQ9749@gate.crashing.org>
- Reply-to: gcc-help at gcc dot gnu dot org
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