sheerlox / adb-standalone-build

adb (Android Debug Bridge) standalone build suite
GNU General Public License v3.0
2 stars 1 forks source link

use of undeclared identifier 'INT_MAX' when building on RPi4b #1

Open sheerlox opened 1 year ago

sheerlox commented 1 year ago
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()));
                                                               ^
sheerlox commented 1 year ago

adding #include <limits.h> to adb/tls/tls_connection.cpp fixed the issue, investigate why it wasn't required on my laptop (might also explain how Google uses std:: features without including them (e.g. atomic & functional, see patch_adb_source target)

sheerlox commented 1 year ago

this might be because the installed Debian distro doesn't ship libstdc++-11-dev &libgcc-11-dev, max availables version is 10.

some more infos:

$ uname -a
Linux raspberrypi 5.15.84-v8+ #1613 SMP PREEMPT Thu Jan 5 12:03:08 GMT 2023 aarch64 GNU/Linux

$ cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 11 (bullseye)"
NAME="Debian GNU/Linux"
VERSION_ID="11"
VERSION="11 (bullseye)"
VERSION_CODENAME=bullseye

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