Skip to content

Add support for glibc for binary build#100

Merged
TxCorpi0x merged 15 commits into
masterfrom
mehdi/linux-build-compatible-wasm
Mar 27, 2026
Merged

Add support for glibc for binary build#100
TxCorpi0x merged 15 commits into
masterfrom
mehdi/linux-build-compatible-wasm

Conversation

@TxCorpi0x

@TxCorpi0x TxCorpi0x commented Mar 4, 2026

Copy link
Copy Markdown
Contributor

Description

This pull request introduces support for building and packaging the txd binary for both Alpine (musl/static) and Debian/Ubuntu (glibc/dynamic) Docker images. It enables flexible selection of the base image and linking strategy via a new --override-txd-os flag or environment variable. The changes also streamline dependency management, update relevant toolchain logic, and ensure the correct handling of the WASM VM library for each platform.

Build system enhancements (Docker, linking, and platform support):

  • Added support for glibc/dynamic linking: Introduced new logic to build txd with a dynamically linked libwasmvm shared library for Debian/Ubuntu images, while retaining static linking for Alpine images. This includes new toolchain configuration, environment setup, and Dockerfile template changes to copy the .so library when needed. [1] [2] [3] [4] [5] [6] [7] [8]
  • Added new flag and context logic: Implemented the --override-txd-os CLI flag and $TXD_OS environment variable to select the base image and linking mode, with context propagation and default fallback.
  • Updated Docker image build logic: Refactored BuildTXdDockerImage and related functions to use the selected base image and linking mode, including proper handling of WASM library copying and toolchain setup. [1] [2]
  • Updated Dockerfile templates and image configs: Modified Dockerfile templates and image configuration structures to support conditional inclusion of the WASM shared library and proper base image selection. [1] [2] [3] [4]

Dependency and toolchain updates:

  • Added libwasmvm-glibc tool definition and download logic: Updated build/tools/tools.go to define the new WASM VM shared library for glibc builds and added download URLs and hashes. [1] [2]
  • Updated Go module dependencies: Upgraded and replaced several dependencies in build/go.mod, including new versions of tx-crust, tx-crust/znet, and IBC modules, and added github.com/spf13/pflag. [1] [2] [3]

General improvements and refactoring:

  • Refactored build tag and linking logic: Improved handling of build tags and linking modes, including new functions for arch naming and platform-specific logic. [1] [2]
  • Updated Docker image build steps for Gaia, Hermes, and Osmosis: Changed base images and installation commands for improved compatibility and consistency. [1] [2] [3]

These changes collectively enable seamless builds and deployments of txd for both Alpine and Debian/Ubuntu environments, improving cross-platform compatibility and simplifying developer workflows.

Reviewers checklist:

  • Try to write more meaningful comments with clear actions to be taken.
  • Nit-picking should be unblocking. Focus on core issues.

Authors checklist

  • Provide a concise and meaningful description
  • Review the code yourself first, before making the PR.
  • Annotate your PR in places that require explanation.
  • Think and try to split the PR to smaller PR if it is big.

This change is Reviewable

@TxCorpi0x TxCorpi0x marked this pull request as ready for review March 10, 2026 07:07
@TxCorpi0x TxCorpi0x requested a review from a team as a code owner March 10, 2026 07:07
@TxCorpi0x TxCorpi0x requested review from masihyeganeh, metalarm10, miladz68 and ysv and removed request for a team March 10, 2026 07:07

@metalarm10 metalarm10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@metalarm10 made 1 comment.
Reviewable status: 0 of 10 files reviewed, 1 unresolved discussion (waiting on masihyeganeh, miladz68, TxCorpi0x, and ysv).


build/tx-chain/flags.go line 19 at r1 (raw file):

//	builder --override-txd-os ubuntu integration-tests/xrpl
//	TXD_OS=ubuntu builder integration-tests/xrpl
func RegisterTXdOSFlag(fs *pflag.FlagSet) func(context.Context) context.Context {

I didn't understand this part that RegisterTXdOSFlag registers and resolves the flag (for either Alpine or Ubuntu options), but it seems never called by any process so the flags are never registered into the build process. I believe main.go needs a modification something like: build.Main(selfBuild.Commands, txchain.RegisterTXdOSFlag).
I also tried to build images locally with TXD_OS=ubuntu make images command, which resulted in Alpine images (I am also Apple silicon user).
(Please correct me if I misunderstood a step or how should I use the feature correctly).

@metalarm10 metalarm10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@metalarm10 reviewed 11 files and all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on masihyeganeh, miladz68, TxCorpi0x, and ysv).

metalarm10
metalarm10 previously approved these changes Mar 24, 2026

@metalarm10 metalarm10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@metalarm10 resolved 1 discussion.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on masihyeganeh, miladz68, and ysv).

@ysv ysv left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@ysv reviewed 11 files and all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on masihyeganeh and miladz68).

@metalarm10 metalarm10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@metalarm10 reviewed all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on masihyeganeh and miladz68).

@TxCorpi0x TxCorpi0x merged commit 7edbe7a into master Mar 27, 2026
14 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.

3 participants