我尝试为 grpc 包创建 python-for-android 配方。
作为基础,我使用来自https://github.com/hpsaturn/p4a_grpc_recipe/blob/master/init .py的现有配方。那里的配方是在 docker 容器内构建的,所有依赖项也都是单独安装的。相反,在我的 fork https://github.com/Splato/p4a_grpc_recipe/edit/master/init .py中,我将所有依赖项安装为“模块”(代码行 129-133),除了 openssl 包( grpc安装失败的 BoringSSL p4a)。但是,编译 60% 的配方后出现以下错误:
[ 60%] Linking CXX shared library libgrpc_plugin_support.so
CMakeFiles/grpc_plugin_support.dir/src/compiler/python_generator.cc.o: In function `PythonGrpcGenerator':
~/.buildozer/android/platform/build-arm64-v8a/build/other_builds/grpcio/arm64-v8a__ndk_target_21/grpcio/grpc/src/compiler/python_generator.cc:829: undefined reference to `google::protobuf::compiler::CodeGenerator::~CodeGenerator()'
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [CMakeFiles/grpc_plugin_support.dir/build.make:175: libgrpc_plugin_support.so] Error 1
make[1]: *** [CMakeFiles/Makefile2:894: CMakeFiles/grpc_plugin_support.dir/all] Error 2
make: *** [Makefile:130: all] Error 2
之后,我还尝试将 protobuf 作为依赖项包含在 grpc 配方中(来自 https://github.com/kivy/python-for-android/blob/master/pythonforandroid/recipes/protobuf_cpp/init .py 的配方protobuf_cpp )。在这里,我将 protobuf 更改为“package”(129)以及 cmake 中库和可执行文件的路径(第 112-115 行)。但是,我遇到了另一个错误:
-- Looking for __system_property_get - found
CMake Error at /usr/share/cmake-3.16/Modules/FindProtobuf.cmake:469 (file):
file STRINGS file "/opt/install/include/google/protobuf/stubs/common.h"
cannot be read.
Call Stack (most recent call first):
cmake/protobuf.cmake:58 (find_package)
CMakeLists.txt:261 (include)
CMake Error at /usr/share/cmake-3.16/Modules/FindProtobuf.cmake:475 (math):
math cannot parse the expression: " / 1000000": syntax error, unexpected
exp_DIVIDE (2).
Call Stack (most recent call first):
cmake/protobuf.cmake:58 (find_package)
CMakeLists.txt:261 (include)
CMake Error at /usr/share/cmake-3.16/Modules/FindProtobuf.cmake:476 (math):
math cannot parse the expression: " / 1000 % 1000": syntax error,
unexpected exp_DIVIDE (2).
Call Stack (most recent call first):
cmake/protobuf.cmake:58 (find_package)
CMakeLists.txt:261 (include)
CMake Error at /usr/share/cmake-3.16/Modules/FindProtobuf.cmake:477 (math):
math cannot parse the expression: " % 1000": syntax error, unexpected
exp_MOD (2).
Call Stack (most recent call first):
cmake/protobuf.cmake:58 (find_package)
CMakeLists.txt:261 (include)
-- Found Protobuf: /opt/install/lib/libprotobuf.a (found version "ERROR.ERROR.ERROR")
-- Found OpenSSL: ~/.buildozer/android/platform/build-arm64-v8a/build/other_builds/openssl/arm64-v8a__ndk_target_21/openssl1.1/libcrypto.so (found version "1.1.1k")
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of off64_t
-- Check size of off64_t - done
-- Looking for fseeko
-- Looking for fseeko - found
-- Looking for unistd.h
-- Looking for unistd.h - found
-- Renaming
-- ~/.buildozer/android/platform/build-arm64-v8a/build/other_builds/grpcio/arm64-v8a__ndk_target_21/grpcio/grpc/third_party/zlib/zconf.h
-- to 'zconf.h.included' because this file is included with zlib
-- but CMake generates it automatically in the build directory.
-- Configuring incomplete, errors occurred!
See also "~/.buildozer/android/platform/build-arm64-v8a/build/other_builds/grpcio/arm64-v8a__ndk_target_21/grpcio/grpc/build/CMakeFiles/CMakeOutput.log".
See also "~/.buildozer/android/platform/build-arm64-v8a/build/other_builds/grpcio/arm64-v8a__ndk_target_21/grpcio/grpc/build/CMakeFiles/CMakeError.log".
所以我想在这一点上,我需要一些帮助来配置 protobuf 安装/配置。提前致谢。