Adb not working due to lack of libprotobuf.so.30 on raspberry

On my raspberry PI400 adb is not working due to a lack of link to libprotobuf.so.30

adb: error while loading shared libraries: libprotobuf.so.30: cannot open shared object file: No such file or directory

And really:

ldd /usr/bin/adb                                                                                                                                                           127 ✘ 
	linux-vdso.so.1 (0x0000ffff97206000)
	libprotobuf.so.30 => not found
	libpthread.so.0 => /usr/lib/libpthread.so.0 (0x0000ffff96e90000)
	libbrotlidec.so.1 => /usr/lib/libbrotlidec.so.1 (0x0000ffff96e70000)
	libbrotlienc.so.1 => /usr/lib/libbrotlienc.so.1 (0x0000ffff96dc0000)
	liblz4.so.1 => /usr/lib/liblz4.so.1 (0x0000ffff96d90000)
	libusb-1.0.so.0 => /usr/lib/libusb-1.0.so.0 (0x0000ffff96d60000)
	libz.so.1 => /usr/lib/libz.so.1 (0x0000ffff96d30000)
	libzstd.so.1 => /usr/lib/libzstd.so.1 (0x0000ffff96c70000)
	libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x0000ffff96a20000)
	libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x0000ffff969f0000)
	libc.so.6 => /usr/lib/libc.so.6 (0x0000ffff96840000)
	/lib/ld-linux-aarch64.so.1 => /usr/lib/ld-linux-aarch64.so.1 (0x0000ffff971cd000)
	libbrotlicommon.so.1 => /usr/lib/libbrotlicommon.so.1 (0x0000ffff96800000)
	libm.so.6 => /usr/lib/libm.so.6 (0x0000ffff96750000)
	libudev.so.1 => /usr/lib/libudev.so.1 (0x0000ffff966f0000)
	libatomic.so.1 => /usr/lib/libatomic.so.1 (0x0000ffff966d0000)

I have libprotobuf installed

protobuf                           [Installati] 3.20.1-2                  extra 
    Protocol Buffers - Google's data interchange format

Do we need to recompile the package android-tools?

Yes. But we inherit android-tools from Arch Linux ARM. They just haven’t rebuilt/updated it yet.

And the bug is also on the correspondent forum Arch Linux ARM • View topic - [android-tools] is outdated but without any response.

Hello,

I was the OP in the archlinuxarm post. I haven’t gotten a response in weeks.
I tried finding the PKGBUILD for android-tools for the arm version but couldn’t find it.
I tried using the PKGBUILD from x86_64 and it failed to build on my Pi.

So I’m stuck there too. Hopefully they fix the issue soon.

I can confirm your report.

I modified the PKGBUILD file in the line arch=(aarch64), gave the command makepkg --clean–syncdeps but the compilation fails with this message

