android-sdk-tools icon indicating copy to clipboard operation
android-sdk-tools copied to clipboard

Error occured while running ninja build

Open hanchiho opened this issue 1 year ago • 1 comments

Hi,

My host machine is linux x86-64 machine(ubuntu 18.04), and trying to build android platform tools that works for arm64, as my target machine is raspberry pi which is arm64. tool that you are providing seems to be exactly what i've been looking for weeks, but following the steps have some problem.

test command: ninja -j$(nproc --all)

1. config.h missing

FAILED: /usr/bin/c++   -DGOOGLE_PROTOBUF_CMAKE_BUILD -DHAVE_ZLIB -I. -I../src -std=c++11 -MMD -MT CMakeFiles/libprotobuf-lite.dir/src/google/protobuf/stubs/common.cc.o -MF CMakeFiles/libprotobuf-lite.dir/src/google/protobuf/stubs/common.cc.o.d -o CMakeFiles/libprotobuf-lite.dir/src/google/protobuf/stubs/common.cc.o -c ../src/google/protobuf/stubs/common.cc
../src/google/protobuf/stubs/common.cc:41:20: fatal error: config.h: No such file or directory
compilation terminated.

I can't find any config.h file in the path or inside any relative path. Can you tell me where to get it? or How can I fix this error?

2. missing binary operator before token "("

A lot of errors are comming out during ninja comand

../src/google/protobuf/parse_context.h:575:18: error: missing binary operator before token "("
 #if __has_builtin(__builtin_add_overflow) && __has_builtin(__builtin_sub_overflow)

parse_context.h

  }
  uint32_t second = static_cast<uint8_t>(p[1]);
**_#if __has_builtin(__builtin_add_overflow) && __has_builtin(__builtin_sub_overflow)_**
  uint32_t second_minus_1;
  __builtin_sub_overflow(second, 1, &second_minus_1);
  __builtin_add_overflow(res, second_minus_1 << 7, &res);
#else
  res += (second - 1) << 7;
#endif
  if (second < 128) {
    *out = res;

#if __has_builtin(__builtin_add_overflow) && __has_builtin(__builtin_sub_overflow) seems to be invoking errors, but don't know how to change it.

I cloned sourcecode not specifing any branch or tags. Please can you help me remove this issue?

hanchiho avatar Aug 05 '24 05:08 hanchiho

modify protobuf/CMakeLists.txt

# L298
# add android to include directory
# as follows
include_directories(
  ${ZLIB_INCLUDE_DIRECTORIES}
  ${protobuf_BINARY_DIR}
  ${protobuf_SOURCE_DIR}/src
  ${protobuf_SOURCE_DIR}/android)

lzhiyong avatar Aug 20 '24 13:08 lzhiyong

This should probably be inserted into the README

xvolks avatar Oct 01 '25 07:10 xvolks