From 7e7bc2271ee00695364b66e6f62698b338b21125 Mon Sep 17 00:00:00 2001 From: Sean McGinnis Date: Tue, 2 Feb 2021 17:17:38 -0600 Subject: [PATCH 1/2] Allow building on macOS Journald is not available on mac. To allow building the rest of the project while working on a mac, use the same flag as the Windows build to skip inclusion of journald. Signed-off-by: Sean McGinnis --- Makefile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Makefile b/Makefile index 4f51d9ded..4532d7afc 100644 --- a/Makefile +++ b/Makefile @@ -53,6 +53,10 @@ IMAGE:=$(REGISTRY)/node-problem-detector:$(TAG) # support needs libsystemd-dev or libsystemd-journal-dev. ENABLE_JOURNALD?=1 +ifeq ($(shell uname -s 2>/dev/null), Darwin) +ENABLE_JOURNALD=0 +endif + # TODO(random-liu): Support different architectures. # The debian-base:v1.0.0 image built from kubernetes repository is based on # Debian Stretch. It includes systemd 232 with support for both +XZ and +LZ4 From 487915e9e47f83864e62619578fecc2308c2e057 Mon Sep 17 00:00:00 2001 From: Sean McGinnis Date: Tue, 2 Feb 2021 20:13:12 -0600 Subject: [PATCH 2/2] Use GOHOSTOS to switch journald plugin build This plugin requires libsystemd to compile, which is only available on Linux. This uses `go env` to determine if the current build platform can support this or not, and if not, disables the building of the plugin to allow compilation on Windows and macOS platforms. Signed-off-by: Sean McGinnis --- Makefile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 4532d7afc..3fecc6c77 100644 --- a/Makefile +++ b/Makefile @@ -53,7 +53,9 @@ IMAGE:=$(REGISTRY)/node-problem-detector:$(TAG) # support needs libsystemd-dev or libsystemd-journal-dev. ENABLE_JOURNALD?=1 -ifeq ($(shell uname -s 2>/dev/null), Darwin) +ifeq ($(go env GOHOSTOS), darwin) +ENABLE_JOURNALD=0 +else ifeq ($(go env GOHOSTOS), windows) ENABLE_JOURNALD=0 endif