Skip to content

Commit

Permalink
fix: cross compile when building (#477)
Browse files Browse the repository at this point in the history
Signed-off-by: Ji Hwan <[email protected]>
  • Loading branch information
jhkimqd authored Jan 16, 2025
1 parent 950de82 commit 926fb24
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,14 @@ cross: $(BUILD_DIR) ## Cross-compile go binaries using CGO.
# - `-linkmode external -extldflags "-static-libgo"` allows dynamic linking.
echo "Building $(BIN_NAME)_$(GIT_TAG)_linux_arm64..."
CC=aarch64-linux-gnu-gcc CGO_ENABLED=1 GOOS=linux GOARCH=arm64 go build \
-ldflags '$(VERSION_FLAGS) -s -w -linkmode external -extldflags "-static-libgo"' \
-ldflags '$(VERSION_FLAGS) -s -w -linkmode external -extldflags "-static"' \
-tags netgo \
-o $(BUILD_DIR)/$(BIN_NAME)_$(GIT_TAG)_linux_arm64 \
main.go

echo "Building $(BIN_NAME)_$(GIT_TAG)_linux_amd64..."
CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build \
-ldflags '$(VERSION_FLAGS) -s -w -linkmode external -extldflags "-static-libgo"' \
-ldflags '$(VERSION_FLAGS) -s -w -linkmode external -extldflags "-static"' \
-tags netgo \
-o $(BUILD_DIR)/$(BIN_NAME)_$(GIT_TAG)_linux_amd64 \
main.go
Expand Down

0 comments on commit 926fb24

Please sign in to comment.