Skip to content

go: Duplicated definitions error #1484

@asteurer

Description

@asteurer

When I'm building a wasm application that make use of multiple SDKs using wit-bindgen Go bindings, I get the following error when running the go build command:

Error: 'go build' command failed: # github.com/calebschoepp/opentelemetry-wasi/examples/spin-basic
link: duplicated definition of symbol cabi_realloc, from github.com/spinframework/spin-go-sdk/v3/wit_component/wit_runtime (type STEXT size 2) and github.com/calebschoepp/opentelemetry-wasi/wit_component/wit_runtime (type STEXT size 2)

Error: Build command for component go-spin-basic failed with status Exited(1)

This is due to the wit_component/wit_runtime -> cabiRealloc function being implemented multiple times. My current workaround is to remove it from one of the SDK implementations.

I'm wondering if there is a fix or if there's a workaround that wouldn't require users to alter the source code of an imported SDK?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions