Skip to content

Commit 6f85027

Browse files
Added Presto c++ devcontainer
1 parent 108b3e9 commit 6f85027

File tree

4 files changed

+47
-50
lines changed

4 files changed

+47
-50
lines changed
Lines changed: 15 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,15 @@
1-
# Presto native Dev Container Dockerfile
2-
3-
# Set base image
4-
FROM quay.io/centos/centos:stream9
5-
6-
ENV PROMPT_ALWAYS_RESPOND=y
7-
# Install necessary packages
8-
RUN dnf config-manager --enable crb
9-
RUN dnf update && dnf install -y epel-release
10-
RUN dnf install -y git \
11-
make \
12-
which \
13-
iputils \
14-
hostname
15-
16-
17-
# Toolchain and platform environment variables
18-
ENV PROMPT_ALWAYS_RESPOND=n
19-
ENV CC=/opt/rh/gcc-toolset-12/root/bin/gcc
20-
ENV CXX=/opt/rh/gcc-toolset-12/root/bin/g++
21-
22-
ARG OSNAME=centos
23-
ARG BUILD_TYPE=Debug
24-
ARG EXTRA_CMAKE_FLAGS=''
25-
ARG NUM_THREADS=8
26-
ENV BUILD_BASE_DIR=_build
27-
ENV BUILD_DIR=""
28-
ENV DEPENDENCY_DIR="/deps-download"
29-
ENV INSTALL_PREFIX="/deps-install"
30-
# download git repo
31-
RUN git clone https://github.com/prestodb/presto.git /source
32-
#
33-
WORKDIR /source/presto-native-execution
34-
35-
## Load Velox submodule
36-
RUN make submodules
37-
38-
# Install dependencies
39-
RUN mkdir $INSTALL_PREFIX && \
40-
./scripts/setup-centos.sh && \
41-
./velox/scripts/setup-centos9.sh install_adapters && \
42-
./scripts/setup-adapters.sh && \
43-
./velox/scripts/setup-centos9.sh install_clang15
44-
45-
WORKDIR /
46-
47-
RUN rm -rf /source
48-
1+
FROM presto/prestissimo-dependency:centos9
2+
3+
# Install necesary packages to run dev containers in CLion
4+
# https://www.jetbrains.com/help/clion/prerequisites-for-dev-containers.html#remote_container
5+
RUN dnf -y update && dnf -y install epel-release
6+
RUN dnf -y --skip-broken install \
7+
curl \
8+
unzip \
9+
procps \
10+
libXext \
11+
libXrender \
12+
libXtst \
13+
libXi \
14+
freetype \
15+
procps
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# How to develop Presto C++ with dev-containers in CLion
2+
3+
> **_NOTE:_** For this to work you need CLion 2025.2.2 or greater.
4+
5+
If you can't or want't to build the development environment on your machine, but still using a modern IDE "natively", you can use dev-containers. With them you can have your IDE frontend working against CLion backend running on a docker container. In order to set it up, execute
6+
7+
```sh
8+
docker compose build centos-native-dependency
9+
```
10+
Once the image is built, open the `presto-native-execution` module on CLion. Then, 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.
11+
12+
The source code is mounted from your machine so any change made into it from the dev-container will also be on your machine.
13+
14+
## Debug or execute `presto_server`
15+
16+
Reload CMake project and configure the `presto_server` executable as defined [here](https://github.com/mblanco-denodo/presto/tree/master/presto-native-execution). Compile the project as you need. 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.
17+
18+
## Known errors
19+
- 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 might have been an issue starting the CLion backend inside the container. To resolve this issue, close CLion, reopen it and 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.
20+
21+
- In some cases you might to manually add the mounted repo to the trusted directories for the dev-container
22+
```sh
23+
git config --global --add safe.directory /workspace/presto
24+
```

presto-native-execution/.devcontainer/devcontainer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
2-
"name": "Prestissimo Dev Container",
2+
"name": "Presto C++ Dev Container",
33
"build": {
4-
"dockerfile": "Dockerfile"
4+
"dockerfile": "Dockerfile"
55
},
66
"workspaceMount": "source=${localWorkspaceFolder}/..,target=/workspace/presto,type=bind",
77
"workspaceFolder": "/workspace/presto/presto-native-execution"
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/bash
2+
# Before executing this script, you should compile presto_server
3+
# Copy shared libs to the directory /runtime-libraries
4+
mkdir /runtime-libraries && \
5+
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")' && \
6+
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") }'

0 commit comments

Comments
 (0)