Giter Club home page Giter Club logo

adb-standalone-build's Introduction

adb-standalone-build

This project aims to build a standalone adb binary on Linux from downloaded sources (more trustable than source code copy-pasta and better maintainability).

The initial goal was to build the binary for the Raspberry Pi 4b (aarch64 processor), but it should be architecture-independent since it builds everything from sources (developed on my x86-64 laptop and then built without any issue on the RPi4b).

Dependencies

  • cmake (>= 3.10)
  • clang
  • libstdc++-11-dev
  • libgcc-11-dev
  • libudev-dev
  • libc6-dev
  • golang-go (to build BoringSSL)
  • pkg-config (optional, improves BoringSSL build tests)
  • libunwind-dev (optional, improves BoringSSL build tests)
  • autoconf (to build libusb)
  • libtool (to build libusb)

For Debian / Ubuntu:

sudo apt-get install cmake clang libstdc++-11-dev libgcc-11-dev libudev1 libudev-dev golang-go pkg-config libunwind-dev autoconf libtool

Usage

Clone the repositories and install dependencies, then just:

cd adb-standalone-build/
make
make test

By default, messages are logged by each target (e.g. Downloading adb source ..., Building boringssl ..., etc...) and the commands' output is muted to follow the build more easily, but you can tail -f error.log to watch if anything goes wrong, or just comment the SUPPRESS_OUTPUT line in the root Makefile to get full commands output.

Tested on

  • x86_64 Ubuntu 22.04 5.15.0-60-generic / clang 14 / libstdc++-dev 11.3 / libgcc-dev 11.3 / cmake 3.22 / go 1.18 / autoconf 2.71 / libtool 2.4

Screenshot

image

Credits

Initially forked from stevenrao/adb-proj.

This application uses Open Source components. You can find the source code of their open source projects along with license information below. We acknowledge and are grateful to these developers for their contributions to open source.

Project: semver-tool https://github.com/fsaintjacques/semver-tool
Copyright 2023 François Saint-Jacques.
License (Apache License 2.0) https://github.com/fsaintjacques/semver-tool/blob/3.4.0/LICENSE

adb-standalone-build's People

Contributors

sheerlox avatar stevenrao avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

jasoncook32

adb-standalone-build's Issues

use of undeclared identifier 'INT_MAX' when building on RPi4b

clang++ -std=c++20 -c -Iincludes -Idepends/libziparchive/incfs_support/include -Idepends/mdnssd -Idepends/androidfw/include -Idepends/base/include -Idepends/buildversion/include -Idepends/crypto_utils/include -Idepends/cutils/include -Idepends/diagnose_usb/include -Idepends/incfs_util/include -Idepends/libziparchive/include -Idepends/log/include -Idepends/utils/include -Iadb -Iadb/crypto -Iadb/proto -Iadb/fastdeploy/proto -Iadb/pairing_connection/include -Iadb/tls/include -Iadb/crypto/include -Iadb/pairing_auth/include -Iadb/pairing_connection/include -Iadb/tls/include -Iexternal/protobuf/src -Iexternal/boringssl/include -Iexternal/libusb/include -Iexternal/lz4/lib -Iexternal/zstd/lib -Iexternal/zlib -Iexternal/brotli/c/include -DADB_HOST=1 -DANDROID_BASE_UNIQUE_FD_DISABLE_IMPLICIT_CONVERSION=1 adb/tls/adb_ca_list.cpp -o adb/tls/adb_ca_list.o
clang++ -std=c++20 -c -Iincludes -Idepends/libziparchive/incfs_support/include -Idepends/mdnssd -Idepends/androidfw/include -Idepends/base/include -Idepends/buildversion/include -Idepends/crypto_utils/include -Idepends/cutils/include -Idepends/diagnose_usb/include -Idepends/incfs_util/include -Idepends/libziparchive/include -Idepends/log/include -Idepends/utils/include -Iadb -Iadb/crypto -Iadb/proto -Iadb/fastdeploy/proto -Iadb/pairing_connection/include -Iadb/tls/include -Iadb/crypto/include -Iadb/pairing_auth/include -Iadb/pairing_connection/include -Iadb/tls/include -Iexternal/protobuf/src -Iexternal/boringssl/include -Iexternal/libusb/include -Iexternal/lz4/lib -Iexternal/zstd/lib -Iexternal/zlib -Iexternal/brotli/c/include -DADB_HOST=1 -DANDROID_BASE_UNIQUE_FD_DISABLE_IMPLICIT_CONVERSION=1 adb/tls/tls_connection.cpp -o adb/tls/tls_connection.o
adb/tls/tls_connection.cpp:329:80: error: use of undeclared identifier 'INT_MAX'
                SSL_read(ssl_.get(), p8 + offset, std::min(static_cast<size_t>(INT_MAX), size));
                                                                               ^
adb/tls/tls_connection.cpp:349:64: error: use of undeclared identifier 'INT_MAX'
                                  std::min(static_cast<size_t>(INT_MAX), data.size()));
                                                               ^

