We are working in a large Bazel-driven monorepo where we both have C++ bits using libtorch’s dynamic libraries and python code where we’re using PyTorch (using pip). However, when we try to bind the C++ parts using pybind11 to python, we do get a conflict in library resolution and symbols not being found. After all the dynamic libraries provided by libtorch and PyTorch appear to be slightly different.
Clearly a single source of truth is needed. PyTorch seems to come with a BUILD.bazel file, but it doesn’t appear you can build PyTorch using it. Is this correct? Did anyone succeed building PyTorch using Bazel? Any ideas how to address making sure both my C++ libtorch and PyTorch versions are linked to the same shared objects?