./mongod: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by

283 views
Skip to first unread message

Amit Wankhede

unread,
May 7, 2019, 6:44:05 AM5/7/19
to mongodb-user
Hi

I'm trying to build mongo server code for mongo version 3.4 on CentOS 7.6 version. I've installed gcc version 5.5 and having python version 2.7.
The build was successful, but when finally mongo binary created it is showing below exception. Please suggest the solution for this.

buildscripts/scons.py mongod


#./mongod 

./mongod: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by ./mongod)

./mongod: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by ./mongod)

./mongod: /lib64/libstdc++.so.6: version `CXXABI_1.3.8' not found (required by ./mongod)


I've below version installed.


[root@installer-a mongo]# gcc --version

gcc (GCC) 5.5.0

Copyright (C) 2015 Free Software Foundation, Inc.

This is free software; see the source for copying conditions.  There is NO

warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


[root@installer-a mongo]# g++ --version

g++ (GCC) 5.5.0

Copyright (C) 2015 Free Software Foundation, Inc.

This is free software; see the source for copying conditions.  There is NO

warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.



# cat /etc/centos-release

CentOS Linux release 7.6.1810 (Core) 


[root@installer-a mongo]# rpm -qa | grep glibc

glibc-devel-2.17-260.el7_6.3.x86_64

glibc-common-2.17-260.el7_6.3.x86_64

glibc-headers-2.17-260.el7_6.3.x86_64

glibc-2.17-260.el7_6.3.x86_64

[root@installer-a mongo]# 


# strings /usr/lib64/libstdc++.so.6  | grep GLIBC

GLIBCXX_3.4

GLIBCXX_3.4.1

GLIBCXX_3.4.2

GLIBCXX_3.4.3

GLIBCXX_3.4.4

GLIBCXX_3.4.5

GLIBCXX_3.4.6

GLIBCXX_3.4.7

GLIBCXX_3.4.8

GLIBCXX_3.4.9

GLIBCXX_3.4.10

GLIBCXX_3.4.11

GLIBCXX_3.4.12

GLIBCXX_3.4.13

GLIBCXX_3.4.14

GLIBCXX_3.4.15

GLIBCXX_3.4.16

GLIBCXX_3.4.17

GLIBCXX_3.4.18

GLIBCXX_3.4.19

GLIBC_2.3

GLIBC_2.2.5

GLIBC_2.14

GLIBC_2.4

GLIBC_2.3.2

GLIBCXX_DEBUG_MESSAGE_LENGTH


# strings /usr/lib64/libstdc++.so.6  | grep CXX  | grep -v GLIB

CXXABI_1.3

CXXABI_1.3.1

CXXABI_1.3.2

CXXABI_1.3.3

CXXABI_1.3.4

CXXABI_1.3.5

CXXABI_1.3.6

CXXABI_1.3.7

CXXABI_TM_1


Andrew Morrow

unread,
May 7, 2019, 12:53:44 PM5/7/19
to mongod...@googlegroups.com

Hi -

I suspect that you have built against the GCC 5 libstdc++, but are attempting to run against the system libstdc++, which is a different version.

- Where did you obtain gcc5, and where is it installed?
- Could you please provide the complete SCons invocation you used to build the server?
- What is the output of ldd mongod
- If you run LD_LIBRARY_PATH=$(dirname $(/PATH/TO/YOUR/gcc -print-file-name=libstdc++.so)) mongod does it work?

Thanks,
Andrew


--
You received this message because you are subscribed to the Google Groups "mongodb-user"
group.
 
For other MongoDB technical support options, see: https://docs.mongodb.com/manual/support/
---
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-user...@googlegroups.com.
To post to this group, send email to mongod...@googlegroups.com.
Visit this group at https://groups.google.com/group/mongodb-user.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-user/af2317e5-3d57-4ad9-9219-24c8c6bac56c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Amit Wankhede

unread,
May 8, 2019, 6:18:08 AM5/8/19
to mongod...@googlegroups.com
Hi Andrew,

- Where did you obtain gcc5, and where is it installed?
Amit>> I got gcc 5.5 version from this location 

after this I follow step 3 "Install from Source" on CentOS

- Could you please provide the complete SCons invocation you used to build the server?
Amit>> I didn't capture this but, I'll try with lower version of gcc (5.4) and try once again

- What is the output of ldd mongod
Amit>>

# ldd ./mongod 

./mongod: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by ./mongod)

./mongod: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by ./mongod)

./mongod: /lib64/libstdc++.so.6: version `CXXABI_1.3.8' not found (required by ./mongod)

linux-vdso.so.1 =>  (0x00007fff39fe1000)

librt.so.1 => /lib64/librt.so.1 (0x00007f1aa4df2000)

libdl.so.2 => /lib64/libdl.so.2 (0x00007f1aa4bee000)

libstdc++.so.6 => /lib64/libstdc++.so.6 (0x00007f1aa48e7000)

libm.so.6 => /lib64/libm.so.6 (0x00007f1aa45e5000)

libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007f1aa43cf000)

libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f1aa41b3000)

libc.so.6 => /lib64/libc.so.6 (0x00007f1aa3de6000)

