gaia icon indicating copy to clipboard operation
gaia copied to clipboard

[Docs]: update build and run docs for CosmWasm

Open MSalopek opened this issue 8 months ago • 0 comments

Summary

Related: #3050

With the integration of CosmWasm the build got a bit more complicated.

We will need to update the docs to show how to build gaia with CosmWasm in mind.

Summary: To build gaia correctly the following must happen:

  1. you need to enable CGO
  2. you need to download libwasvm source objects
  3. you need to choose whether you want to statically or dynamically link libwasmvm
  4. build

Example for dynamic linking:

# download both arm and x86 in case the infra can change (eg. in CI pipelines)
curl -LO https://github.com/CosmWasm/wasmvm/releases/download/v1.5.0/libwasmvm.x86_64.so
curl -LO https://github.com/CosmWasm/wasmvm/releases/download/v1.5.0/libwasmvm.aarch64.so
uname -m
sudo cp "./libwasmvm.$(uname -m).so" /usr/lib/
make build

Example with dynamic linking:

curl -LO https://github.com/CosmWasm/wasmvm/releases/download/${WASMVM_VERSION}/libwasmvm_muslc.aarch64.a /lib/libwasmvm_muslc.aarch64.a
curl -LO https://github.com/CosmWasm/wasmvm/releases/download/${WASMVM_VERSION}/libwasmvm_muslc.x86_64.a /lib/libwasmvm_muslc.x86_64.a
sha256sum /lib/libwasmvm_muslc.aarch64.a | grep 2687afbdae1bc6c7c8b05ae20dfb8ffc7ddc5b4e056697d0f37853dfe294e913
sha256sum /lib/libwasmvm_muslc.x86_64.a | grep 465e3a088e96fd009a11bfd234c69fb8a0556967677e54511c084f815cf9ce63
cp "/lib/libwasmvm_muslc.$(uname -m).a" /lib/libwasmvm_muslc.a

# statically link the binary
LEDGER_ENABLED=false LINK_STATICALLY=true BUILD_TAGS=muslc make build

MSalopek avatar May 29 '24 12:05 MSalopek