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
This commit is contained in:
Jia Hao
2023-04-26 08:16:05 +00:00
committed by GitHub
parent 9787483f0c
commit 2b0b0a0e78

View File

@@ -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() << "'.";
}
}