Skip to content

Commit 8a706bb

Browse files
committed
Support building with the default apt sources on Ubuntu 20.04
### Motivation Currently the Python client cannot be built with the default apt sources on Ubuntu 20.04, whose default CMake version is 3.16. However, even after I installed CMake 3.24 on Ubuntu 20.04, CMake would still fail to find Boost.Python. ### Modifications To fix the Boost.Python not found issue, find the `Python` component instead of `Python3` when finding Boost. In addition, when finding Python3, find the `Development` component instead of the `Development.Module`, which is a sub-component of `Development`. See https://cmake.org/cmake/help/latest/module/FindPython3.html. After that, the minimum required CMake version becomes back to 3.12 from 3.18, which was upgraded in apache#11.
1 parent 3e37e44 commit 8a706bb

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

.github/workflows/ci-pr-validation.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030

3131
unit-tests:
3232
name: Run unit tests
33-
runs-on: ubuntu-22.04
33+
runs-on: ubuntu-20.04
3434
timeout-minutes: 120
3535

3636
steps:

CMakeLists.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#
1919

2020
project (pulsar-client-python)
21-
cmake_minimum_required(VERSION 3.18)
21+
cmake_minimum_required(VERSION 3.12)
2222
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake_modules")
2323

2424
option(LINK_STATIC "Link against static libraries" OFF)
@@ -41,12 +41,12 @@ message(STATUS "PULSAR_INCLUDE: ${PULSAR_INCLUDE}")
4141

4242
SET(CMAKE_CXX_STANDARD 11)
4343

44-
find_package (Python3 REQUIRED COMPONENTS Development.Module)
44+
find_package (Python3 REQUIRED COMPONENTS Development)
4545
MESSAGE(STATUS "PYTHON: " ${Python3_VERSION} " - " ${Python3_INCLUDE_DIRS})
4646

4747
SET(Boost_USE_STATIC_LIBS ${LINK_STATIC})
48-
find_package(Boost REQUIRED COMPONENTS python3)
49-
MESSAGE(STATUS "Boost Python3: " ${Boost_PYTHON3_LIBRARY})
48+
find_package(Boost REQUIRED COMPONENTS python)
49+
MESSAGE(STATUS "Boost Python: " ${Boost_PYTHON_LIBRARY})
5050
MESSAGE(STATUS "Boost_INCLUDE_DIRS: ${Boost_INCLUDE_DIRS}")
5151

5252
########################################################################################################################
@@ -81,7 +81,7 @@ endif()
8181

8282
# Try all possible boost-python variable namings
8383
set(PYTHON_WRAPPER_LIBS ${PULSAR_LIBRARY}
84-
${Boost_PYTHON3_LIBRARY})
84+
${Boost_PYTHON_LIBRARY})
8585

8686
message(STATUS "All libraries: ${PYTHON_WRAPPER_LIBS}")
8787

0 commit comments

Comments
 (0)