public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* [DSO missing from command line] gcc-c++ error
@ 2019-09-20 10:42 Vassilena Treneva
  2019-09-20 10:58 ` Segher Boessenkool
  0 siblings, 1 reply; 5+ messages in thread
From: Vassilena Treneva @ 2019-09-20 10:42 UTC (permalink / raw)
  To: gcc-help

Hey Guys,

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*
I am looking for hints what could be wrong...
The versions appear to be absolutely the same, so I it makes no sense to
me....

Some info about the versions:

CENTOS:

[vmtest@sofumcentos07 ~]$ sudo yum info glibc
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirror.wwfx.net
* extras: mirror.wwfx.net
* updates: mirror.wwfx.net
Installed Packages
Name        : glibc
Arch        : x86_64
Version     : 2.17
Release     : 292.el7
Size        : 13 M
Repo        : installed
From repo   : base
Summary     : The GNU libc libraries
URL         : http://www.gnu.org/software/glibc/
License     : LGPLv2+ and LGPLv2+ with exceptions and GPLv2+
Description : The glibc package contains standard libraries which are used
by
            : multiple programs on the system. In order to save disk space
and
            : memory, as well as to make upgrading easier, common system
code is
            : kept in one place and shared between programs. This
particular package
            : contains the most important sets of shared libraries: the
standard C
            : library and the standard math library. Without these two
libraries, a
            : Linux system will not function.

[vmtest@sofumcentos07 ~]$ cat /etc/*release*
CentOS Linux release 7.7.1908 (Core)
Derived from Red Hat Enterprise Linux 7.7 (Source)
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"

CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"

CentOS Linux release 7.7.1908 (Core)
CentOS Linux release 7.7.1908 (Core)
cpe:/o:centos:centos:7


[vmtest@sofumcentos07 ~]$ sudo yum info gcc-c++
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirror.wwfx.net
* extras: mirror.wwfx.net
* updates: mirror.wwfx.net
Installed Packages
Name        : gcc-c++
Arch        : x86_64
Version     : 4.8.5
Release     : 39.el7
Size        : 16 M
Repo        : installed
From repo   : base
Summary     : C++ support for GCC
URL         : http://gcc.gnu.org
License     : GPLv3+ and GPLv3+ with exceptions and GPLv2+ with exceptions
and LGPLv2+ and BSD
Description : This package adds C++ support to the GNU Compiler Collection.
            : It includes support for most of the current C++ specification,
            : including templates and exception handling.

RHEL:

[vmtest@sofumcentos07 ~]$ sudo yum info glibc
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirror.wwfx.net
* extras: mirror.wwfx.net
* updates: mirror.wwfx.net
Installed Packages
Name        : glibc
Arch        : x86_64
Version     : 2.17
Release     : 292.el7
Size        : 13 M
Repo        : installed
From repo   : base
Summary     : The GNU libc libraries
URL         : http://www.gnu.org/software/glibc/
License     : LGPLv2+ and LGPLv2+ with exceptions and GPLv2+
Description : The glibc package contains standard libraries which are used
by
            : multiple programs on the system. In order to save disk space
and
            : memory, as well as to make upgrading easier, common system
code is
            : kept in one place and shared between programs. This
particular package
            : contains the most important sets of shared libraries: the
standard C
            : library and the standard math library. Without these two
libraries, a
            : Linux system will not function.


[vmtest@sofumrhel07 ~]$ cat /etc/*release*
NAME="Red Hat Enterprise Linux Server"
VERSION="7.0 (Maipo)"
ID="rhel"
ID_LIKE="fedora"
VERSION_ID="7.0"
PRETTY_NAME="Red Hat Enterprise Linux"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:redhat:enterprise_linux:7.0:GA:server"
HOME_URL="https://www.redhat.com/"
BUG_REPORT_URL="https://bugzilla.redhat.com/"

REDHAT_BUGZILLA_PRODUCT="Red Hat Enterprise Linux 7"
REDHAT_BUGZILLA_PRODUCT_VERSION=7.0
REDHAT_SUPPORT_PRODUCT="Red Hat Enterprise Linux"
REDHAT_SUPPORT_PRODUCT_VERSION=7.0
Red Hat Enterprise Linux Server release 7.0 (Maipo)
Red Hat Enterprise Linux Server release 7.0 (Maipo)
cpe:/o:redhat:enterprise_linux:7.0:ga:server


[vmtest@sofumrhel07 ~]$ sudo yum info gcc-c++
[sudo] password for vmtest:
Loaded plugins: langpacks, product-id, subscription-manager
Installed Packages
Name        : gcc-c++
Arch        : x86_64
Version     : 4.8.5
Release     : 39.el7
Size        : 16 M
Repo        : installed
From repo   : rhel-7-server-rpms
Summary     : C++ support for GCC
URL         : http://gcc.gnu.org
License     : GPLv3+ and GPLv3+ with exceptions and GPLv2+ with exceptions
and LGPLv2+ and BSD
Description : This package adds C++ support to the GNU Compiler Collection.
            : It includes support for most of the current C++ specification,
            : including templates and exception handling.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [DSO missing from command line] gcc-c++ error
  2019-09-20 10:42 [DSO missing from command line] gcc-c++ error Vassilena Treneva
@ 2019-09-20 10:58 ` Segher Boessenkool
  2019-09-20 15:17   ` Vassilena Treneva
  0 siblings, 1 reply; 5+ messages in thread
From: Segher Boessenkool @ 2019-09-20 10:58 UTC (permalink / raw)
  To: Vassilena Treneva; +Cc: gcc-help

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?

(Often this library is automatically linked to, but not always).


Segher

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [DSO missing from command line] gcc-c++ error
  2019-09-20 10:58 ` Segher Boessenkool
@ 2019-09-20 15:17   ` Vassilena Treneva
  2019-09-20 15:25     ` Segher Boessenkool
  0 siblings, 1 reply; 5+ messages in thread
From: Vassilena Treneva @ 2019-09-20 15:17 UTC (permalink / raw)
  To: Segher Boessenkool; +Cc: gcc-help

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")

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?
>
> (Often this library is automatically linked to, but not always).
>
>
> Segher
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [DSO missing from command line] gcc-c++ error
  2019-09-20 15:17   ` Vassilena Treneva
@ 2019-09-20 15:25     ` Segher Boessenkool
  2019-09-20 17:48       ` Xi Ruoyao
  0 siblings, 1 reply; 5+ messages in thread
From: Segher Boessenkool @ 2019-09-20 15:25 UTC (permalink / raw)
  To: Vassilena Treneva; +Cc: gcc-help

[ 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?


Segher

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [DSO missing from command line] gcc-c++ error
  2019-09-20 15:25     ` Segher Boessenkool
@ 2019-09-20 17:48       ` Xi Ruoyao
  0 siblings, 0 replies; 5+ messages in thread
From: Xi Ruoyao @ 2019-09-20 17:48 UTC (permalink / raw)
  To: Segher Boessenkool, Vassilena Treneva; +Cc: gcc-help

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-09-20 17:48 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-20 10:42 [DSO missing from command line] gcc-c++ error Vassilena Treneva
2019-09-20 10:58 ` Segher Boessenkool
2019-09-20 15:17   ` Vassilena Treneva
2019-09-20 15:25     ` Segher Boessenkool
2019-09-20 17:48       ` Xi Ruoyao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).