Skip to content

Commit

Permalink
Set macOS deployment target in Makefile (#2042)
Browse files Browse the repository at this point in the history
The idea is to avoid warnings like:
```
ld: warning: object file XX was built for newer macOS
version (14.4) than being linked (14.0)
```
  • Loading branch information
derrix060 authored Aug 9, 2024
1 parent 3cf58a1 commit 198991f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ endif

ifeq ($(shell uname -s),Darwin)
export CGO_LDFLAGS=-framework Foundation -framework SystemConfiguration

# Set macOS deployment target in order to avoid linker warnings linke
# "ld: warning: object file XX was built for newer macOS version (14.4) than being linked (14.0)"
export MACOSX_DEPLOYMENT_TARGET=$(shell sw_vers --productVersion)

# for test-race we need to pass -ldflags to fix linker warnings on macOS
# see https://github.com/golang/go/issues/61229#issuecomment-1988965927
TEST_RACE_LDFLAGS=-ldflags=-extldflags=-Wl,-ld_classic
Expand Down

0 comments on commit 198991f

Please sign in to comment.