Skip to content

Add support for building Linux ARM64 binary in Makefile#221

Merged
mostlygeek merged 1 commit intomostlygeek:mainfrom
aaron-ang:build-arm
Aug 5, 2025
Merged

Add support for building Linux ARM64 binary in Makefile#221
mostlygeek merged 1 commit intomostlygeek:mainfrom
aaron-ang:build-arm

Conversation

@aaron-ang
Copy link
Copy Markdown
Contributor

@aaron-ang aaron-ang commented Aug 5, 2025

Summary by CodeRabbit

  • Chores
    • Enhanced Linux build process to produce binaries for both AMD64 and ARM64 architectures.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Aug 5, 2025

Walkthrough

The Makefile's linux build target was updated to include an additional build command for the Linux ARM64 architecture, alongside the existing build for Linux AMD64. Both builds use the same linker flags to embed Git commit hash, version, and build date. No other targets or logic were modified.

Changes

Cohort / File(s) Change Summary
Makefile Update
Makefile
Modified the linux build target to build binaries for both Linux AMD64 and ARM64 architectures, using consistent linker flags.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🔭 Outside diff range comments (1)
Makefile (1)

44-49: Add $(BUILD_DIR) as an explicit prerequisite to avoid “no such directory” failures

If a fresh clone runs make linux before any other target, the build directory may not exist, causing both
go build -o $(BUILD_DIR)/… commands to fail. You already have a rule that creates the directory (Lines 65-68);
just declare it as a dependency:

-linux: ui
+linux: ui $(BUILD_DIR)

That guarantees the directory exists regardless of build order.

🧹 Nitpick comments (2)
Makefile (2)

44-49: Consider de-duplicating linker flags to reduce maintenance overhead

The two go build invocations are identical except for GOARCH and the output path. Extract the common
-ldflags string (and maybe GOOS) into a variable or use a pattern rule, e.g.:

LDFLAGS := -ldflags="-X main.commit=$(GIT_HASH) -X main.version=local_$(GIT_HASH) -X main.date=$(BUILD_DATE)"

linux: ui $(BUILD_DIR)
	@echo "Building Linux binaries..."
	$(foreach arch,amd64 arm64,\
		GOOS=linux GOARCH=$(arch) go build $(LDFLAGS) -o $(BUILD_DIR)/$(APP_NAME)-linux-$(arch);)

That keeps the flags in one place and makes adding new architectures trivial.


55-60: Optional: produce simple-responder for Linux ARM 64 to stay feature-par with main binary

Since the primary binary now supports arm64, you may want the helper simple-responder (Lines 55-60) to do the same:

 GOOS=linux GOARCH=amd64 go build -o $(BUILD_DIR)/simple-responder_linux_amd64 misc/simple-responder/simple-responder.go
+GOOS=linux GOARCH=arm64 go build -o $(BUILD_DIR)/simple-responder_linux_arm64 misc/simple-responder/simple-responder.go

This keeps tooling consistent across architectures.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 558a72d and 73b6d16.

📒 Files selected for processing (1)
  • Makefile (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: run-tests
🔇 Additional comments (1)
Makefile (1)

48-48: ARM 64 build step added — looks good

The additional GOOS=linux GOARCH=arm64 invocation correctly mirrors the existing amd64 step and produces
$(APP_NAME)-linux-arm64. Nice, this closes the gap for Apple/Graviton servers and similar platforms.

@mostlygeek mostlygeek merged commit 6307bd3 into mostlygeek:main Aug 5, 2025
3 checks passed
@mostlygeek
Copy link
Copy Markdown
Owner

thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants