This is an automated email from the ASF dual-hosted git repository. penghui pushed a commit to branch branch-2.7 in repository https://gitbox.apache.org/repos/asf/pulsar.git
commit f46bb61e78daed0a3ebf688426d1ade4d0a6aa7d Author: Yunze Xu <xyzinfern...@163.com> AuthorDate: Thu Feb 25 17:08:18 2021 +0800 [CI][C++] Force CMake to find Python2 (#9690) Fixes #9682 Currently, ci-cpp-tests uses `pulsar-build` image that is from `ubuntu:16.04` to build C++/Python client. The image uses `libboost-all-dev` for CMake to find boost dependencies. However, the Boost.Python library from Ubuntu 16.04's apt source only supports Python 2. - Specifying `PYTHON_INCLUDE_DIR` and `PYTHON_LIBRARY` could indicate the installation of Python to use. Since the `pulsar-build` image only contains Python binary but not the Python2 library (`libpython2.7so`), this PR installs `libpython-dev` to setup the Python2 library. Otherwise, CMake would still find the Python3 library(`libpython3.5.so`). - Remove redundant C++ client dependencies like `libjsoncpp-dev` and replace `libboost-all-dev` with the specific `libboost-xxx-dev`. - [ ] Make sure that the change passes the CI checks. *(Please pick either of the following options)* This change is a trivial rework / code cleanup without any test coverage. (cherry picked from commit 1419d2889f1c94992ab7a55bf5399b261324c7f1) --- .github/workflows/ci-cpp.yaml | 2 +- build/docker/Dockerfile | 11 ++++++----- pulsar-client-cpp/docker-build.sh | 2 +- pulsar-client-cpp/docker-tests.sh | 2 +- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci-cpp.yaml b/.github/workflows/ci-cpp.yaml index 99f5093..1da9f7f 100644 --- a/.github/workflows/ci-cpp.yaml +++ b/.github/workflows/ci-cpp.yaml @@ -81,7 +81,7 @@ jobs: if: steps.docs.outputs.changed_only == 'no' run: | echo "Build C++ client library" - export CMAKE_ARGS="-DCMAKE_BUILD_TYPE=Debug -DBUILD_DYNAMIC_LIB=OFF" + export CMAKE_ARGS="-DCMAKE_BUILD_TYPE=Debug -DBUILD_DYNAMIC_LIB=OFF -DPYTHON_INCLUDE_DIR=/usr/include/python2.7 -DPYTHON_LIBRARY=/usr/lib/x86_64-linux-gnu/libpython2.7.so" pulsar-client-cpp/docker-build.sh - name: run c++ tests diff --git a/build/docker/Dockerfile b/build/docker/Dockerfile index 9ae75f5..0d33571 100644 --- a/build/docker/Dockerfile +++ b/build/docker/Dockerfile @@ -25,10 +25,11 @@ ADD protobuf.patch /pulsar RUN apt-get update && \ apt-get install -y tig g++ cmake libssl-dev libcurl4-openssl-dev \ - liblog4cxx-dev libprotobuf-dev libboost-all-dev google-mock libgtest-dev \ - libjsoncpp-dev libxml2-utils protobuf-compiler wget \ - curl doxygen openjdk-8-jdk-headless clang-format-5.0 \ - gnupg2 golang-1.10-go zip unzip libzstd-dev libsnappy-dev + liblog4cxx-dev libprotobuf-dev google-mock libgtest-dev \ + libboost-dev libboost-program-options-dev libboost-system-dev libboost-python-dev \ + libxml2-utils protobuf-compiler wget \ + curl doxygen openjdk-8-jdk-headless openjdk-11-jdk-headless clang-format-5.0 \ + gnupg2 golang-1.13-go zip unzip libzstd-dev libsnappy-dev python3-pip libpython-dev # Compile and install gtest RUN cd /usr/src/gtest && cmake . && make && cp libgtest.a /usr/lib @@ -62,7 +63,7 @@ RUN wget https://artifacts.crowdin.com/repo/deb/crowdin.deb -O crowdin.deb RUN dpkg -i crowdin.deb # Install PIP and PDoc -RUN wget https://bootstrap.pypa.io/get-pip.py && python get-pip.py +RUN wget https://bootstrap.pypa.io/2.7/get-pip.py && python get-pip.py && rm get-pip.py RUN pip install pdoc # Install Protobuf doc generator (requires Go) diff --git a/pulsar-client-cpp/docker-build.sh b/pulsar-client-cpp/docker-build.sh index 31fa5d9..b615ae5 100755 --- a/pulsar-client-cpp/docker-build.sh +++ b/pulsar-client-cpp/docker-build.sh @@ -27,7 +27,7 @@ ROOT_DIR=$(git rev-parse --show-toplevel) cd $ROOT_DIR/pulsar-client-cpp BUILD_IMAGE_NAME="${BUILD_IMAGE_NAME:-apachepulsar/pulsar-build}" -BUILD_IMAGE_VERSION="${BUILD_IMAGE_VERSION:-ubuntu-16.04}" +BUILD_IMAGE_VERSION="${BUILD_IMAGE_VERSION:-ubuntu-16.04-py2}" IMAGE="$BUILD_IMAGE_NAME:$BUILD_IMAGE_VERSION" diff --git a/pulsar-client-cpp/docker-tests.sh b/pulsar-client-cpp/docker-tests.sh index e5fd3e8..0969c1c 100755 --- a/pulsar-client-cpp/docker-tests.sh +++ b/pulsar-client-cpp/docker-tests.sh @@ -34,7 +34,7 @@ ROOT_DIR=$(git rev-parse --show-toplevel) cd $ROOT_DIR/pulsar-client-cpp BUILD_IMAGE_NAME="${BUILD_IMAGE_NAME:-apachepulsar/pulsar-build}" -BUILD_IMAGE_VERSION="${BUILD_IMAGE_VERSION:-ubuntu-16.04}" +BUILD_IMAGE_VERSION="${BUILD_IMAGE_VERSION:-ubuntu-16.04-py2}" IMAGE="$BUILD_IMAGE_NAME:$BUILD_IMAGE_VERSION"