Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gRPC Recipe Error #2498

Open
ghost opened this issue Oct 5, 2021 · 3 comments · May be fixed by #3023
Open

gRPC Recipe Error #2498

ghost opened this issue Oct 5, 2021 · 3 comments · May be fixed by #3023

Comments

@ghost
Copy link

ghost commented Oct 5, 2021

Hi everyone,

I continue the issue described here: #1052 . The idea is to create a gRPC recipe for p4a.

I tried to fork the existing recipe, https://github.com/hpsaturn/p4a_grpc_recipe/blob/master/__init__.py. The recipe there was built inside the docker container, and all the dependencies were also installed separately.
In my fork https://github.com/Splato/p4a_grpc_recipe/edit/master/__init__.py I install all dependencies as 'modules' (code lines 129-133) except for the openssl package (grpc installs BoringSSL that fails in p4a). However, I get the following error after compiling 60% of the recipe:

[ 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

Then I also tried to include protobuf as dependencies in the grpc recipe (the recipe protobuf_cpp https://github.com/kivy/python-for-android/blob/master/pythonforandroid/recipes/protobuf_cpp/__init__.py). Then I changed the protobuf to 'package' (129) and the path to libraries and executables in cmake (lines 112-115). However, then I got another error:

-- 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".

So I guess at this point, I need some help with configuring the protobuf installation. Thanks.

@ghost ghost changed the title GRPC Recipe gRPC Recipe Error Oct 5, 2021
@sergeplatonov
Copy link

sergeplatonov commented Dec 10, 2021

After specifying the correct path to libprotobuf.so and libprotoc.so (-DProtobuf_PROTOC_EXECUTABLE,.Dprotobuf_LIBRARIES',' DProtobuf_PROTOC_LIBRARY','-DProtobuf_INCLUDE_DIR',) I removed these errors. Now the recipe is compiled to 99%, but in the end I get the following errors:

[ 95%] Linking CXX executable gen_hpack_tables
/home/sergey/.buildozer/android/platform/android-ndk-r19c/toolchains/llvm/prebuilt/linux-x86_64/lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld: warning: libpython3.8.so, needed by /home/sergey/Desktop/project/.buildozer/android/platform/build-arm64-v8a/build/other_builds/protobuf/arm64-v8a__ndk_target_24/protobuf/src/.libs/libprotobuf.so, not found (try using -rpath or -rpath-link)
/home/sergey/.buildozer/android/platform/android-ndk-r19c/toolchains/llvm/prebuilt/linux-x86_64/lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld: warning: libz.so, needed by /home/sergey/Desktop/project/.buildozer/android/platform/build-arm64-v8a/build/other_builds/protobuf/arm64-v8a__ndk_target_24/protobuf/src/.libs/libprotobuf.so, not found (try using -rpath or -rpath-link)
/home/sergey/.buildozer/android/platform/android-ndk-r19c/toolchains/llvm/prebuilt/linux-x86_64/lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld: warning: libc++_shared.so, needed by /home/sergey/Desktop/project/.buildozer/android/platform/build-arm64-v8a/build/other_builds/protobuf/arm64-v8a__ndk_target_24/protobuf/src/.libs/libprotobuf.so, not found (try using -rpath or -rpath-link)
/home/sergey/.buildozer/android/platform/android-ndk-r19c/toolchains/llvm/prebuilt/linux-x86_64/lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld: warning: libstdc++.so, needed by /home/sergey/Desktop/project/.buildozer/android/platform/build-arm64-v8a/build/other_builds/protobuf/arm64-v8a__ndk_target_24/protobuf/src/.libs/libprotobuf.so, not found (try using -rpath or -rpath-link)
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [CMakeFiles/gen_hpack_tables.dir/build.make:151: gen_hpack_tables] Error 1
make[1]: *** [CMakeFiles/Makefile2:1569: CMakeFiles/gen_hpack_tables.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....

I tried already to add these dependencies to LDFLAGS and CXXFLAGS in the environment, specify them in -DCMAKE_INSTALL_PREFIX and -DCMAKE_FIND_ROOT_PATH in the cmake, change -DCMAKE_SHARED_LINKER_FLAGS and -DCMAKE_EXE_LINKER_FLAGS. All these ideas unfortunately don't work. Somehow the libprotobuf.so file compiled with the protobuf recipe cannot find the c++share and python libraries. Perhaps anyone has an idea what else can I try to solve it. Thanks!

@Duke0425
Copy link

i was the same error, who can tell us about grpcio recipes problem

@rEHui-MbIcJIu
Copy link

rEHui-MbIcJIu commented Jul 12, 2023

any suggestions?
Found this:
https://github.com/grpc/grpc/blob/master/setup.py

But i dont know how to use it yet

@kengoon kengoon linked a pull request May 28, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants