Skip to content

Add Bazel build support for WasmEdge-go (Fixes WasmEdge/WasmEdge#2162)#58

Merged
hydai merged 1 commit into
second-state:masterfrom
kalamkaar9404:feature/bazel-support
Feb 5, 2026
Merged

Add Bazel build support for WasmEdge-go (Fixes WasmEdge/WasmEdge#2162)#58
hydai merged 1 commit into
second-state:masterfrom
kalamkaar9404:feature/bazel-support

Conversation

@kalamkaar9404

Copy link
Copy Markdown
Contributor

This PR implements Bazel build support for WasmEdge-go using rules_go and Gazelle.

Key Changes:

Added root WORKSPACE and BUILD.bazel files.

Generated package-level BUILD.bazel files using Gazelle.

Updated README.md with instructions for Windows users to link the WasmEdge C library via Bazel.

Updated CI workflow to include the new feature branch.

Verification: Build success verified via GitHub Actions on my fork for both Ubuntu 24.04 and MacOS 14 across Go versions 1.22 and 1.23.

Fixes #2162

@kalamkaar9404

Copy link
Copy Markdown
Contributor Author

Hi @hydai , I’ve completed the Bazel support for WasmEdge-go as discussed in #2162.

I have verified the build structure on Windows and confirmed that the CI passes on my fork. This PR includes:

WORKSPACE and root BUILD.bazel configuration.

Updated README.md with Windows CGO linking steps.

CI workflow updates to support this branch.

Could you please approve the workflows to run and take a look at the changes? Thank you!

@kalamkaar9404 kalamkaar9404 changed the title Add Bazel build support for WasmEdge-go (fixes #2162) Add Bazel build support for WasmEdge-go Dec 26, 2025
@kalamkaar9404 kalamkaar9404 changed the title Add Bazel build support for WasmEdge-go Add Bazel build support for WasmEdge-go (Fixes WasmEdge/WasmEdge#2162) Dec 26, 2025
@hydai

hydai commented Dec 26, 2025

Copy link
Copy Markdown
Member

It's so strange that you're adding so many files under this folder:
CleanShot 2025-12-26 at 19:49:55

I don't think this should be committed to the repository.

@kalamkaar9404

kalamkaar9404 commented Dec 26, 2025

Copy link
Copy Markdown
Contributor Author

Hi @hydai, thank you for your feedback! I have updated the PR to:

Remove the bazel-* output directories that were accidentally committed.

Update the .gitignore to prevent them from being tracked.

I have verified on my fork that the CI build still passes successfully for all platforms with these changes. Please let me know if there are any other adjustments you'd like me to make!

@hydai hydai left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think you should check the document about Bazel. Trying to add bazel-out to a git source tree is quite unusual.

@kalamkaar9404

Copy link
Copy Markdown
Contributor Author

Hello @hydai
I have made the requested changes can you please look once now?

Comment thread MODULE.bazel Outdated
Comment thread main.go Outdated
Comment thread bazel/wasmedge_cgo.patch Outdated
Comment thread .github/workflows/build.yml Outdated
Comment thread .github/workflows/build.yml Outdated
Comment thread .github/workflows/build.yml Outdated
Comment thread .github/workflows/build.yml Outdated
@kalamkaar9404

Copy link
Copy Markdown
Contributor Author

Hi @hydai, I have addressed the mentioned issues:

I have aligned the version to 0.14.0 across MODULE.bazel, README.md, and the CI workflow to match the current latest release.
I have removed the patch file/folder and moved the cdeps and repository logic directly into the Bazel files.
I have fixed the missing newline in main.go and removed redundant lines/comments in build.yml.

I request you to look into it once.
Thank you

Comment thread .github/workflows/build.yml
Comment thread .github/workflows/build.yml Outdated
Comment thread .github/workflows/build.yml Outdated
Comment thread MODULE.bazel Outdated
Comment thread README.md
@kalamkaar9404

Copy link
Copy Markdown
Contributor Author

Hi @hydai, I have added multi-platform support by including all the necessary URLs. I previously made changes to build.yml to address build errors, but based on your feedback, I understand that build.yml does not require modification. Therefore, I have reverted it to its original state and have only applied the necessary changes to the MODULE.bazel and README.md files. Does this look fine to you?

@kalamkaar9404 kalamkaar9404 force-pushed the feature/bazel-support branch 2 times, most recently from a4c0580 to cf42123 Compare December 31, 2025 03:47
@kalamkaar9404

Copy link
Copy Markdown
Contributor Author

Hello @hydai,
Can you please review this once?
Thank you

@hydai hydai left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM.

@hydai

hydai commented Jan 5, 2026

Copy link
Copy Markdown
Member

Please squash your commits into only one.

@kalamkaar9404 kalamkaar9404 force-pushed the feature/bazel-support branch from cf42123 to 16a3b42 Compare January 5, 2026 16:06
@kalamkaar9404

Copy link
Copy Markdown
Contributor Author

Hi @hydai, I have squashed the commits into a single signed-off commit. The PR is now ready for your final review.
Thank you for your help!

@hydai hydai left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

May I ask which workflow the Bazel build falls under?
I didn't find the testing jobs for these new building system.

@kalamkaar9404 kalamkaar9404 force-pushed the feature/bazel-support branch from 16a3b42 to 01f31f3 Compare January 5, 2026 17:54
@kalamkaar9404

Copy link
Copy Markdown
Contributor Author

Hi @hydai,
Can you please check once now? I have done the testing locally and added in the workflow fixing the test errors.

@kalamkaar9404

Copy link
Copy Markdown
Contributor Author
image The tests are passing on my setup

@kalamkaar9404

kalamkaar9404 commented Jan 5, 2026

Copy link
Copy Markdown
Contributor Author

Hi @hydai,
The CI failures are due to the missing enum.inc C header during the cgo build step. I have modified the MODULE.bazel file.

@kalamkaar9404 kalamkaar9404 force-pushed the feature/bazel-support branch from 01f31f3 to d9812bc Compare January 5, 2026 18:46
@kalamkaar9404 kalamkaar9404 requested a review from hydai January 5, 2026 18:48
@kalamkaar9404 kalamkaar9404 force-pushed the feature/bazel-support branch 3 times, most recently from 5ece214 to 97cd64e Compare January 5, 2026 19:53
@kalamkaar9404

Copy link
Copy Markdown
Contributor Author

Hi @hydai,
I found that the macOS runner is arm64, but the previous Bazel config was fetching the x86_64 SDK. I have updated the MODULE.bazel to fetch the aarch64 Darwin release, which resolves the 'symbol not found' linker errors. This should finalize the cross-platform Bazel support.

@kalamkaar9404

Copy link
Copy Markdown
Contributor Author
image Hi @hydai, I have updated this PR with a fully verified and workable Bazel configuration. I apologize for the previous non-functional pushes; I have now confirmed that these changes pass all 4 matrix jobs (Ubuntu 24.04 and MacOS 14 across Go 1.22.x and 1.23.x) on my fork (I have attached the image for the same). Thank you for your patience.

Comment thread .github/workflows/build.yml
@kalamkaar9404 kalamkaar9404 force-pushed the feature/bazel-support branch 14 times, most recently from 80e5653 to 97f3f10 Compare February 2, 2026 08:11
@kalamkaar9404

Copy link
Copy Markdown
Contributor Author

Hello @hydai,
I have kept the original build step as requested.
I have tested the changes on my fork and the build is now passing. I removed the unused import "C" from limit_test.go. Since that file strictly tests Go logic and does not use any C types, the import was unnecessary and was causing the build to fail.
Can you please review?

@kalamkaar9404 kalamkaar9404 requested a review from hydai February 2, 2026 08:16
Comment thread .github/workflows/build.yml Outdated
@kalamkaar9404 kalamkaar9404 force-pushed the feature/bazel-support branch 2 times, most recently from a67be0b to 927371b Compare February 2, 2026 08:49
@kalamkaar9404 kalamkaar9404 requested a review from hydai February 2, 2026 08:53
Comment thread .github/workflows/build.yml Outdated
Comment thread .github/workflows/build.yml Outdated
@kalamkaar9404 kalamkaar9404 requested a review from hydai February 3, 2026 08:48
@kalamkaar9404

Copy link
Copy Markdown
Contributor Author

Hello @hydai,
Can you please let me know if the version is correct now? Are there any other changes required?

@hydai

hydai commented Feb 5, 2026

Copy link
Copy Markdown
Member

Fixes WasmEdge/WasmEdge#2162

@hydai hydai merged commit e5e7653 into second-state:master Feb 5, 2026
8 checks passed
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