@@ -53,7 +53,7 @@ if [ "$OS_ID" != "alpine" ]; then
53
53
libstdcpp_paths=$( /sbin/ldconfig -p | grep ' libstdc++.so.6' )
54
54
55
55
if [ " $( echo " $libstdcpp_paths " | wc -l) " -gt 1 ]; then
56
- libstdcpp_path=$( echo " $libstdcpp_paths " | grep " $LDCONFIG_ARCH " | awk ' {print $NF}' | head -n1 )
56
+ libstdcpp_path=$( echo " $libstdcpp_paths " | grep " $LDCONFIG_ARCH " | awk ' {print $NF}' )
57
57
else
58
58
libstdcpp_path=$( echo " $libstdcpp_paths " | awk ' {print $NF}' )
59
59
fi
@@ -72,18 +72,22 @@ if [ -z "$libstdcpp_path" ]; then
72
72
fi
73
73
fi
74
74
75
- if [ -n " $libstdcpp_path " ]; then
75
+ while [ -n " $libstdcpp_path " ]; do
76
76
# Extracts the version number from the path, e.g. libstdc++.so.6.0.22 -> 6.0.22
77
77
# which is then compared based on the fact that release versioning and symbol versioning
78
78
# are aligned for libstdc++. Refs https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html
79
79
# (i-e) GLIBCXX_3.4.<release> is provided by libstdc++.so.6.y.<release>
80
- libstdcpp_real_path=$( readlink -f " $libstdcpp_path " )
80
+ libstdcpp_path_line=$( echo " $libstdcpp_path " | head -n1)
81
+ libstdcpp_real_path=$( readlink -f " $libstdcpp_path_line " )
81
82
libstdcpp_version=$( echo " $libstdcpp_real_path " | awk -F' \\.so\\.' ' {print $NF}' )
82
83
if [ " $( printf ' %s\n' " 6.0.25" " $libstdcpp_version " | sort -V | head -n1) " = " 6.0.25" ]; then
83
84
found_required_glibcxx=1
84
- else
85
- echo " Warning: Missing GLIBCXX >= 3.4.25! from $libstdcpp_real_path "
85
+ break
86
86
fi
87
+ libstdcpp_path=$( echo " $libstdcpp_path " | tail -n +2) # remove first line
88
+ done
89
+ if [ " $found_required_glibcxx " = " 0" ]; then
90
+ echo " Warning: Missing GLIBCXX >= 3.4.25! from $libstdcpp_real_path "
87
91
fi
88
92
89
93
if [ " $OS_ID " = " alpine" ]; then
@@ -105,7 +109,7 @@ elif [ -z "$(ldd --version 2>&1 | grep 'musl libc')" ]; then
105
109
libc_paths=$( /sbin/ldconfig -p | grep ' libc.so.6' )
106
110
107
111
if [ " $( echo " $libc_paths " | wc -l) " -gt 1 ]; then
108
- libc_path=$( echo " $libc_paths " | grep " $LDCONFIG_ARCH " | awk ' {print $NF}' | head -n1 )
112
+ libc_path=$( echo " $libc_paths " | grep " $LDCONFIG_ARCH " | awk ' {print $NF}' )
109
113
else
110
114
libc_path=$( echo " $libc_paths " | awk ' {print $NF}' )
111
115
fi
@@ -119,16 +123,20 @@ elif [ -z "$(ldd --version 2>&1 | grep 'musl libc')" ]; then
119
123
echo " Warning: Can't find libc.so or ldconfig, can't verify libc version"
120
124
fi
121
125
122
- if [ -n " $libc_path " ]; then
126
+ while [ -n " $libc_path " ]; do
123
127
# Rather than trusting the output of ldd --version (which is not always accurate)
124
128
# we instead use the version of the cached libc.so.6 file itself.
125
- libc_real_path=$( readlink -f " $libc_path " )
129
+ libc_path_line=$( echo " $libc_path " | head -n1)
130
+ libc_real_path=$( readlink -f " $libc_path_line " )
126
131
libc_version=$( cat " $libc_real_path " | sed -n ' s/.*release version \([0-9]\+\.[0-9]\+\).*/\1/p' )
127
132
if [ " $( printf ' %s\n' " 2.28" " $libc_version " | sort -V | head -n1) " = " 2.28" ]; then
128
133
found_required_glibc=1
129
- else
130
- echo " Warning: Missing GLIBC >= 2.28! from $libc_real_path "
134
+ break
131
135
fi
136
+ libc_path=$( echo " $libc_path " | tail -n +2) # remove first line
137
+ done
138
+ if [ " $found_required_glibc " = " 0" ]; then
139
+ echo " Warning: Missing GLIBC >= 2.28! from $libc_real_path "
132
140
fi
133
141
else
134
142
echo " Warning: musl detected, skipping GLIBC check"
0 commit comments