/lib64/ld-linux-x86-64.so.2 (0x00007f1aa7bda000)

[root@installer-a mongo]# 


- If you run LD_LIBRARY_PATH=$(dirname $(/PATH/TO/YOUR/gcc -print-file-name=libstdc++.so)) mongod does it work?
Amit>> Still it is not working

# LD_LIBRARY_PATH=$(dirname $(/usr/bin/gcc -print-file-name=libstdc++.so)) ./mongod

./mongod: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by ./mongod)

./mongod: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by ./mongod)

./mongod: /lib64/libstdc++.so.6: version `CXXABI_1.3.8' not found (required by ./mongod)

[root@installer-a mongo]# 


Andrew Morrow

unread,
May 8, 2019, 12:05:30 PM5/8/19
to mongod...@googlegroups.com

Hi -

I'm a little confused. It sounds like you built and installed your own GCC, but you invoked the system gcc binary to query the path to the C++ runtime library. What gcc binary did you use to build the server from source? What does that gcc binary say when called with -print-file-name=libstdc++.so?

Thanks,
Andrew


Amit Wankhede

unread,
May 9, 2019, 11:05:30 AM5/9/19
to mongod...@googlegroups.com
Hi Andrew,

Here is output.
Look like it built with lower version of gcc whereas mongod expecting higher version. I'm not sure, but I did install the gcc 5.5.

#/usr/bin/gcc -print-file-name=libstdc++.so

/usr/lib/gcc/x86_64-redhat-linux/4.8.5/libstdc++.so


Can you please provide pointers on gcc comptability for mongo 3.4 version


Regards,

Amit


Andrew Morrow

unread,
May 9, 2019, 10:14:27 PM5/9/19
to mongod...@googlegroups.com

To where did you install GCC 5?

Amit Wankhede

unread,
May 14, 2019, 3:44:11 AM5/14/19
to mongodb-user
Hi Andrew,

I've  again tried to build mongd for version 3.2 with gcc version 4.8. However, I'm still getting the same issue. Please find attached build log.


[root@localhost mongo]# gcc --version
gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-28)
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

[root@localhost mongo]# 


[root@localhost mongo]# g++ --version
g++ (GCC) 4.8.5 20150623 (Red Hat 4.8.5-28)
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

[root@localhost mongo]# ./mongod --verion
./mongod: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by ./mongod)
./mongod: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by ./mongod)
./mongod: /lib64/libstdc++.so.6: version `CXXABI_1.3.8' not found (required by ./mongod)


[root@localhost mongo]# 

Regards,
Amit
build_log

Andrew Morrow

unread,
May 14, 2019, 12:35:01 PM5/14/19
to mongod...@googlegroups.com

Hi -

At this point I'm really not sure what is going wrong for you. I suspect that your toolchain is misconfigured somehow. Can you compile and run other non-trivial C++ programs? Have you verified that building a hello world type thing produces a working binary?

Thanks,
Andrew


--
You received this message because you are subscribed to the Google Groups "mongodb-user"
group.
 
For other MongoDB technical support options, see: https://docs.mongodb.com/manual/support/
---
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-user...@googlegroups.com.
To post to this group, send email to mongod...@googlegroups.com.
Visit this group at https://groups.google.com/group/mongodb-user.

Amit Wankhede

unread,
May 15, 2019, 3:57:54 AM5/15/19
to mongodb-user
Hi Andrew,

I verified sample programs like helloWorld etc. they are working fine.

I'm following the procedure from mongo wiki. Can you please help, if there is some other procedure to build mongod and other.


Regards,
Amit

On Tuesday, May 7, 2019 at 4:14:05 PM UTC+5:30, Amit Wankhede wrote:

Andrew Morrow

unread,
May 15, 2019, 10:21:27 AM5/15/19
to mongod...@googlegroups.com

Hi -

At this point, I'm out of ideas unfortunately. If you are compiling against the system toolchain and getting that error at runtime, there is something broken with your toolchain or distro. Do you actually need to build MongoDB from source? If not, I'd suggest simply installing our pre-packaged versions, which should not have this issue: https://docs.mongodb.com/manual/tutorial/install-mongodb-on-red-hat/

Another possibility is building or installing a new compiler, but this comes with its own challenges.

Thanks,
Andrew


--
You received this message because you are subscribed to the Google Groups "mongodb-user"
group.
 
For other MongoDB technical support options, see: https://docs.mongodb.com/manual/support/
---
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-user...@googlegroups.com.
To post to this group, send email to mongod...@googlegroups.com.
Visit this group at https://groups.google.com/group/mongodb-user.

Robert Cochran

unread,
May 15, 2019, 12:57:00 PM5/15/19
to mongodb-user
Hi,

At a guess I wonder if this is an ldconfig issue, perhaps associated with LD_LIBRARY_PATH?

Having said that, I entirely agree with Andrew: don't bother compiling from source if your objective is to install MongoDB on a system. Just get the binaries and install those. Then go on your way and use MongoDB.

Getting a toolchain and build system to work well involves a great deal of effort. If your goal is to really use the database, the pre-built binaries represent a considerable time savings for the student.

Thanks so much

Bob
To unsubscribe from this group and stop receiving emails from it, send an email to mongod...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages