From 2b0b0a0e7882a7af5efa843b598a4d42b49b47b4 Mon Sep 17 00:00:00 2001 From: Jia Hao Date: Wed, 26 Apr 2023 08:16:05 +0000 Subject: [PATCH] Log dlopen errors in opt builds (flutter/engine#41477) As the Engine uses `dlopen` to find the `libapp.so`, https://github.com/flutter/flutter/issues/59834 can happen which will prevent `dlopen` from finding the binary. In theory this should be mitigated by https://github.com/flutter/engine/pull/9762, but an internal customer observed errors that could be related. The additional logging here can help to rule out that hypothesis. For Googlers, see b/276657840 for more details. [C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style --- .../src/flutter/fml/platform/posix/native_library_posix.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/engine/src/flutter/fml/platform/posix/native_library_posix.cc b/engine/src/flutter/fml/platform/posix/native_library_posix.cc index 43406bc21b..5e595c5487 100644 --- a/engine/src/flutter/fml/platform/posix/native_library_posix.cc +++ b/engine/src/flutter/fml/platform/posix/native_library_posix.cc @@ -13,8 +13,10 @@ NativeLibrary::NativeLibrary(const char* path) { ::dlerror(); handle_ = ::dlopen(path, RTLD_NOW); if (handle_ == nullptr) { - FML_DLOG(ERROR) << "Could not open library '" << path << "' due to error '" - << ::dlerror() << "'."; + // TODO(jiahaog): Use FML_DLOG: + // https://github.com/flutter/flutter/issues/125523 + FML_LOG(ERROR) << "Could not open library '" << path << "' due to error '" + << ::dlerror() << "'."; } }