-- Build files have been written to: /home/leandro/lavoro/android-tools/trunk/src/android-tools-31.0.3p1/build
==> Entro nell'ambiente fakeroot...
==> Avvio di package() in corso...
ninja: Entering directory `build'
[9/226] Building C object vendor/boringssl/crypto/CMakeFiles/crypto.dir/bytestring/cbs.c.o
FAILED: vendor/boringssl/crypto/CMakeFiles/crypto.dir/bytestring/cbs.c.o 
/usr/bin/cc -DBORINGSSL_HAVE_LIBUNWIND -DBORINGSSL_IMPLEMENTATION -I/home/leandro/lavoro/android-tools/trunk/src/android-tools-31.0.3p1/vendor/boringssl/third_party/googletest/include -I/home/leandro/lavoro/android-tools/trunk/src/android-tools-31.0.3p1/vendor/boringssl/crypto/../include -march=armv8-a -O2 -pipe -fstack-protector-strong -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security         -fstack-clash-protection -Werror -Wformat=2 -Wsign-compare -Wmissing-field-initializers -Wwrite-strings -Wvla -ggdb -Wall -fvisibility=hidden -fno-common -Wno-free-nonheap-object -Wimplicit-fallthrough -Wmissing-prototypes -Wold-style-definition -Wstrict-prototypes -Wshadow -std=c11 -D_XOPEN_SOURCE=700 -O3 -DNDEBUG -MD -MT vendor/boringssl/crypto/CMakeFiles/crypto.dir/bytestring/cbs.c.o -MF vendor/boringssl/crypto/CMakeFiles/crypto.dir/bytestring/cbs.c.o.d -o vendor/boringssl/crypto/CMakeFiles/crypto.dir/bytestring/cbs.c.o -c /home/leandro/lavoro/android-tools/trunk/src/android-tools-31.0.3p1/vendor/boringssl/crypto/bytestring/cbs.c
/home/leandro/lavoro/android-tools/trunk/src/android-tools-31.0.3p1/vendor/boringssl/crypto/bytestring/cbs.c: In function ‘CBS_get_asn1_int64’:
/home/leandro/lavoro/android-tools/trunk/src/android-tools-31.0.3p1/vendor/boringssl/crypto/bytestring/cbs.c:483:16: error: writing 1 byte into a region of size 0 [-Werror=stringop-overflow=]
  483 |     u.bytes[i] = data[len - i - 1];
      |     ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~
/home/leandro/lavoro/android-tools/trunk/src/android-tools-31.0.3p1/vendor/boringssl/crypto/bytestring/cbs.c:480:5: note: at offset 8 into destination object ‘u’ of size 8
  480 |   } u;
      |     ^
cc1: all warnings being treated as errors
[12/226] Building CXX object vendor/CMakeFiles/libadb.dir/adb/pairing_connection/pairing_connection.cpp.o
/home/leandro/lavoro/android-tools/trunk/src/android-tools-31.0.3p1/vendor/adb/pairing_connection/pairing_connection.cpp: In static member function ‘static PairingAuthPtr PairingConnectionCtx::CreatePairingAuthPtr(PairingConnectionCtx::Role, const Data&)’:
/home/leandro/lavoro/android-tools/trunk/src/android-tools-31.0.3p1/vendor/adb/pairing_connection/pairing_connection.cpp:448:1: warning: control reaches end of non-void function [-Wreturn-type]
  448 | }
      | ^
[13/226] Building CXX object vendor/CMakeFiles/libadb.dir/adb/client/auth.cpp.o
/home/leandro/lavoro/android-tools/trunk/src/android-tools-31.0.3p1/vendor/adb/client/auth.cpp: In function ‘bool load_keys(const string&, bool)’:
/home/leandro/lavoro/android-tools/trunk/src/android-tools-31.0.3p1/vendor/adb/client/auth.cpp:178:49: warning: ignoring attributes on template argument ‘int (*)(DIR*)’ [-Wignored-attributes]
  178 |         std::unique_ptr<DIR, decltype(&closedir)> dir(opendir(path.c_str()), closedir);
      |                                                 ^
[14/226] Building CXX object vendor/CMakeFiles/adb.dir/adb/transport.cpp.o
ninja: build stopped: subcommand failed.
==> ERRORE: Si è verificato un errore in package().
    L'operazione sta per essere interrotta...

As I temporary measure you could either downgrade protobuf (edit: if nothing else depends on it ofc (as mentioned by @Strit)) or use LD_PRELOAD=/path/to/libprotobuf.so.30 adb
ArchlinuxARM archived package where you can get libprotobuf.so.30 and the rest from: http://tardis.tiny-vps.com/aarm/packages/p/protobuf/protobuf-3.19.4-1-aarch64.pkg.tar.xz

Be aware that downgrading a ibraries like protobuf, will likely result in lots of other stuff not working.

just a hint: you also need `libprotobuf.so.30.0.4 in same directory as it is the actual file, the other one is just a symlink.

I know, hence I said:

Agreed, could wrote it a bit clearer. :stuck_out_tongue: