-
Notifications
You must be signed in to change notification settings - Fork 5.5k
build: Add Presto native C++ dev container #25358
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
base: master
Are you sure you want to change the base?
Changes from all commits
d942916
9f794c3
94254ff
dfd02fa
14b2f23
48f2b73
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| FROM presto/prestissimo-dependency:centos9 | ||
|
|
||
| # Install necesary packages to run dev containers in CLion | ||
| # https://www.jetbrains.com/help/clion/prerequisites-for-dev-containers.html#remote_container | ||
| RUN dnf -y update && dnf -y install epel-release | ||
| RUN dnf -y --skip-broken install \ | ||
unidevel marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| curl \ | ||
| unzip \ | ||
| procps \ | ||
| libXext \ | ||
| libXrender \ | ||
| libXtst \ | ||
| libXi \ | ||
| freetype \ | ||
| procps \ | ||
| java-17-openjdk-headless \ | ||
| python3.12 | ||
unidevel marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| RUN pip3 install pre-commit | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| # How to develop Presto C++ with dev-containers in CLion | ||
|
|
||
| > **_NOTE:_** For this to work you need CLion 2025.2.2 or greater. | ||
|
|
||
| If you can't build, or want to build the development environment on your machine, you can use dev-containers. With them, you can have your IDE frontend working against a CLion backend running on a docker container. To set it up, run the following command: | ||
|
|
||
| ```sh | ||
| docker compose build centos-native-dependency | ||
| ``` | ||
| Once the image is built, open the `presto-native-execution` module on CLion. | ||
|
|
||
| Right-click on `.devcontainer\devcontainer.json`, and in the contextual menu select `Dev Containers->Create Dev Container and mount sources...->CLion`. Wait for the container to be up and running before you continue. | ||
|
|
||
| The source code is mounted from your machine so any change made into it from the dev-container will also be on your machine. | ||
|
|
||
| ## Debug or execute `presto_server` | ||
|
|
||
| Reload CMake project and configure the `presto_server` executable. See [Setup Presto with IntelliJ IDEA and Prestissimo with CLion](https://github.com/prestodb/presto/tree/master/presto-native-execution#setup-presto-with-intellij-idea-and-prestissimo-with-clion). Compile the project as needed. | ||
|
|
||
| Then, execute the script `./devcontainer/install-shared-libs.sh` inside the container. This will create a directory `/runtime-libraries` and copy all the shared libraries needed for your compilation runtime in there. | ||
|
|
||
| Edit the `presto_server` configuration to add the environment variable `LD_LIBRARY_PATH=/runtime-libraries`. This way, you'll have the same environment as distributed prestissimo images. | ||
|
|
||
| ## Known errors | ||
| - In some cases an error such as `Computing backend... error. Collection contains no element matching the predicate` can appear. The feature is still in beta. In this case, the container will be created and running, but there might have been an issue starting the CLion backend inside the container. | ||
|
|
||
| To resolve this issue, close CLion and reopen it. | ||
|
|
||
| In the `Welcome to CLion` window go to `Remote Development (beta)->Dev Containers`. You should see that the container `Presto C++ Dev Container` is up and running, so connect to it. In this case, the backend should start properly and the project should be opened. | ||
|
|
||
| - In you can't use git inside the container, you need to manually add the mounted repo to the trusted directories for the dev-container | ||
| ```sh | ||
| git config --global --add safe.directory /workspace/presto | ||
| ``` |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| { | ||
| "name": "Presto C++ Dev Container", | ||
| "build": { | ||
| "dockerfile": "Dockerfile" | ||
| }, | ||
| "workspaceMount": "source=${localWorkspaceFolder}/..,target=/workspace/presto,type=bind", | ||
| "workspaceFolder": "/workspace/presto/presto-native-execution" | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| #!/bin/bash | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
| # Before executing this script, you should compile presto_server | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What happens if you don't. Will CLion throw an error?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, this is only to match the release environment, making sure that you're executing the server this the same libraries as the release version. This way, if your compilation lacks any library, you should see failures during the execution before the code is integrated into master |
||
| # Copy shared libs to the directory /runtime-libraries | ||
| mkdir /runtime-libraries && | ||
| bash -c '!(LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/lib:/usr/local/lib64 ldd ../cmake-build-debug/presto_cpp/main/presto_server | grep "not found")' && | ||
| LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/lib:/usr/local/lib64 ldd ../cmake-build-debug/presto_cpp/main/presto_server | awk 'NF == 4 { system("cp " $3 " /runtime-libraries") }' | ||
Uh oh!
There was an error while loading. Please reload this page.