nmeum / android-tools

Unoffical CMake-based build system for android command line utilities
Apache License 2.0
177 stars 51 forks source link

Fails to build on macOS Ventura 13.5.2 #124

Closed salvogiangri closed 5 months ago

salvogiangri commented 11 months ago

The following error occurs when trying to build the tools macOS Ventura 13.5.2, my device is a MacBook Pro 2021 with M1 Pro (Apple Silicon).

In file included from /Users/salvo/Downloads/android-tools-34.0.4/vendor/adb/client/adb_wifi.cpp:23:
/Users/salvo/Downloads/android-tools-34.0.4/vendor/adb/crypto/include/adb/crypto/key.h:31:18: error: use of undeclared identifier 'bssl'
    explicit Key(bssl::UniquePtr<EVP_PKEY>&& pkey, adb::proto::KeyType type)
                 ^
/Users/salvo/Downloads/android-tools-34.0.4/vendor/adb/crypto/include/adb/crypto/key.h:41:5: error: use of undeclared identifier 'bssl'
    bssl::UniquePtr<EVP_PKEY> pkey_;
    ^
In file included from /Users/salvo/Downloads/android-tools-34.0.4/vendor/adb/client/adb_wifi.cpp:24:
/Users/salvo/Downloads/android-tools-34.0.4/vendor/adb/crypto/include/adb/crypto/x509_generator.h:25:1: error: use of undeclared identifier 'bssl'
bssl::UniquePtr<X509> GenerateX509Certificate(EVP_PKEY* pkey);
^
In file included from /Users/salvo/Downloads/android-tools-34.0.4/vendor/adb/client/adb_wifi.cpp:29:
/Users/salvo/Downloads/android-tools-34.0.4/vendor/adb/adb_auth.h:41:1: error: use of undeclared identifier 'bssl'
bssl::UniquePtr<EVP_PKEY> adb_auth_get_user_privkey();
^
4 errors generated.
make[2]: *** [vendor/CMakeFiles/libadb.dir/adb/client/adb_wifi.cpp.o] Error 1
make[1]: *** [vendor/CMakeFiles/libadb.dir/all] Error 2
make: *** [all] Error 2

CMake output:

➜  build cmake ..
-- The C compiler identification is AppleClang 14.0.3.14030022
-- The CXX compiler identification is AppleClang 14.0.3.14030022
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found Perl: /usr/bin/perl (found version "5.30.3") 
-- The ASM compiler identification is AppleClang
-- Found assembler: /Library/Developer/CommandLineTools/usr/bin/cc
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE  
-- Version: 7.1.3
-- Build type: 
-- CXX_STANDARD: 20
-- Performing Test has_std_20_flag
-- Performing Test has_std_20_flag - Success
-- Performing Test has_std_2a_flag
-- Performing Test has_std_2a_flag - Success
-- Performing Test SUPPORTS_USER_DEFINED_LITERALS
-- Performing Test SUPPORTS_USER_DEFINED_LITERALS - Success
-- Performing Test FMT_HAS_VARIANT
-- Performing Test FMT_HAS_VARIANT - Success
-- Required features: cxx_variadic_templates
-- Performing Test HAS_NULLPTR_WARNING
-- Performing Test HAS_NULLPTR_WARNING - Success
-- Looking for strtod_l
-- Looking for strtod_l - found
-- Found PkgConfig: /opt/homebrew/bin/pkg-config (found version "0.29.2") 
-- Checking for module 'libbrotlicommon'
--   Found libbrotlicommon, version 1.1.0
-- Checking for module 'libbrotlidec'
--   Found libbrotlidec, version 1.1.0
-- Checking for module 'libbrotlienc'
--   Found libbrotlienc, version 1.1.0
-- Checking for module 'liblz4'
--   Found liblz4, version 1.9.4
-- Checking for module 'libpcre2-8'
--   Found libpcre2-8, version 10.42
-- Checking for module 'libusb-1.0'
--   Found libusb-1.0, version 1.0.26
-- Checking for module 'libzstd'
--   Found libzstd, version 1.5.5
-- Found ZLIB: /Library/Developer/CommandLineTools/SDKs/MacOSX13.3.sdk/usr/lib/libz.tbd (found version "1.2.11")  
-- Found Protobuf: /opt/homebrew/lib/libprotobuf.dylib (found version "4.24.3") 
-- Looking for strlcpy
-- Looking for strlcpy - found
-- Looking for reallocarray
-- Looking for reallocarray - not found
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Configuring done (1.9s)
-- Generating done (0.2s)
-- Build files have been written to: /Users/salvo/Downloads/android-tools-34.0.4/build
Biswa96 commented 11 months ago

The build failure can not be reproduced in CI. The full build log in macos 13 can be found here https://github.com/nmeum/android-tools/actions/runs/6147234880

Please make sure openssl is not installed. It conflicts with boringssl headers.

salvogiangri commented 11 months ago

Unfortunately I can't test myself as I do have openssl installed but it is required by some packages installed in my system:

Error: Refusing to uninstall /opt/homebrew/Cellar/openssl@3/3.1.2
because it is required by ffmpeg, gnutls, libevent, pillow, python@3.11, srt, tcl-tk and unbound, which are currently installed.

Would be great if someone else could test this out.

Biswa96 commented 11 months ago

Could you open an discussion in https://github.com/orgs/Homebrew/discussions ? They may provide some info. This seems to happen with macos only. I can not reproduce the issue in Linux or Windows systems (both with gcc or clang).

One quick workaround would be to rename the openssl include directories in system. In CI, I forcefully remove the openssl include directories.

Another workaround could be from Homebrew side - splitting the openssl package into binaries and headers. But that may cause issue in other projects.

Atemu commented 11 months ago

FYI: android-tools builds just fine in Nixpkgs. This must be a brew or whatever issue.

Biswa96 commented 5 months ago

Closing as the issue is not caused by this project directly.

nks017 commented 3 months ago

Facing same issue