Alpine Linux library missing GLIBCXX in libstdc++.so

  alpine, c++, linux, makefile

I am trying to use Alpine Linux for a containerized C++ application. We are trying to switch from Ubuntu to Alpine Linux due to image size.

I encountered several errors in the C++ build process, and most of them were resolved by installing the appropriate package. I have finally reached a point where I cannot get past this particular error:

undefined reference to `operator new(unsigned long)@GLIBCXX_3.4'

Upon some research, I came upon a suggestion to check the /usr/lib/libstdc++.so.6.0.28 file for presence of GLIBCXX_3.4 using the following command, with the output:

bash-5.0# strings /usr/lib/libstdc++.so.6.0.28 | grep GLIBC
GLIBCXX_FORCE_NEW
GLIBCXX_DEBUG_MESSAGE_LENGTH

There’s not GLIBCXX_3.4 or any version of GLIBCXX or GLIBC.

Running the same command in Ubuntu yields the following:

 [email protected]:/app# strings /usr/lib/gcc/x86_64-linux-gnu/9/libstdc++.so | grep GLIB
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
GLIBCXX_3.4.20
GLIBCXX_3.4.21
GLIBCXX_3.4.22
GLIBCXX_3.4.23
GLIBCXX_3.4.24
GLIBCXX_3.4.25
GLIBCXX_3.4.26
GLIBCXX_3.4.27
GLIBCXX_3.4.28
GLIBC_2.2.5
GLIBC_2.3
GLIBC_2.14
GLIBC_2.6
GLIBC_2.4
GLIBC_2.18
GLIBC_2.16
GLIBC_2.3.4
GLIBC_2.17
GLIBC_2.3.2
GLIBCXX_DEBUG_MESSAGE_LENGTH

Clearly, Ubuntu seems to have all the GLIB versions. Can anyone help me with how to resolve this?

Thank you.

Source: Windows Questions C++

LEAVE A COMMENT