Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explore WebAssembly Build (WASM) #38

Open
suyashkumar opened this issue Jun 28, 2024 · 0 comments
Open

Explore WebAssembly Build (WASM) #38

suyashkumar opened this issue Jun 28, 2024 · 0 comments
Labels
enhancement New feature or request exploration

Comments

@suyashkumar
Copy link
Contributor

Overview

The Go tool is able to build WebAsssembly binaries which can be run inside browsers. This capability may allow our CQL evaluation library to run locally within a browser (and rely on static serving instead of a custom server like cqlplay currently does).

That said, complex programs seem to run into various issues compiling to WebAssembly. This issue will be a lower-priority tracker for explorations on this front. Help is welcome!

Progress

Blindly trying to build the CLI with a WASM target results in the following errors:

@suyashkumar ➜ /workspaces/cql/cmd/cli (main) $  GOOS=js GOARCH=wasm go1.21.11 build -o main.wasm
# github.com/google/cql/cmd/cli
type:*github.com/google/fhir/go/jsonformat/internal/protopath.Path: non-pc-relative relocation address for github.com/google/fhir/go/jsonformat/internal/protopath.(*Path).Append is too big: 0x12c360000
type:*github.com/google/fhir/go/jsonformat/internal/protopath.Path: non-pc-relative relocation address for github.com/google/fhir/go/jsonformat/internal/protopath.(*Path).Append is too big: 0x12c360000
type:*github.com/google/fhir/go/jsonformat/internal/protopath.Path: non-pc-relative relocation address for github.com/google/fhir/go/jsonformat/internal/protopath.(*Path).IsValid is too big: 0x12c370000
type:*github.com/google/fhir/go/jsonformat/internal/protopath.Path: non-pc-relative relocation address for github.com/google/fhir/go/jsonformat/internal/protopath.(*Path).IsValid is too big: 0x12c370000
type:*github.com/google/fhir/go/jsonformat/internal/protopath.Path: non-pc-relative relocation address for github.com/google/fhir/go/jsonformat/internal/protopath.(*Path).Parent is too big: 0x12c380000
type:*github.com/google/fhir/go/jsonformat/internal/protopath.Path: non-pc-relative relocation address for github.com/google/fhir/go/jsonformat/internal/protopath.(*Path).Parent is too big: 0x12c380000
type:*github.com/google/fhir/go/jsonformat/internal/protopath.Path: non-pc-relative relocation address for github.com/google/fhir/go/jsonformat/internal/protopath.(*Path).String is too big: 0x12c390000
type:*github.com/google/fhir/go/jsonformat/internal/protopath.Path: non-pc-relative relocation address for github.com/google/fhir/go/jsonformat/internal/protopath.(*Path).String is too big: 0x12c390000
type:*github.com/google/cql/retriever/local.Retriever: non-pc-relative relocation address for github.com/google/cql/retriever/local.(*Retriever).Retrieve is too big: 0x12cb40000
type:*github.com/google/cql/retriever/local.Retriever: non-pc-relative relocation address for github.com/google/cql/retriever/local.(*Retriever).Retrieve is too big: 0x12cb40000
type:*github.com/google/fhir/go/jsonformat/internal/jsonpbhelper.UnmarshalErrorList: non-pc-relative relocation address for github.com/google/fhir/go/jsonformat/internal/jsonpbhelper.(*UnmarshalErrorList).Error is too big: 0x12c210000
type:*github.com/google/fhir/go/jsonformat/internal/jsonpbhelper.UnmarshalErrorList: non-pc-relative relocation address for github.com/google/fhir/go/jsonformat/internal/jsonpbhelper.(*UnmarshalErrorList).Error is too big: 0x12c210000
type:github.com/google/fhir/go/jsonformat/internal/jsonpbhelper.UnmarshalErrorList: non-pc-relative relocation address for github.com/google/fhir/go/jsonformat/internal/jsonpbhelper.(*UnmarshalErrorList).Error is too big: 0x12c210000
type:github.com/google/fhir/go/jsonformat/internal/jsonpbhelper.UnmarshalErrorList: non-pc-relative relocation address for github.com/google/fhir/go/jsonformat/internal/jsonpbhelper.UnmarshalErrorList.Error is too big: 0x12c020000
type:*github.com/google/fhir/go/proto/google/fhir/proto/stu3/metadatatypes_go_proto.DataRequirement_CodeFilter_ValueSet: non-pc-relative relocation address for github.com/google/fhir/go/proto/google/fhir/proto/stu3/metadatatypes_go_proto.(*DataRequirement_CodeFilter_ValueSet).Descriptor is too big: 0x1068d0000
type:*github.com/google/fhir/go/proto/google/fhir/proto/stu3/metadatatypes_go_proto.DataRequirement_CodeFilter_ValueSet: non-pc-relative relocation address for github.com/google/fhir/go/proto/google/fhir/proto/stu3/metadatatypes_go_proto.(*DataRequirement_CodeFilter_ValueSet).Descriptor is too big: 0x1068d0000
type:*github.com/google/fhir/go/proto/google/fhir/proto/stu3/metadatatypes_go_proto.DataRequirement_CodeFilter_ValueSet: non-pc-relative relocation address for github.com/google/fhir/go/proto/google/fhir/proto/stu3/metadatatypes_go_proto.(*DataRequirement_CodeFilter_ValueSet).GetReference is too big: 0x106900000
type:*github.com/google/fhir/go/proto/google/fhir/proto/stu3/metadatatypes_go_proto.DataRequirement_CodeFilter_ValueSet: non-pc-relative relocation address for github.com/google/fhir/go/proto/google/fhir/proto/stu3/metadatatypes_go_proto.(*DataRequirement_CodeFilter_ValueSet).GetReference is too big: 0x106900000
type:*github.com/google/fhir/go/proto/google/fhir/proto/stu3/metadatatypes_go_proto.DataRequirement_CodeFilter_ValueSet: non-pc-relative relocation address for github.com/google/fhir/go/proto/google/fhir/proto/stu3/metadatatypes_go_proto.(*DataRequirement_CodeFilter_ValueSet).GetStringValue is too big: 0x1068f0000
type:*github.com/google/fhir/go/proto/google/fhir/proto/stu3/metadatatypes_go_proto.DataRequirement_CodeFilter_ValueSet: non-pc-relative relocation address for github.com/google/fhir/go/proto/google/fhir/proto/stu3/metadatatypes_go_proto.(*DataRequirement_CodeFilter_ValueSet).GetStringValue is too big: 0x1068f0000
type:*github.com/google/fhir/go/proto/google/fhir/proto/stu3/metadatatypes_go_proto.DataRequirement_CodeFilter_ValueSet: non-pc-relative relocation address for github.com/google/fhir/go/proto/google/fhir/proto/stu3/metadatatypes_go_proto.(*DataRequirement_CodeFilter_ValueSet).GetValueSet is too big: 0x1068e0000
/home/codespace/sdk/go1.21.11/pkg/tool/linux_amd64/link: too many errors
type:*github.com/google/fhir/go/proto/google/fhir/proto/stu3/resources_go_proto.ClaimResponse_AddedItem: non-pc-relative relocation address for github.com/google/fhir/go/proto/google/fhir/proto/stu3/resources_go_proto.(*ClaimResponse_AddedItem).Descriptor is too big: 0x118a50000
/home/codespace/sdk/go1.21.11/pkg/tool/linux_amd64/link: too many errors

Both go1.21.11 and go1.22.3 returned similar errors. I think this issue is related: golang/go#64856 and indicated go1.21 worked for their build, so I tried that to no avail. Need to look more into the issue details to see what might be going on.

At a high-level, many of these seem to be problems related to FHIR proto libraries and the protos themselves, which doesn't surprise me.

@suyashkumar suyashkumar added enhancement New feature or request exploration labels Jun 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request exploration
Projects
None yet
Development

No branches or pull requests

1 participant