diff --git a/src/main/tools/BUILD b/src/main/tools/BUILD index 9f64e096a88349..6d8b0269c40904 100644 --- a/src/main/tools/BUILD +++ b/src/main/tools/BUILD @@ -41,7 +41,11 @@ cc_binary( }), linkopts = select({ "//src/conditions:windows": [], - "//conditions:default": ["-lm"], + "//src/conditions:darwin": ["-lm"], + "//conditions:default": [ + "-lm", + "-lrt", + ], }), deps = select({ "//src/conditions:windows": [], @@ -86,7 +90,16 @@ cc_binary( "linux-sandbox-pid1.h", ], }), - linkopts = ["-lm"], + linkopts = select({ + "//src/conditions:darwin": [], + "//src/conditions:freebsd": [], + "//src/conditions:openbsd": [], + "//src/conditions:windows": [], + "//conditions:default": [ + "-lm", + "-lrt", + ], + }), deps = select({ "//src/conditions:darwin": [], "//src/conditions:freebsd": [], diff --git a/src/main/tools/logging.h b/src/main/tools/logging.h index c3abe35e231758..14b46c92561b10 100644 --- a/src/main/tools/logging.h +++ b/src/main/tools/logging.h @@ -15,6 +15,10 @@ #ifndef SRC_MAIN_TOOLS_LOGGING_H_ #define SRC_MAIN_TOOLS_LOGGING_H_ +// See https://stackoverflow.com/a/8132440 . +#ifndef __STDC_FORMAT_MACROS +#define __STDC_FORMAT_MACROS +#endif #include #include #include