Skip to content

Commit 2b7f68f

Browse files
feat: 静态编译不依赖 glibc
1 parent c82e20e commit 2b7f68f

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

.goreleaser.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@ builds:
1616
- -trimpath
1717
ldflags:
1818
- -w -s
19-
- --extldflags "-static -fpic"
20-
tags:
21-
- osusergo
2219
goos:
2320
- linux
2421
goarm:

Makefile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,16 @@ build_frontend:
2323

2424
build_backend_on_linux:
2525
cd $(SERVER_PATH) \
26-
&& GOOS=$(GOOS) GOARCH=$(GOARCH) $(GOBUILD) -trimpath -ldflags '-s -w --extldflags "-static -fpic"' -tags 'osusergo,netgo' -o $(BUILD_PATH)/$(APP_NAME) $(MAIN)
26+
&& GOOS=$(GOOS) GOARCH=$(GOARCH) $(GOBUILD) -trimpath -ldflags '-s -w' -o $(BUILD_PATH)/$(APP_NAME) $(MAIN)
2727

2828
build_backend_on_darwin:
2929
cd $(SERVER_PATH) \
30-
&& GOOS=linux GOARCH=amd64 $(GOBUILD) -trimpath -ldflags '-s -w --extldflags "-static -fpic"' -o $(BUILD_PATH)/$(APP_NAME) $(MAIN)
30+
&& GOOS=linux GOARCH=amd64 $(GOBUILD) -trimpath -ldflags '-s -w' -o $(BUILD_PATH)/$(APP_NAME) $(MAIN)
3131

3232
build_backend_on_archlinux:
3333
cd $(SERVER_PATH) \
34-
&& GOOS=$(GOOS) GOARCH=$(GOARCH) $(GOBUILD) -trimpath -ldflags '-s -w --extldflags "-fpic"' -tags osusergo -o $(BUILD_PATH)/$(APP_NAME) $(MAIN)
34+
&& GOOS=$(GOOS) GOARCH=$(GOARCH) $(GOBUILD) -trimpath -ldflags '-s -w' -o $(BUILD_PATH)/$(APP_NAME) $(MAIN)
3535

36-
build_all: build_frontend build_backend_on_linux
36+
build_all: build_frontend build_backend_on_linux
3737

38-
build_on_local: clean_assets build_frontend build_backend_on_darwin upx_bin
38+
build_on_local: clean_assets build_frontend build_backend_on_darwin upx_bin

0 commit comments

Comments
 (0)