Skip to content

Commit

Permalink
fix: macos builds not signed, strip debug info on install (#250)
Browse files Browse the repository at this point in the history
* chore:update read to add troubleshooting info on M* macbooks

* `-s -w` on build

---------

Co-authored-by: Reece Williams <reecepbcups@gmail.com>
  • Loading branch information
vimystic and Reecepbcups authored Oct 24, 2024
1 parent 16d8ca2 commit 0f03039
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ endif

DATE := $(shell date '+%Y-%m-%dT%H:%M:%S')
HEAD = $(shell git rev-parse HEAD)
LD_FLAGS = -X main.SpawnVersion=$(VERSION)
# MacOS sequoia + XCode 16 causes the binary to instantly die
# Stripping the debug info with -s -w fixes this so the binary
# is properly signed
# ref: https://github.com/rollchains/spawn/issues/248
LD_FLAGS = -X main.SpawnVersion=$(VERSION) -s -w
BUILD_FLAGS = -mod=readonly -ldflags='$(LD_FLAGS)'

## mod-tidy: go mod tidy spawn, simapp, and interchaintest with proper go.mod suffixes
Expand Down
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,14 @@ make get-localic
# Attempt to run a command
spawn help

# Potential workaround if spawn is immediately killed when attempting run "spawn help" on a m* macbook.
# This may happen because of an xcode16 update.
# To work around this as a temporary measure please change this line in the Make file.
LD_FLAGS = -X main.SpawnVersion=$(VERSION)
# to
LD_FLAGS = -X main.SpawnVersion=$(VERSION) -s -w


# If you get "command 'spawn' not found", add to path.
# Run the following in your terminal to test
# Then add to ~/.bashrc (linux / windows) or ~/.zshrc (mac)
Expand Down
5 changes: 4 additions & 1 deletion simapp/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,14 @@ build_tags_comma_sep := $(subst $(empty),$(comma),$(build_tags))

# process linker flags

# flags '-s -w' resolves an issue with xcode 16 and signing of go binaries
# ref: https://github.com/golang/go/issues/63997
ldflags = -X github.com/cosmos/cosmos-sdk/version.Name=wasm \
-X github.com/cosmos/cosmos-sdk/version.AppName=wasmd \
-X github.com/cosmos/cosmos-sdk/version.Version=$(VERSION) \
-X github.com/cosmos/cosmos-sdk/version.Commit=$(COMMIT) \
-X "github.com/cosmos/cosmos-sdk/version.BuildTags=$(build_tags_comma_sep)"
-X "github.com/cosmos/cosmos-sdk/version.BuildTags=$(build_tags_comma_sep)" \
-s -w

ifeq ($(WITH_CLEVELDB),yes)
ldflags += -X github.com/cosmos/cosmos-sdk/types.DBBackend=cleveldb
Expand Down

0 comments on commit 0f03039

Please sign in to comment.