Skip to content

Commit bc0021e

Browse files
analysisjpruchej
authored andcommitted
fixed webui.sh issue that occurred in WSL environment (fix: AUTOMATIC1111#14883)
1 parent 8494d4d commit bc0021e

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

webui.sh

+5-7
Original file line numberDiff line numberDiff line change
@@ -228,9 +228,7 @@ fi
228228
prepare_tcmalloc() {
229229
if [[ "${OSTYPE}" == "linux"* ]] && [[ -z "${NO_TCMALLOC}" ]] && [[ -z "${LD_PRELOAD}" ]]; then
230230
# check glibc version
231-
LIBC_LIB="$(PATH=/usr/sbin:$PATH ldconfig -p | grep -P "libc.so.6" | head -n 1)"
232-
LIBC_INFO=$(echo ${LIBC_LIB} | awk '{print $NF}')
233-
LIBC_VER=$(echo $(${LIBC_INFO} | awk 'NR==1 {print $NF}') | grep -oP '\d+\.\d+')
231+
LIBC_VER=$(echo $(ldd --version | awk 'NR==1 {print $NF}') | grep -oP '\d+\.\d+')
234232
echo "glibc version is $LIBC_VER"
235233
libc_vernum=$(expr $LIBC_VER)
236234
# Since 2.34 libpthread is integrated into libc.so
@@ -245,9 +243,9 @@ prepare_tcmalloc() {
245243
TC_INFO=(${TCMALLOC//=>/})
246244
if [[ ! -z "${TC_INFO}" ]]; then
247245
echo "Check TCMalloc: ${TC_INFO}"
248-
# Determine if the library is linked to libptthread and resolve undefined symbol: ptthread_key_create
246+
# Determine if the library is linked to libpthread and resolve undefined symbol: pthread_key_create
249247
if [ $(echo "$libc_vernum < $libc_v234" | bc) -eq 1 ]; then
250-
# glibc < 2.33 pthread_key_create into libpthead.so. check linking libpthread.so...
248+
# glibc < 2.34 pthread_key_create into libpthread.so. check linking libpthread.so...
251249
if ldd ${TC_INFO[2]} | grep -q 'libpthread'; then
252250
echo "$TC_INFO is linked with libpthread,execute LD_PRELOAD=${TC_INFO[2]}"
253251
# set fullpath LD_PRELOAD (To be on the safe side)
@@ -257,7 +255,7 @@ prepare_tcmalloc() {
257255
echo "$TC_INFO is not linked with libpthread will trigger undefined symbol: pthread_Key_create error"
258256
fi
259257
else
260-
# Version 2.34 of libc.so (glibc) includes the pthead library IN GLIBC. (USE ubuntu 22.04 and modern linux system and WSL)
258+
# Version 2.34 of libc.so (glibc) includes the pthread library IN GLIBC. (USE ubuntu 22.04 and modern linux system and WSL)
261259
# libc.so(glibc) is linked with a library that works in ALMOST ALL Linux userlands. SO NO CHECK!
262260
echo "$TC_INFO is linked with libc.so,execute LD_PRELOAD=${TC_INFO[2]}"
263261
# set fullpath LD_PRELOAD (To be on the safe side)
@@ -267,7 +265,7 @@ prepare_tcmalloc() {
267265
fi
268266
done
269267
if [[ -z "${LD_PRELOAD}" ]]; then
270-
printf "\e[1m\e[31mCannot locate TCMalloc. Do you have tcmalloc or gperftools installed on your system? (improves CPU memory usage)\e[0m\n"
268+
printf "\e[1m\e[31mCannot locate TCMalloc. Do you have tcmalloc or google-perftool installed on your system? (improves CPU memory usage)\e[0m\n"
271269
fi
272270
fi
273271
}

0 commit comments

Comments
 (0)