Skip to content

Commit

Permalink
linux-sandbox: don't assume -lrt, -D__STDC_FORMAT_MACROS
Browse files Browse the repository at this point in the history
Resolves bazelbuild#12327.

Closes bazelbuild#12662.

PiperOrigin-RevId: 346374211
  • Loading branch information
rbeasley authored and Copybara-Service committed Dec 8, 2020
1 parent ace6652 commit f8606e5
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
17 changes: 15 additions & 2 deletions src/main/tools/BUILD
Expand Up @@ -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": [],
Expand Down Expand Up @@ -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": [],
Expand Down
4 changes: 4 additions & 0 deletions src/main/tools/logging.h
Expand Up @@ -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 <inttypes.h>
#include <stdint.h>
#include <stdio.h>
Expand Down

0 comments on commit f8606e5

Please sign in to comment.