mirror of
https://github.com/0glabs/0g-chain.git
synced 2024-11-14 12:05:18 +00:00
fix wasm static link (#57)
This commit is contained in:
parent
8b691e61f8
commit
500e66733d
4
.github/workflows/upload-release-assets.yml
vendored
4
.github/workflows/upload-release-assets.yml
vendored
@ -14,9 +14,9 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
go-version: '1.21'
|
go-version: '1.21'
|
||||||
- name: Build
|
- name: Build
|
||||||
run: make build
|
run: sudo LINK_STATICALLY=true make build-release
|
||||||
- name: Rename file
|
- name: Rename file
|
||||||
run: mv ./out/linux/0gchaind ./out/linux/0gchaind-linux-${{ github.ref_name }}
|
run: sudo mv ./out/linux/0gchaind ./out/linux/0gchaind-linux-${{ github.ref_name }}
|
||||||
- name: Upload Release Asset
|
- name: Upload Release Asset
|
||||||
uses: softprops/action-gh-release@v2
|
uses: softprops/action-gh-release@v2
|
||||||
with:
|
with:
|
||||||
|
9
Makefile
9
Makefile
@ -6,6 +6,8 @@ BINARY_NAME := 0gchaind
|
|||||||
MAIN_ENTRY := ./cmd/$(BINARY_NAME)
|
MAIN_ENTRY := ./cmd/$(BINARY_NAME)
|
||||||
DOCKER_IMAGE_NAME := 0glabs/$(PROJECT_NAME)
|
DOCKER_IMAGE_NAME := 0glabs/$(PROJECT_NAME)
|
||||||
GO_BIN ?= go
|
GO_BIN ?= go
|
||||||
|
ARCH := $(shell uname -m)
|
||||||
|
WASMVM_VERSION := $(shell $(GO_BIN) list -m github.com/CosmWasm/wasmvm | sed 's/.* //')
|
||||||
|
|
||||||
GIT_BRANCH := $(shell git rev-parse --abbrev-ref HEAD)
|
GIT_BRANCH := $(shell git rev-parse --abbrev-ref HEAD)
|
||||||
GIT_COMMIT := $(shell git rev-parse HEAD)
|
GIT_COMMIT := $(shell git rev-parse HEAD)
|
||||||
@ -176,8 +178,9 @@ endif
|
|||||||
ifeq (,$(findstring nostrip,$(COSMOS_BUILD_OPTIONS)))
|
ifeq (,$(findstring nostrip,$(COSMOS_BUILD_OPTIONS)))
|
||||||
ldflags += -w -s
|
ldflags += -w -s
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(LINK_STATICALLY),true)
|
ifeq ($(LINK_STATICALLY),true)
|
||||||
ldflags += -linkmode=external -extldflags "-Wl,-z,muldefs -static"
|
ldflags += -linkmode=external -extldflags "-Wl,-z,muldefs -static -lm"
|
||||||
endif
|
endif
|
||||||
ldflags += $(LDFLAGS)
|
ldflags += $(LDFLAGS)
|
||||||
ldflags := $(strip $(ldflags))
|
ldflags := $(strip $(ldflags))
|
||||||
@ -200,6 +203,10 @@ else
|
|||||||
$(GO_BIN) build -mod=readonly $(BUILD_FLAGS) -o out/$(shell $(GO_BIN) env GOOS)/$(BINARY_NAME) $(MAIN_ENTRY)
|
$(GO_BIN) build -mod=readonly $(BUILD_FLAGS) -o out/$(shell $(GO_BIN) env GOOS)/$(BINARY_NAME) $(MAIN_ENTRY)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
build-release: go.sum
|
||||||
|
wget -q https://github.com/CosmWasm/wasmvm/releases/download/$(WASMVM_VERSION)/libwasmvm_muslc.$(ARCH).a -O /lib/libwasmvm.$(ARCH).a
|
||||||
|
$(GO_BIN) build -mod=readonly $(BUILD_FLAGS) -o out/$(shell $(GO_BIN) env GOOS)/$(BINARY_NAME) $(MAIN_ENTRY)
|
||||||
|
|
||||||
build-linux: go.sum
|
build-linux: go.sum
|
||||||
LEDGER_ENABLED=false GOOS=linux GOARCH=amd64 $(MAKE) build
|
LEDGER_ENABLED=false GOOS=linux GOARCH=amd64 $(MAKE) build
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user