Skip to content

Commit

Permalink
Caplin: Tweaked CGO_Flags (#11144)
Browse files Browse the repository at this point in the history
  • Loading branch information
Giulio2002 authored Jul 14, 2024
1 parent 9890a94 commit 4a02c66
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 6 deletions.
17 changes: 14 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,21 @@ CGO_CFLAGS += -DMDBX_DISABLE_VALIDATION=0 # Can disable it on CI by separated PR
#CGO_CFLAGS += -DMDBX_ENABLE_PROFGC=0 # Disabled by default, but may be useful for performance debugging
#CGO_CFLAGS += -DMDBX_ENABLE_PGOP_STAT=0 # Disabled by default, but may be useful for performance debugging
CGO_CFLAGS += -DMDBX_ENV_CHECKPID=0 # Erigon doesn't do fork() syscall
CGO_CFLAGS += -D__BLST_PORTABLE__
CGO_CFLAGS += -Wno-unknown-warning-option -Wno-enum-int-mismatch -Wno-strict-prototypes -Wno-unused-but-set-variable

# If it is arm64 or aarch64, then we need to use portable version of blst. use or with stringw "arm64" and "aarch64" to support both
ifeq ($(shell uname -m), arm64)
CGO_CFLAGS += -D__BLST_PORTABLE__
endif
ifeq ($(shell uname -m), aarch64)
CGO_CFLAGS += -D__BLST_PORTABLE__
endif


CGO_CFLAGS += -Wno-unknown-warning-option -Wno-enum-int-mismatch -Wno-strict-prototypes -Wno-unused-but-set-variable -O3

CGO_LDFLAGS := $(shell $(GO) env CGO_LDFLAGS 2> /dev/null)
CGO_LDFLAGS += -O3 -g

ifeq ($(shell uname -s), Darwin)
ifeq ($(filter-out 13.%,$(shell sw_vers --productVersion)),)
CGO_LDFLAGS += -mmacosx-version-min=13.3
Expand All @@ -44,7 +55,7 @@ GOPRIVATE = github.com/erigontech/silkworm-go

PACKAGE = github.com/ledgerwatch/erigon

GO_FLAGS += -trimpath -tags $(BUILD_TAGS) -buildvcs=false
GO_FLAGS += -trimpath -tags $(BUILD_TAGS) -buildvcs=false
GO_FLAGS += -ldflags "-X ${PACKAGE}/params.GitCommit=${GIT_COMMIT} -X ${PACKAGE}/params.GitBranch=${GIT_BRANCH} -X ${PACKAGE}/params.GitTag=${GIT_TAG}"

GOBUILD = CGO_CFLAGS="$(CGO_CFLAGS)" CGO_LDFLAGS="$(CGO_LDFLAGS)" GOPRIVATE="$(GOPRIVATE)" $(GO) build $(GO_FLAGS)
Expand Down
4 changes: 3 additions & 1 deletion cl/antiquary/antiquary.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,9 @@ func (a *Antiquary) Loop() error {
return err
}
defer logInterval.Stop()
log.Info("[Antiquary] Stopping Caplin to process historical indicies", "from", from, "to", a.sn.BlocksAvailable())
if from != a.sn.BlocksAvailable() {
log.Info("[Antiquary] Stopping Caplin to process historical indicies", "from", from, "to", a.sn.BlocksAvailable())
}

// Now write the snapshots as indicies
for i := from; i < a.sn.BlocksAvailable(); i++ {
Expand Down
4 changes: 2 additions & 2 deletions cmd/capcli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ func (c *ChainEndpoint) Run(ctx *Context) error {
// Let's fetch the head first
currentBlock, err := core.RetrieveBlock(ctx, beaconConfig, fmt.Sprintf("%s/head", baseUri), nil)
if err != nil {
return err
return fmt.Errorf("failed to retrieve head: %w, uri: %s", err, fmt.Sprintf("%s/head", baseUri))
}
currentRoot, err := currentBlock.Block.HashSSZ()
if err != nil {
Expand Down Expand Up @@ -246,7 +246,7 @@ func (c *ChainEndpoint) Run(ctx *Context) error {
// Let's fetch the head first
currentBlock, err := core.RetrieveBlock(ctx, beaconConfig, fmt.Sprintf("%s/0x%s", baseUri, stringifiedRoot), (*libcommon.Hash)(&currentRoot))
if err != nil {
return false, err
return false, fmt.Errorf("failed to retrieve block: %w, uri: %s", err, fmt.Sprintf("%s/0x%s", baseUri, stringifiedRoot))
}
currentRoot, err = currentBlock.Block.HashSSZ()
if err != nil {
Expand Down

0 comments on commit 4a02c66

Please sign in to comment.