Skip to content

Commit

Permalink
Update base images for cpp-client build; update cpp-client's README. (#…
Browse files Browse the repository at this point in the history
…4496)

* Update base images for cpp-client build; update cpp-client's README.

* Followup to review comment: fixing typos.
  • Loading branch information
jcferretti authored Sep 14, 2023
1 parent 2d9efa7 commit deca28f
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 12 deletions.
39 changes: 28 additions & 11 deletions cpp-client/README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
# Building the C++ client from a base Ubuntu 20.04 or 22.04 image

These instructions show how to install and run the Deephaven C++ client, its dependencies,
and its unit tests. We have tested these instructions in Ubuntu 20.04 and 22.04 with the default
C++ compiler and tool suite (cmake etc).
and its unit tests. We have tested these instructions in Ubuntu 22.04 with the default
C++ compiler and tool suite (cmake etc). We have used the instructions in the past to build
for older Ubuntu versions (20.04) and for some Fedora versions, but we don't regularly test
on them anymore so we do notguarantee they are current for those platforms.

1. Start with an Ubuntu 20.04 or 22.04 install
1. Start with an Ubuntu 22.04 install

2. Get Deephaven running by following the instructions here: https://deephaven.io/core/docs/how-to-guides/launch-build/

Expand All @@ -14,6 +16,8 @@ C++ compiler and tool suite (cmake etc).
sudo apt install curl git g++ cmake make build-essential zlib1g-dev libbz2-dev libssl-dev pkg-config
```

See the notes at the end of this document if you need the equivalent packages for Fedora.

4. Make a new directory for the Deephaven source code and assign that directory
to a temporary shell variable. This will make subsequent build steps easier.
```
Expand All @@ -33,7 +37,7 @@ C++ compiler and tool suite (cmake etc).
Get the `build-dependencies.sh` script from Deephaven's base images repository
at the correct version.
You can download it directly from the link
https://raw.githubusercontent.com/deephaven/deephaven-base-images/166befad816acbc9dff55d2d8354d60612cd9a8a/cpp-client/build-dependencies.sh
https://raw.githubusercontent.com/deephaven/deephaven-base-images/72427ce29901bf0419dd05db8e4abf31b57253d9/cpp-client/build-dependencies.sh
(this script is also used from our automated tools, to generate a docker image to
support tests runs; that's why it lives in a separate repo).
The script downloads, builds and installs the dependent libraries
Expand All @@ -60,7 +64,7 @@ C++ compiler and tool suite (cmake etc).
# If the directory already exists from a previous attempt, ensure is clean/empty
mkdir -p $DHCPP
cd $DHCPP
wget https://raw.githubusercontent.com/deephaven/deephaven-base-images/166befad816acbc9dff55d2d8354d60612cd9a8a/cpp-client/build-dependencies.sh
wget https://raw.githubusercontent.com/deephaven/deephaven-base-images/72427ce29901bf0419dd05db8e4abf31b57253d9/cpp-client/build-dependencies.sh
chmod +x ./build-dependencies.sh
# Maybe edit build-dependencies.sh to reflect choices of build tools and build target, if you
# want anything different than defaults; defaults are tested to work,
Expand Down Expand Up @@ -101,18 +105,25 @@ C++ compiler and tool suite (cmake etc).
source $DHCPP/env.sh
cd $DHSRC/deephaven-core/cpp-client/deephaven/
mkdir build && cd build
cmake -DCMAKE_INSTALL_PREFIX=${DHCPP}/local \
-DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_SHARED_LIBS=ON .. && \
make -j$NCPUS install
cmake \
-DCMAKE_INSTALL_LIBDIR=lib \
-DCMAKE_CXX_STANDARD=17 \
-DCMAKE_INSTALL_PREFIX=${DHCPP}/local \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DBUILD_SHARED_LIBS=ON \
.. \
&& \
make -j$NCPUS install
```

8. Build and run the deephaven example which uses the installed client.
Note this assumes deephaven server is running (see step 2),
8. Run one Deephaven example which uses the installed client.
This is a smoke test that the basic functionality
is working end to end, and the build is properly configured.
Note this assumes Deephaven server is running (see step 2),
and the build created on step 7 is available in the same directory.

```
cd $DHSRC/deephaven-core/cpp-client/deephaven/build/examples
make -j$NCPUS
cd hello_world
./hello_world
```
Expand Down Expand Up @@ -159,6 +170,12 @@ Notes
target using protobuf header files will not link against a `Debug`
version of protobuf. To keep things simple, we suggest that you run
a consistent setting for your code and all dependencies.
(2) In Fedora, the packages needed for building:

```
dnf -y groupinstall 'Development Tools'
dnf -y install curl cmake gcc-c++ openssl-devel libcurl-devel
```

# Updating proto generated C++ stubs (intended for developers)
1. Ensure you have a local installation of the dependent libraries
Expand Down
3 changes: 2 additions & 1 deletion docker/registry/cpp-client-base/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ deephaven.registry.imageName=ghcr.io/deephaven/cpp-client-base:latest
# It is in two different parts of the file (text and command examples).
# If you have the image sha for this file, you can get the commit sha for the README using:
# docker buildx imagetools inspect ghcr.io/deephaven/cpp-client-base@sha256:$IMAGESHA --format '{{ $metadata := index .Provenance.SLSA.metadata "https://mobyproject.org/buildkit@v1#metadata" }} {{ $metadata.vcs.revision }}'
deephaven.registry.imageId=ghcr.io/deephaven/cpp-client-base@sha256:74034b2c26a26033258a8d0808f45d6a010300c07a9135260fcb0c1691de04dd
deephaven.registry.imageId=ghcr.io/deephaven/cpp-client-base@sha256:061a3b87bd8cf7afa9bfacc3ebfbe904224cadc62b88e5232bf493c341bc4ed3

# TODO(deephaven-base-images#54): arm64 native image for cpp-client-base
deephaven.registry.platform=linux/amd64

0 comments on commit deca28f

Please sign in to comment.