Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Undefined symbols to build or run Pytorch on macOS #660

Closed
essandess opened this issue May 27, 2021 · 7 comments
Closed

Undefined symbols to build or run Pytorch on macOS #660

essandess opened this issue May 27, 2021 · 7 comments
Labels

Comments

@essandess
Copy link

Pytorch fails to compile on macOS because of the undefined symbol google::glog_internal_namespace_::IsGoogleLoggingInitialized():

:info:build Undefined symbols for architecture x86_64:
:info:build   "google::glog_internal_namespace_::IsGoogleLoggingInitialized()", referenced from:
:info:build       c10::InitCaffeLogging(int*, char**) in Logging.cpp.o
:info:build ld: symbol(s) not found for architecture x86_64
:info:build clang: error: linker command failed with exit code 1 (use -v to see invocation)

Related:

@sergiud
Copy link
Collaborator

sergiud commented May 27, 2021

Make sure to use search first. See #125.

@sergiud sergiud closed this as completed May 27, 2021
@essandess
Copy link
Author

Make sure to use search first. See #125.

I'm not familiar enough with the internals of glog or torch's dependence on glog to understand your response. How is this resolved? Are you saying it's an issue with torch? What's the specific resolution?

@sergiud
Copy link
Collaborator

sergiud commented May 28, 2021

There is nothing to resolve in glog. PyTorch uses an internal glog symbol which is not part of the API. The corresponding public API function was added to master only recently (#651).

@xkszltl
Copy link
Contributor

xkszltl commented May 31, 2021

I believe the issue may be much more wide-spread than you expected.

image

Although it's technically UB, I won't blame them for using it because it's the only way to reliably init glog for multiple libs.
It's essentially a large community effort patching glog bug that should be fixed long ago but not.

In glog 0.5.0, there's simply no way around, which can be a major issue for adoption.
Besides, recently I've seen many libs (both open-source and proprietary) hitting the issue on macOS (due the relatively aggressive upgrade of homebrew).

@sergiud
Copy link
Collaborator

sergiud commented May 31, 2021

The very first hit in your screenshot shows a clean way to test whether an initialization was performed which works irrespective of glog version. What's wrong with that?

@xkszltl
Copy link
Contributor

xkszltl commented Jun 1, 2021

That only works if you have full control of glog.
A common scenario is, 2 libs both use glog. They cannot tell whether glog is already initialized by anyone else. They cannot even "try-init" because that'll lead to a fatal error and kill the process:

glog/src/utilities.cc

Lines 337 to 338 in 0b3d4cb

CHECK(!IsGoogleLoggingInitialized())
<< "You called InitGoogleLogging() twice!";

@sergiud
Copy link
Collaborator

sergiud commented Jun 1, 2021

The described scenario doesn't seem to apply to PyTorch.

Regardless, I reject your idea of providing any kind of compatibility to internal symbols as I already made this very clear. The next version of glog will contain the necessary functionality.

I'm locking the discussion due to pointless arguing.

@google google locked and limited conversation to collaborators Jun 1, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants