From 0f81bb2775993932b692ad3616538905a4b3b865 Mon Sep 17 00:00:00 2001 From: florian <f.spreckelsen@inidscale.com> Date: Thu, 1 Jul 2021 15:47:00 +0200 Subject: [PATCH] DOC: Extent troubleshooting --- README_SETUP.md | 78 ++++++++++++++++++++++++++++++++++++------------- 1 file changed, 57 insertions(+), 21 deletions(-) diff --git a/README_SETUP.md b/README_SETUP.md index f75a46c..eeb9908 100644 --- a/README_SETUP.md +++ b/README_SETUP.md @@ -12,26 +12,54 @@ We use [cmake](https://cmake.org) as build tool. #### protobufConfig.cmake not found -If you encounter something like `protobufConfig.cmake` when doing `cmake ..` your system doesn't have the gRPC library installed at all or your installation doesn't have the required `protobufConfig.cmake` file. One approach is to fetch and build gRPC and ProtoBuf with cmake locally: - -1. Go to the build directory if you are not there -2. `cmake -B . -D LINTING=OFF -D GRPC_FETCHCONTENT=ON ..` - - ``` - -- include-what-you-use: /usr/lib/llvm/11/bin/include-what-you-use - -- clang-tidy: /usr/lib/llvm/11/bin/clang-tidy - -- Using gRPC via add_subdirectory (FetchContent). - - ... (A LOT OF STUFF) - - -- Configuring done - -- Generating done - -- Build files have been written to: /home/tf/src/caosdb/caosdb-cpplib/build - ``` - - Note: We turn linting off because we don't want to lint the third-party projects. -3. Because we don't want to download and build everything again each time we - wipe our build directory: `cmake --install . --prefix $HOME/.local/` +If you encounter something like `PprotobufConfig.cmake` when doing +`cmake ..` your system doesn't have the gRPC library installed at all +or your installation doesn't have the required `ProtobufConfig.cmake` +file. In this case you can install grpcc manually by cloning the +repository and its submodules nad building it from the sources: + +```sh +RUN git clone --recurse-submodules -b v1.38.1 https://github.com/grpc/grpc +cd grpc +mkdir -p cmake/build +cp cmake/build +cmake -DgRPC_INSTALL=ON \ + -DgRPC_BUILD_CSHARP_EXT=OFF \ + -DgRPC_BUILD_GRPC_CSHARP_PLUGIN=OFF \ + -DgRPC_BUILD_GRPC_PYTHON_PLUGIN=OFF \ + -DgRPC_BUILD_GRPC_RUBY_PLUGIN=OFF \ + -DgRPC_BUILD_GRPC_PHP_PLUGIN=OFF \ + -DgRPC_BUILD_GRPC_OBJECTIVE_C_PLUGIN=OFF \ + -DgRPC_BUILD_GRPC_NODE_PLUGIN=OFF \ + -DgRPC_BUILD_TESTS=OFF \ + ../.. +make -j3 # Or whatever number of jobs suits your system +make install +``` + +It may make sense to specify a custom directory for your grpc +installation such as `$HOME/.local` by adding +`-DCMAKE_INSTALL_PREFIX=/path/to/install/dir` to the above `cmake` +command. This prevents interference with a possible system-wide +installation of grpc that's lacking the relevant cmake files. + +Depending on your system, it may be necessary to manually install the +`abseil` submodule: + +```sh +cd grpc +mkdir -p third_party/abseil-cpp/cmake/build +cd third_party/abseil-cpp/cmake/build +cmake -DCMAKE_POSITION_INDEPENDENT_CODE=TRUE ../.. +make -j3 +make install +``` + +As above, it may make sens to specify a `CMAKE_INSTALL_PREFIX` in +order to not interfere with system-wide installations. + +You may have to repeat this for other submodules that haven't been +installed correctly by `make install` of `grpc`. ## Unit Tests @@ -43,11 +71,19 @@ For the tests there is a slightly different setup required (with option `-D CMAK 2. `cmake -B . -D CMAKE_BUILD_TYPE=Debug ..` 3. `cmake --build .` - ### Run In the build directory, run `ctest` +### Troubleshooting + +Depending on your gtest installation, there may be warnings treated as +errors during the above build command, e.g., a +`-Werror=maybe-uninitialized` in +`caosdb-cpplib-new/build/_deps/googletest-src/googletest/src/gtest-death-test.cc`. In +that case, suprress the corresponding warning by adding +`-DCMAKE_CXX_FLAGS="-Wno-maybe-uninitialized"` to the cmake command in 2. + ### Framework We use [GoogleTest](https://google.github.io/googletest/) for unit testing. -- GitLab