nmeum / android-tools

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

Upgrade to platform-tools-35.0.1 #144

Closed Biswa96 closed 4 months ago

Biswa96 commented 4 months ago

I do not know how to troubleshoot the compiler error in Fedora.

munix9 commented 4 months ago

I can reproduce the error in openSUSE Tumbleweed with gcc 14.

With the following patch the build works with clang, gcc 13 and gcc 14, but I'm not sure if this is the clean way to do it:

--- a/vendor/boringssl/crypto/internal.h
+++ b/vendor/boringssl/crypto/internal.h
@@ -1144,7 +1144,7 @@ static inline uint64_t CRYPTO_rotr_u64(u

 // CRYPTO_addc_* returns |x + y + carry|, and sets |*out_carry| to the carry
 // bit. |carry| must be zero or one.
-#if OPENSSL_HAS_BUILTIN(__builtin_addc)
+#if OPENSSL_HAS_BUILTIN(__builtin_addc) && (!defined(__GNUC__) || (defined(__GNUC__) && (__GNUC__ < 14)))

 #define CRYPTO_GENERIC_ADDC(x, y, carry, out_carry) \
   (_Generic((x),                                    \
@@ -1196,7 +1196,7 @@ static inline uint64_t CRYPTO_addc_u64(u

 // CRYPTO_subc_* returns |x - y - borrow|, and sets |*out_borrow| to the borrow
 // bit. |borrow| must be zero or one.
-#if OPENSSL_HAS_BUILTIN(__builtin_subc)
+#if OPENSSL_HAS_BUILTIN(__builtin_subc) && (!defined(__GNUC__) || (defined(__GNUC__) && (__GNUC__ < 14)))

 #define CRYPTO_GENERIC_SUBC(x, y, borrow, out_borrow) \
   (_Generic((x),                                      \
Biswa96 commented 4 months ago

That seems more like workaround. Is gcc 14 released yet?

munix9 commented 4 months ago

Yes of course, that would be a workaround. Fedora apparently already uses gcc 14 by default. openSUSE Tumbleweed already offers gcc 14, but gcc 13 is currently still the default.

Another possibility would be to adapt the checks for fedora so that gcc 13 is used (if it is offered).

Biswa96 commented 4 months ago

I have added the above workaround for gcc 14. Waiting for reviews...

anatol commented 4 months ago

The remaining issue is with opensuse/leap:latest:

/usr/bin/ld: warning: libabsl_die_if_null.so.2308.0.0, needed by /usr/lib64/libprotobuf.so.25.1.0, may conflict with libabsl_die_if_null.so.2401.0.0
/usr/bin/ld: warning: libabsl_statusor.so.2308.0.0, needed by /usr/lib64/libprotobuf.so.25.1.0, may conflict with libabsl_statusor.so.2401.0.0
/usr/bin/ld: warning: libabsl_log_internal_check_op.so.2308.0.0, needed by /usr/lib64/libprotobuf.so.25.1.0, may conflict with libabsl_log_internal_check_op.so.2401.0.0
/usr/bin/ld: warning: libabsl_log_internal_conditions.so.2308.0.0, needed by /usr/lib64/libprotobuf.so.25.1.0, may conflict with libabsl_log_internal_conditions.so.2401.0.0
/usr/bin/ld: warning: libabsl_log_internal_message.so.2308.0.0, needed by /usr/lib64/libprotobuf.so.25.1.0, may conflict with libabsl_log_internal_message.so.2401.0.0
...
/usr/bin/ld: vendor/libliblpdump.a(dynamic_partitions_device_info.pb.cc.o): in function `android::DynamicPartitionsDeviceInfoProto::GetMetadata() const':
dynamic_partitions_device_info.pb.cc:(.text+0x1ab6): undefined reference to `google::protobuf::internal::AssignDescriptors(google::protobuf::internal::DescriptorTable const* (*)(), absl::lts_20240116::once_flag*, google::protobuf::Metadata const&)'
/usr/bin/ld: vendor/liblibjsonpbparse.a(jsonpb.cpp.o): in function `android::jsonpb::MessageToJsonString[abi:cxx11](google::protobuf::Message const&)':
jsonpb.cpp:(.text+0x209): undefined reference to `google::protobuf::util::NewTypeResolverForDescriptorPool(absl::lts_20240116::string_view, google::protobuf::DescriptorPool const*)'
/usr/bin/ld: vendor/liblibjsonpbparse.a(jsonpb.cpp.o): in function `android::jsonpb::internal::JsonStringToMessage(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, google::protobuf::Message*)':
jsonpb.cpp:(.text+0x5cc): undefined reference to `google::protobuf::util::NewTypeResolverForDescriptorPool(absl::lts_20240116::string_view, google::protobuf::DescriptorPool const*)'
/usr/bin/ld: jsonpb.cpp:(.text+0x62e): undefined reference to `google::protobuf::json::JsonToBinaryString(google::protobuf::util::TypeResolver*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, absl::lts_20240116::string_view, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, google::protobuf::json::ParseOptions const&)'
/usr/bin/ld: jsonpb.cpp:(.text+0x65f): undefined reference to `google::protobuf::MessageLite::ParseFromString(absl::lts_20240116::string_view)'
clang-15.0: error: linker command failed with exit code 1 (use -v to see invocation)

could it be opensuse problem given that their system has libabsl version clash?

munix9 commented 4 months ago

That is correct. The problem is known and a solution is being worked on. It has probably already been fixed for the next version Leap 15.6, but unfortunately not yet for the current "latest" version, i.e. Leap 15.5.

anatol commented 4 months ago

It is great to hear. @munix9 do you have a link to the upstream discussion to learn more about the root of the problem and proposed solution?

munix9 commented 4 months ago

The basic problem is probably that Leap also uses binary packages from the SUSE distribution (the commercial one with support). There protobuf is linked with libabsl 2308.0.0, but other packages only in Leap are linked with libabsl 2401.0.0. This leads to conflicts with some other packages. This must now be resolved.

https://github.com/nmeum/android-tools/issues/143 https://bugzilla.opensuse.org/show_bug.cgi?id=1222343

anatol commented 4 months ago

As the opensuse bot issue is identified as the upstream one I am +1 with merging this PR into master. Opensuse will catch up and the buildbot will be eventually fixed.

anatol commented 4 months ago

master looks good to me. It is time for a new 35.0.1 release!