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

  1. download clangd precompiled binaries,such as wget https://github.com/clangd/clangd/releases/download/14.0.3/clangd-linux-14.0.3.zip

  2. unzip the compressed package,you will get a folder with the following directory structure:

    image

  3. try running bin/clangd --version, the normal result is as follows:

    image

  4. set the path of clangd

    image

  5. 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

    image image

Problems

  1. Error GLIBC_2.18 not found when trying to run bin/clangd --version

    image

    You need to upgrade glibc, this is a dangerous operation that may make the system unusable, here is an upgrade reference:

    1. wget https://mirrors.tuna.tsinghua.edu.cn/gnu/glibc/glibc-2.18.tar.gz

    2. tar -xf glibc-2.18.tar.gz && cd glibc-2.18 && mkdir build && cd build

    3. ../configure --prefix=/usr --disable-profile --enable-add-ons --with-headers=/usr/include --with-binutils=/usr/bin

    4. make -j8 && sudo make install

  2. 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:

    image

  3. 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}"
              },
          ]
        }
    

    image image