From 5de54fef69eecad83eeb90f200e6d9b36669b1e3 Mon Sep 17 00:00:00 2001 From: Devin Hilly Date: Tue, 23 May 2023 16:53:38 -0400 Subject: [PATCH] RSDK-2890: Find OpenSSL correctly on MacOS (#69) Co-authored-by: Katharina Xenia Kufieta --- .github/workflows/pullrequest-trusted.yml | 6 +++--- Makefile | 8 ++------ README.md | 2 +- viam-cartographer/scripts/build_viam_cartographer.sh | 1 + viam-cartographer/scripts/setup_cartographer_macos.sh | 5 ++--- 5 files changed, 9 insertions(+), 13 deletions(-) diff --git a/.github/workflows/pullrequest-trusted.yml b/.github/workflows/pullrequest-trusted.yml index a391b04c..f1038e70 100644 --- a/.github/workflows/pullrequest-trusted.yml +++ b/.github/workflows/pullrequest-trusted.yml @@ -19,7 +19,7 @@ jobs: if: github.event.label.name == 'safe to test' || contains(github.event.pull_request.labels.*.name, 'appimage') || contains(github.event.pull_request.labels.*.name, 'appimage-ignore-tests') - uses: viamrobotics/viam-cartographer/.github/workflows/test.yml@main + uses: viamrobotics/viam-cartographer/.github/workflows/test.yml@RSDK-2890 # This lets people add an "appimage" tag to have appimages built for the PR appimage: @@ -28,7 +28,7 @@ jobs: always() && !cancelled() && contains(github.event.pull_request.labels.*.name, 'safe to test') && !contains(github.event.pull_request.labels.*.name, 'appimage-ignore-tests') && contains(github.event.pull_request.labels.*.name, 'appimage') && needs.test.result == 'success' - uses: viamrobotics/viam-cartographer/.github/workflows/appimage.yml@main + uses: viamrobotics/viam-cartographer/.github/workflows/appimage.yml@RSDK-2890 secrets: GCP_CREDENTIALS: ${{ secrets.GCP_CREDENTIALS }} @@ -36,6 +36,6 @@ jobs: if: | always() && !cancelled() && contains(github.event.pull_request.labels.*.name, 'safe to test') && contains(github.event.pull_request.labels.*.name, 'appimage-ignore-tests') - uses: viamrobotics/viam-cartographer/.github/workflows/appimage.yml@main + uses: viamrobotics/viam-cartographer/.github/workflows/appimage.yml@RSDK-2890 secrets: GCP_CREDENTIALS: ${{ secrets.GCP_CREDENTIALS }} diff --git a/Makefile b/Makefile index 222a5c03..2787a707 100644 --- a/Makefile +++ b/Makefile @@ -5,13 +5,10 @@ GIT_REVISION = $(shell git rev-parse HEAD | tr -d '\n') TAG_VERSION?=$(shell git tag --points-at | sort -Vr | head -n1) GO_BUILD_LDFLAGS = -ldflags "-X 'main.Version=${TAG_VERSION}' -X 'main.GitRevision=${GIT_REVISION}'" -set-pkg-config-openssl: - pkg-config openssl || export PKG_CONFIG_PATH=$$PKG_CONFIG_PATH:`find \`which brew > /dev/null && brew --prefix\` -name openssl.pc | head -n1 | xargs dirname` - bufinstall: sudo apt-get install -y protobuf-compiler-grpc libgrpc-dev libgrpc++-dev || brew install grpc openssl --quiet -bufsetup: set-pkg-config-openssl +bufsetup: GOBIN=`pwd`/grpc/bin go install github.com/bufbuild/buf/cmd/buf@v1.8.0 ln -sf `which grpc_cpp_plugin` grpc/bin/protoc-gen-grpc-cpp @@ -68,14 +65,13 @@ lint-go: lint: ensure-submodule-initialized lint-cpp lint-go -setup: ensure-submodule-initialized set-pkg-config-openssl +setup: ensure-submodule-initialized ifeq ("Darwin", "$(shell uname -s)") cd viam-cartographer/scripts && ./setup_cartographer_macos.sh else cd viam-cartographer/scripts && ./setup_cartographer_linux.sh endif - build: build-module ifneq ($(wildcard viam-cartographer/cartographer/build/.),) cd viam-cartographer && ./scripts/build_viam_cartographer.sh diff --git a/README.md b/README.md index 61169c65..d5d9b90f 100644 --- a/README.md +++ b/README.md @@ -88,7 +88,7 @@ These containers are set to persist between sessions via the `persistent` parame make bufinstall && make buf # Install dependencies make setup -# Build the binary +# Build & install the binary make build # Install lua files make install-lua-files diff --git a/viam-cartographer/scripts/build_viam_cartographer.sh b/viam-cartographer/scripts/build_viam_cartographer.sh index a6745642..f744838f 100755 --- a/viam-cartographer/scripts/build_viam_cartographer.sh +++ b/viam-cartographer/scripts/build_viam_cartographer.sh @@ -6,6 +6,7 @@ if [ "$(uname)" == "Linux" ]; then elif [ "$(uname)" == "Darwin" ]; then readlinkorreal() { readlink "$1" || echo "$1"; } cd $(dirname string readlinkorreal "${BASH_SOURCE}")/.. + which brew && export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:`brew --prefix openssl@3`/lib/pkgconfig" else echo ERROR: your OS is not handled yet exit 1 diff --git a/viam-cartographer/scripts/setup_cartographer_macos.sh b/viam-cartographer/scripts/setup_cartographer_macos.sh index 39276ff9..6ac53560 100755 --- a/viam-cartographer/scripts/setup_cartographer_macos.sh +++ b/viam-cartographer/scripts/setup_cartographer_macos.sh @@ -2,8 +2,7 @@ echo "Installing cartographer external dependencies" brew update brew upgrade -brew install abseil boost ceres-solver protobuf ninja cairo googletest lua@5.3 +brew install abseil boost ceres-solver protobuf ninja cairo googletest lua@5.3 pkg-config cmake go@1.20 grpc brew link lua@5.3 -brew install openssl eigen gflags glog suite-sparse sphinx-doc pcl +brew install openssl@3 eigen gflags glog suite-sparse sphinx-doc pcl brew link protobuf -brew link openssl --force