How to setup the Jet Brains IntelliJ IDEA and Jet Brains CLION IDE to code and debug StarRocks #25196
Closed
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
So you want to code and debug StarRocks, here's what you need to do.
Prerequisites
For this tutorial you need to:
Running StarRocks Front End in debug mode on your workstation
Personally I also install
jenv
andpyenv
so I can switch versions. I also runjenv enable-plugin export
so that my $JAVA_HOME is set correctly.Running StarRocks Front End and/or Back End in debug mode on a remote VM
Using Ubuntu 22.04 LTS. This is similar to the tutorial on compiling StarRocks; it just has additional packages.
Local StarRocks Front End Debugging
Since the frond end is a java application, just use debug it the same way as you would in any other java application.
Remote StarRocks Front End Debugging
On the Ubuntu VM, run
./start_fe.sh --debug
, then use IDEA remote debug to connect it. The default port is 5005, you can change it instart_fe.sh
scripts.Debug java parameter: -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005
Remote StarRocks Back End Debugging
It is recommended to run
mvn install -DskipTests
first infe
folder to ensure that thrift and protobuf in thegensrc
directory are compiled correctly.Then you need to enter
gensrc
folder, runmake clean
andmake
commands respectively, otherwise Clion can't detect thrift's output files.Use Clion to open
be
folder.Enter
Settings
, addToolchains
. Add a remote server first, then setup Build Tool, C and C++ Compiler separately.In
Settings
/Deployment
. Change foldermappings
.In
Settings
/Cmake
. Change Toolchain to be the remote toolchain just added. Add the following environment variables:Warning: Be careful not to check Include system environment variables.
![ide-4](https://private-user-images.githubusercontent.com/749093/245562309-a8e55cfb-df50-445e-ace3-a9812ee1b0ad.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjU1OTM2MTksIm5iZiI6MTcyNTU5MzMxOSwicGF0aCI6Ii83NDkwOTMvMjQ1NTYyMzA5LWE4ZTU1Y2ZiLWRmNTAtNDQ1ZS1hY2UzLWE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liNWMxMDQ0MGU5ODExZDMyZTVjNzk0NDM2ODJhYTI3NTlkOTA1YWM0ZDM5MDI4JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.6zK7IH1KM0NzpmzDDj7jnN2YAakJBmbTx4QaqLBOh1o)
Setup is now complete. Just wait for Clion and the remote server are synchronized and the code jump will work.
To star debugging the back end, ou have to use gdb. Modify the
start_backend.sh
fromto
Then just run
./bin/start_be.sh
without any flag.If you face the error report when debugging for lakehouse, just add
handle SIGSEGV nostop noprint pass
in ~/.gdbinit.Beta Was this translation helpful? Give feedback.
All reactions