'build android adb for arm processor

I want to use Android ADB tool on ARM platform. One of the commands in the build script is:

arm-eabi-g++
-I build/libs/host/include/host
-I build/libs/host/include
-I build/libs/host
-I out/host/linux-arm/obj/STATIC_LIBRARIES/libhost_intermediates 
-I dalvik/libnativehelper/include/nativehelper
-I system/core/include
-I hardware/libhardware/include
-I hardware/libhardware_legacy/include
-I hardware/ril/include
-I dalvik/libnativehelper/include
-I frameworks/base/include
-I frameworks/base/opengl/include
-I frameworks/base/native/include
-I external/skia/include
-I tools/include
-I out/host/linux-arm/obj/include
-I prebuilt/ndk/android-ndk-r5b/platforms/android-9/arch-arm/usr/include
-c -fno-exceptions -Wno-multichar -fPIC
-include system/core/include/arch/linux-arm/AndroidConfig.h
-D_FORTIFY_SOURCE=0
-DANDROID -fmessage-length=0 -W -Wall -Wno-unused -Winit-self -Wpointer-arith -O2 -g -fno-strict-aliasing -DNDEBUG -UDEBUG
-DANDROID -fmessage-length=0 -W -Wall -Wno-unused -Winit-self -Wpointer-arith -Wsign-promo -DNDEBUG -UDEBUG
-MD -o out/host/linux-arm/obj/STATIC_LIBRARIES/libhost_intermediates/pseudolocalize.o   
build/libs/host/pseudolocalize.cpp

I have made sure I have the latest ndk-r5b installed, which is supposed to resolve the STL problem. However, I am still getting the following error:

In file included from build/libs/host/pseudolocalize.cpp:1:
build/libs/host/include/host/pseudolocalize.h:4:18: error: string: No such file or directory
In file included from build/libs/host/pseudolocalize.cpp:1:
build/libs/host/include/host/pseudolocalize.h:6: error: 'string' in namespace 'std' does not name a type
build/libs/host/pseudolocalize.cpp: In function 'const char* pseudolocalize_char(char)':
build/libs/host/pseudolocalize.cpp:61: error: 'NULL' was not declared in this scope
build/libs/host/pseudolocalize.cpp: At global scope:
build/libs/host/pseudolocalize.cpp:71: error: 'string' does not name a type

Does anyone know how to fix this problem? BTW the building of the intel version of adb works fine by following this link:

http://lackingrhoticity.blogspot.com/2010/02/how-to-build-adb-android-debugger.html



Solution 1:[1]

pseudolocalize.cpp is not needed for adb. And NDK toolchain is intended to build with bionic(Android libc). adb requires glibc(GNU libc) to build.

I created a Makefile to compile adb for Linux/ARM. This Makefile makes statically linked adb executable binary for Linux/ARM, thus it works on Android/ARM as well.

How to make.

  1. Install Sourcery G++ Lite for ARM and GNU Make.
  2. Download "Android source code".
  3. Save Makefile as system/core/adb/Makefile.
  4. cd system/core/adb; make.

Solution 2:[2]

If you need to build the ADB (version 1.0.31) for ARM take a look here.

The repository contains an all-in-one build script and also a pre-compiled binary for ARM.

Solution 3:[3]

I see the post is quite old, anyway it helped me. I did not found

"Sourcery G++ Lite for ARM and GNU Make."

But manage to build/run on/for my ARMv7, following the other steps with gcc 4:4.6.3-1ubuntu5

  1. N/A
  2. Download "Android source code".
  3. Save Makefile as system/core/adb/Makefile. 3b. Edit Makefile to CC= gcc and LD= gcc
  4. cd system/core/adb; make.

Solution 4:[4]

You can simply run the command

sudo apt install adb

it can handle ARM architecture

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Kazuki Sakamoto
Solution 2 bonnyz
Solution 3 user1437577
Solution 4 Eric Aya