Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed webui.sh issue that occurred in WSL environment (fix: #14883) #14910

Merged
merged 1 commit into from
Feb 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions webui.sh
Original file line number Diff line number Diff line change
Expand Up @@ -227,9 +227,7 @@ fi
prepare_tcmalloc() {
if [[ "${OSTYPE}" == "linux"* ]] && [[ -z "${NO_TCMALLOC}" ]] && [[ -z "${LD_PRELOAD}" ]]; then
# check glibc version
LIBC_LIB="$(PATH=/usr/sbin:$PATH ldconfig -p | grep -P "libc.so.6" | head -n 1)"
LIBC_INFO=$(echo ${LIBC_LIB} | awk '{print $NF}')
LIBC_VER=$(echo $(${LIBC_INFO} | awk 'NR==1 {print $NF}') | grep -oP '\d+\.\d+')
LIBC_VER=$(echo $(ldd --version | awk 'NR==1 {print $NF}') | grep -oP '\d+\.\d+')
echo "glibc version is $LIBC_VER"
libc_vernum=$(expr $LIBC_VER)
# Since 2.34 libpthread is integrated into libc.so
Expand All @@ -244,9 +242,9 @@ prepare_tcmalloc() {
TC_INFO=(${TCMALLOC//=>/})
if [[ ! -z "${TC_INFO}" ]]; then
echo "Check TCMalloc: ${TC_INFO}"
# Determine if the library is linked to libptthread and resolve undefined symbol: ptthread_key_create
# Determine if the library is linked to libpthread and resolve undefined symbol: pthread_key_create
if [ $(echo "$libc_vernum < $libc_v234" | bc) -eq 1 ]; then
# glibc < 2.33 pthread_key_create into libpthead.so. check linking libpthread.so...
# glibc < 2.34 pthread_key_create into libpthread.so. check linking libpthread.so...
if ldd ${TC_INFO[2]} | grep -q 'libpthread'; then
echo "$TC_INFO is linked with libpthread,execute LD_PRELOAD=${TC_INFO[2]}"
# set fullpath LD_PRELOAD (To be on the safe side)
Expand All @@ -256,7 +254,7 @@ prepare_tcmalloc() {
echo "$TC_INFO is not linked with libpthread will trigger undefined symbol: pthread_Key_create error"
fi
else
# Version 2.34 of libc.so (glibc) includes the pthead library IN GLIBC. (USE ubuntu 22.04 and modern linux system and WSL)
# Version 2.34 of libc.so (glibc) includes the pthread library IN GLIBC. (USE ubuntu 22.04 and modern linux system and WSL)
# libc.so(glibc) is linked with a library that works in ALMOST ALL Linux userlands. SO NO CHECK!
echo "$TC_INFO is linked with libc.so,execute LD_PRELOAD=${TC_INFO[2]}"
# set fullpath LD_PRELOAD (To be on the safe side)
Expand All @@ -266,7 +264,7 @@ prepare_tcmalloc() {
fi
done
if [[ -z "${LD_PRELOAD}" ]]; then
printf "\e[1m\e[31mCannot locate TCMalloc. Do you have tcmalloc or gperftools installed on your system? (improves CPU memory usage)\e[0m\n"
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"
fi
fi
}
Expand Down
Loading