use of undeclared identifier 'testing' & 'ADD_FAILURE_AT' when building on RPi3b bug

BoringSSL won't build:

pi@raspberrypi:~/workspace/adb-standalone-build $ make
Checking if Platform Tools version 31.0.0 exists...
Platform Tools version 31.0.0 found!
Building boringssl ...
-- Configuring done
-- Generating done
-- Build files have been written to: /home/pi/workspace/adb-standalone-build/src/external/boringssl/build
make[1]: Entering directory '/home/pi/workspace/adb-standalone-build/src/external/boringssl/build'
make[2]: Entering directory '/home/pi/workspace/adb-standalone-build/src/external/boringssl/build'
make[3]: Entering directory '/home/pi/workspace/adb-standalone-build/src/external/boringssl/build'
make[3]: Leaving directory '/home/pi/workspace/adb-standalone-build/src/external/boringssl/build'
[  1%] Built target crypto_test_data
make[3]: Entering directory '/home/pi/workspace/adb-standalone-build/src/external/boringssl/build'
make[3]: Leaving directory '/home/pi/workspace/adb-standalone-build/src/external/boringssl/build'
[  1%] Built target boringssl_gtest
make[3]: Entering directory '/home/pi/workspace/adb-standalone-build/src/external/boringssl/build'
make[3]: Leaving directory '/home/pi/workspace/adb-standalone-build/src/external/boringssl/build'
[  1%] Built target global_target
make[3]: Entering directory '/home/pi/workspace/adb-standalone-build/src/external/boringssl/build'
make[3]: Leaving directory '/home/pi/workspace/adb-standalone-build/src/external/boringssl/build'
make[3]: Entering directory '/home/pi/workspace/adb-standalone-build/src/external/boringssl/build'
[  1%] Building CXX object crypto/test/CMakeFiles/test_support_lib.dir/abi_test.cc.o
In file included from /home/pi/workspace/adb-standalone-build/src/external/boringssl/crypto/test/abi_test.cc:15:
/home/pi/workspace/adb-standalone-build/src/external/boringssl/crypto/test/abi_test.h:420:5: error: use of undeclared identifier 'testing'
    testing::Message msg;
    ^
/home/pi/workspace/adb-standalone-build/src/external/boringssl/crypto/test/abi_test.h:425:5: error: use of undeclared identifier 'ADD_FAILURE_AT'
    ADD_FAILURE_AT(file, line) << msg;
    ^
2 errors generated.
make[3]: *** [crypto/test/CMakeFiles/test_support_lib.dir/build.make:82: crypto/test/CMakeFiles/test_support_lib.dir/abi_test.cc.o] Error 1
make[3]: Leaving directory '/home/pi/workspace/adb-standalone-build/src/external/boringssl/build'
make[2]: *** [CMakeFiles/Makefile2:612: crypto/test/CMakeFiles/test_support_lib.dir/all] Error 2
make[2]: Leaving directory '/home/pi/workspace/adb-standalone-build/src/external/boringssl/build'
make[1]: *** [Makefile:103: all] Error 2
make[1]: Leaving directory '/home/pi/workspace/adb-standalone-build/src/external/boringssl/build'
make: *** [Makefile:342: /home/pi/workspace/adb-standalone-build/out/.libs/libssl.a] Error 2
$ apt list --installed | grep -e libgcc- -e libstdc++- -e cmake -e clang -e libudev-dev -e libc6-dev -e golang-go -e pkg-config -e libunwind-dev -e autoconf -e libtool

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

autoconf/stable,now 2.69-14 all [installed]
clang-11/stable,now 1:11.0.1-2+rpi1 armhf [installed,automatic]
clang/stable,now 1:11.0-51+nmu5 armhf [installed]
cmake-data/stable,now 3.18.4-2+rpt1+rpi1+deb11u1 all [installed,automatic]
cmake/stable,now 3.18.4-2+rpt1+rpi1+deb11u1 armhf [installed]
golang-go/stable,now 2:1.15~1 armhf [installed]
libc6-dev/stable,now 2.31-13+rpt2+rpi1+deb11u5 armhf [installed,automatic]
libclang-common-11-dev/stable,now 1:11.0.1-2+rpi1 armhf [installed,automatic]
libclang-cpp11/stable,now 1:11.0.1-2+rpi1 armhf [installed,automatic]
libclang1-11/stable,now 1:11.0.1-2+rpi1 armhf [installed,automatic]
libgcc-10-dev/stable,now 10.2.1-6+rpi1 armhf [installed,automatic]
libgcc-s1/stable,now 10.2.1-6+rpi1 armhf [installed]
libstdc++-10-dev/stable,now 10.2.1-6+rpi1 armhf [installed,automatic]
libtool/stable,now 2.4.6-15 all [installed]
libudev-dev/stable,now 247.3-7+rpi1+deb11u1 armhf [installed]
libunwind-dev/stable,now 1.3.2-2 armhf [installed]
pkg-config/stable,now 0.29.2-1 armhf [installed]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.