Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions package/apk/seekdb-apk-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -497,8 +497,8 @@ if [[ "$DO_MAKE" == true ]]; then
cd "$TOPDIR"
echo "[seekdb-apk-build] ./build.sh clean"
./build.sh clean
echo "[seekdb-apk-build] ./build.sh release --android --init"
./build.sh release --android --init
echo "[seekdb-apk-build] ./build.sh release --android --init -DBUILD_EMBED_MODE=ON"
./build.sh release --android --init -DBUILD_EMBED_MODE=ON
cd "$TOPDIR"
_jobs="$(getconf _NPROCESSORS_ONLN 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || echo 4)"
if [[ "$WITH_JNI" == true ]]; then
Expand Down Expand Up @@ -614,3 +614,4 @@ if [[ "$DO_INSTALL" == true ]]; then
fi

echo "[package_embedded_apk] done"

22 changes: 11 additions & 11 deletions src/observer/embed/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,26 +35,26 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Android")
target_link_libraries(embedded_client PRIVATE seekdb_embed_c)
endif()

if(BUILD_EMBED_MODE)
if(BUILD_EMBED_MODE AND NOT CMAKE_SYSTEM_NAME STREQUAL "Android")
# Set target Python version, can be overridden by CMake parameter
if(NOT DEFINED PYTHON_VERSION)
set(PYTHON_VERSION "3.8")
endif()
set(Python3_FOUND FALSE)

message(STATUS "Target Python version: ${PYTHON_VERSION}")

# First try to find the specified Python version from system
message(STATUS "Searching for Python ${PYTHON_VERSION} in system first...")
find_package(Python3 ${PYTHON_VERSION} EXACT COMPONENTS Interpreter Development.Module QUIET)
if(Python3_FOUND)
message(STATUS "Found system Python ${PYTHON_VERSION}, using it for embed module")
endif()

# If system doesn't have the specified Python version, try to find from pyenv
if(NOT Python3_FOUND)
message(STATUS "No system Python ${PYTHON_VERSION} found, trying pyenv...")

# Method 1: Check if pyenv version can be specified via environment variable
if(DEFINED ENV{PYENV_VERSION})
execute_process(
Expand All @@ -79,7 +79,7 @@ if(BUILD_EMBED_MODE)
endif()
endif()
endif()

# Method 2: Directly try to find the specified version in pyenv
if(NOT Python3_FOUND)
execute_process(
Expand Down Expand Up @@ -119,7 +119,7 @@ if(BUILD_EMBED_MODE)
endif()
endif()
endif()

# Method 3: Directly find the specified version through PYENV_ROOT
if(NOT Python3_FOUND AND DEFINED ENV{PYENV_ROOT})
set(PYENV_SPECIFIC_PYTHON "$ENV{PYENV_ROOT}/versions/${PYTHON_VERSION}/bin/python")
Expand All @@ -130,12 +130,12 @@ if(BUILD_EMBED_MODE)
endif()
endif()
endif()

# If still no suitable Python version found, error and exit
if(NOT Python3_FOUND)
message(FATAL_ERROR "No suitable Python ${PYTHON_VERSION} found. Please install Python ${PYTHON_VERSION} or configure pyenv with Python ${PYTHON_VERSION}.")
endif()

# Verify the final Python choice
if(Python3_EXECUTABLE)
execute_process(
Expand All @@ -145,7 +145,7 @@ if(BUILD_EMBED_MODE)
)
message(STATUS "Final Python choice: ${Python3_EXECUTABLE} (${PYTHON_VERSION_OUTPUT})")
endif()

message(STATUS "Building embed module with Python ${Python3_EXECUTABLE}")
execute_process(
COMMAND "${Python3_EXECUTABLE}" -c
Expand Down Expand Up @@ -194,7 +194,7 @@ if(BUILD_EMBED_MODE)
SUFFIX ".so"
OUTPUT_NAME "${libname}"
)

target_link_libraries(${libname} PUBLIC
oceanbase_static
$<$<NOT:$<PLATFORM_ID:Darwin>>:-static-libgcc>
Expand Down
Loading