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

Redefined macros due to use of Abseil and TSL logging #11132

Open
Flamefire opened this issue Apr 2, 2024 · 0 comments
Open

Redefined macros due to use of Abseil and TSL logging #11132

Flamefire opened this issue Apr 2, 2024 · 0 comments

Comments

@Flamefire
Copy link
Contributor

The build shows many issues about redefined CHECK macros such as:

In file included from external/xla/xla/status.h:19,
                 from external/xla/xla/pjrt/exceptions.h:28,
                 from external/xla/xla/pjrt/status_casters.h:19,
                 from external/xla/xla/python/pjit.cc:32:
external/com_google_absl/absl/log/check.h:57: warning: "CHECK" redefined
   57 | #define CHECK(condition) ABSL_LOG_INTERNAL_CHECK_IMPL((condition), #condition)
      | 
In file included from external/tsl/tsl/platform/logging.h:26,
                 from external/xla/xla/pjrt/lru_cache.h:22,
                 from external/xla/xla/python/pjit.cc:31:
external/tsl/tsl/platform/default/logging.h:308: note: this is the location of the previous definition
  308 | #define CHECK(condition)              \

The reason is that both Abseil and TSL are used to get those macros. E.g.

#include "absl/log/check.h" // IWYU pragma: export
and
#include "tsl/platform/logging.h"

3edc99b was an attempt to fix this by undefining the CHECK macros in TSL. However now it depends on the import order which set of macros is "active" and whether those warnings are shown.

A proper fix as mentioned in that commit is to NEVER introduce macros without some kind of prefix. Especially not macros with such generic names which are even known to be defined/used in other libraries used.

An intermediate fix is to commit at least in a single library to one set of macros. I.e. not use Abseil and TSL from XLA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant