#============================================================================== # Patch to fix reference to google-glog's IsGoogleLoggingInitialized(). # In versions prior to 0.5.0, that function was in namespace # 'google::glog_internal_namespace_'. Then the function was hidden in 0.5.0, # breaking dependents which rely on it. # # Meanwhile, google-glog has an upstream fix, which exposes that API via # public namespace 'google'. (And MacPorts includes that in our 'google-glog' # port.) # # As for PyTorch, it still relies on the internal namespace, which doesn't # work with google-glob 0.5.0+. So, patch to utilize public API, until PyTorch # upstream provides a formal fix. # # -CNielsen 2022-02-16 #============================================================================== --- c10/util/Logging.cpp 2022-07-17 07:08:04.000000000 -0400 +++ c10/util/Logging.cpp 2022-07-17 07:13:34.000000000 -0400 @@ -192,23 +192,13 @@ google::GLOG_WARNING, "The minimum log level that caffe2 will output."); -// Google glog's api does not have an external function that allows one to check -// if glog is initialized or not. It does have an internal function - so we are -// declaring it here. This is a hack but has been used by a bunch of others too -// (e.g. Torch). -namespace google { -namespace glog_internal_namespace_ { -bool IsGoogleLoggingInitialized(); -} // namespace glog_internal_namespace_ -} // namespace google - namespace c10 { namespace { void initGoogleLogging(char const* name) { #if !defined(_MSC_VER) // This trick can only be used on UNIX platforms - if (!::google::glog_internal_namespace_::IsGoogleLoggingInitialized()) + if (!::google::IsGoogleLoggingInitialized()) #endif { ::google::InitGoogleLogging(name);