From 611a3ec959b675c125838fc05a1b4d9c670e6ed5 Mon Sep 17 00:00:00 2001 From: jeremyrhyde <34897732+jeremyrhyde@users.noreply.github.com> Date: Fri, 1 Sep 2023 20:13:14 -0400 Subject: [PATCH] HotFix Adding abseil packages to CGO API (#261) Co-authored-by: James Otting --- Makefile | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 47a72f4d..de059393 100644 --- a/Makefile +++ b/Makefile @@ -101,8 +101,12 @@ viam-cartographer/build/unit_tests: ensure-submodule-initialized grpc/buf cd viam-cartographer && cmake -Bbuild -G Ninja ${EXTRA_CMAKE_FLAGS} && cmake --build build cartographer-module: viam-cartographer/build/unit_tests - rm -f bin/cartographer-module - mkdir -p bin && go build $(GO_BUILD_LDFLAGS) -o bin/cartographer-module module/main.go + rm -f bin/cartographer-module && mkdir -p bin +# Newer versions of abseil require extra ld flags in our module, so this ugly thing. +# It's expected that if NOT using brew, a prebuilt environment (like canon) is in use with the older abseil installed. + absl_version=$$(brew list --versions abseil 2>/dev/null | head -n1 | grep -oE '[0-9]{8}' || echo 20010101); \ + test "$$absl_version" -gt "20230801" && export CGO_LDFLAGS="$$CGO_LDFLAGS -labsl_log_internal_message -labsl_log_internal_check_op" || true; \ + go build $(GO_BUILD_LDFLAGS) -o bin/cartographer-module module/main.go # Ideally build-asan would be added to build-debug, but can't yet # as these options they fail on arm64 linux. This is b/c that