1

I've pushed executable adb file to /system for using it to connect to other devices, but shell can't execute this file. Why?

chiron / # file `which adb`
/system/xbin/adb: ELF executable, 64-bit LSB arm64, dynamic (/lib/ld-linux-aarch64.so.1), BuildID=408e8d3f813fbb95b782db5d56f91bc41b451acb, stripped
chiron / # adb
bash: /system/xbin/adb: No such file or directory
J. Doe
  • 13
  • 3

1 Answers1

2

You probably did cross-compilation badly.

As file suggests, the dynamic linker for the binary is /lib/ld-linux-aarch64.so.1, which doesn't exist on Android. Android's linker is located at /system/bin/linker (32-bit) and /system/bin/linker64. You need to specify this path as the dynamic linker when compiling.

You may try symlink-ing the Android dynamic linker to the path revealed by file.

iBug
  • 7,747
  • 8
  • 44
  • 83
  • chiron / # /system/bin/linker64 /system/xbin/adb This is /system/bin/linker64, the helper program for dynamic executables. – J. Doe Sep 19 '18 at 18:48
  • What do you mean? /system/xbin already in PATH and I cannot link this file somewhere for make it more executable. – J. Doe Sep 20 '18 at 17:45
  • @J.Doe I mean exactly this: mkdir /lib; ln -s /system/bin/linker64 /lib/ld-linux-aarch64.so.1 and then try running your executable. – iBug Sep 21 '18 at 01:19
  • @J.Doe The most recommended way is to recompile it, specifying the path to the dynamic linker as /system/bin/linker64 instead of using the default. – iBug Sep 21 '18 at 01:21