How to develop impala be code using vscode plugins - MicePilot/vscode-impala-pack GitHub Wiki
How to develop impala be code using vscode plugins
The best way to develop c++ in vscode is to use clangd,clangd is a c++ language server,used by many IDEs including clion. We just need to install clangd on the host and install a plugin called clangd in vscode to use it. All plugins mentioned in this article are already included in vscode-impala-pack.
Steps
-
download clangd precompiled binaries,such as
wget https://github.com/clangd/clangd/releases/download/14.0.3/clangd-linux-14.0.3.zip
-
unzip the compressed package,you will get a folder with the following directory structure:
-
try running
bin/clangd --version
, the normal result is as follows: -
set the path of clangd
-
restart vscode and open the c++ file in impala be,you can see that clangd is building the index. when the index is built, use ctrl/control + left mouse button to jump to the code
Problems
-
Error
GLIBC_2.18 not found
when trying to runbin/clangd --version
You need to upgrade glibc, this is a dangerous operation that may make the system unusable, here is an upgrade reference:
-
wget https://mirrors.tuna.tsinghua.edu.cn/gnu/glibc/glibc-2.18.tar.gz
-
tar -xf glibc-2.18.tar.gz && cd glibc-2.18 && mkdir build && cd build
-
../configure --prefix=/usr --disable-profile --enable-add-ons --with-headers=/usr/include --with-binutils=/usr/bin
-
make -j8 && sudo make install
-
-
Can't make code jump
You have to wait for the index build to finish, if clangd is not building, or clangd is not started for unknown reasons, you can restart it using the vscode command:
-
How to debug
Use the codelldb plugin,edit the .vscode/launch.json file in the project directory and add the following settings,then start the impala cluster and select the debug window attach in vscode to debug:
{ "version": "0.2.0", "configurations": [ { "type": "lldb", "name": "lldb BE Debug (Attach) - Process impalad", "request": "attach", "program": "/opt/impala/impala/be/build/latest/service/impalad", "pid": "${command:pickProcess}" }, ] }