I want to debug with CodeLLDB on CentOS 7, but get an error like this:
/home/xxx/.vscode/extensions/vadimcn.vscode-lldb-1.6.1/adapter/codelldb: /lib64/libc.so.6: version `GLIBC_2.18' not found (required by /home/xxx/.vscode/extensions/vadimcn.vscode-lldb-1.6.1/adapter/codelldb)
LLDB requires a higher version of glibc.
I get it work by the following steps:
wget http://mirrors.ustc.edu.cn/gnu/libc/glibc-2.18.tar.gz
tar xvf glibc-2.18.tar.gz
cd glibc-2.18 && mkdir build && cd build
unset LD_LIBRARY_PATH # unset LD_LIBRARY_PATH or building glibc could cause error
../configure --prefix=/opt/glibc-2.18 --disable-profile --enable-add-ons --with-headers=/usr/include --with-binutils=/usr/bin
make -j8
make install
# cat patch-vs-codelldb.sh
# Reference: https://github.com/vadimcn/codelldb/issues/268
# Install patchelf: https://github.com/NixOS/patchelf#compiling-and-testing
#set -x
HOME_DIR="/path/to/your/home"
LLDB_VER="1.6.10"
LLDB_PATH="/${HOME_DIR}/.vscode-server/extensions/vadimcn.vscode-lldb-$LLDB_VER"
PATCH_ELF="/opt/patchelf"
GLIBC_PATH="/opt/glibc-2.18"
for f in `find "$LLDB_PATH" -perm /+x -type f`; do
#echo "$PATCH_ELF --set-interpreter $GLIBC_PATH/lib/ld-linux-x86-64.so.2 $f"
$PATCH_ELF --set-interpreter $GLIBC_PATH/lib/ld-linux-x86-64.so.2 $f
$PATCH_ELF --set-rpath $LLDB_PATH/lldb/lib:$GLIBC_PATH/lib:/usr/local/lib64:/usr/local/lib:/lib64:/usr/lib64 $f
done
for f in `find "$LLDB_PATH" -name '*.so*' `; do
#echo " so file: $f"
#echo "$PATCH_ELF --set-rpath $LLDB_PATH/lldb/lib:$GLIBC_PATH/lib:/lib64:/usr/lib64 $f"
$PATCH_ELF --set-rpath $LLDB_PATH/lldb/lib:$GLIBC_PATH/lib:/lib64:/usr/lib64 $f
done
To build glibc, the configuration file may fail with a
make
check. The check is not able to recognize gnu make 4 or newer. Edit theconfigure
file, line 4775 fromto