wasmer-go icon indicating copy to clipboard operation
wasmer-go copied to clipboard

adding wasmer_runtime_c_api for musl

Open diegobes opened this issue 5 years ago β€’ 10 comments

Thanks for the bug report!

Describe the bug

I create a wasmer_runtime_c_api for musl to be able to deploy my Wasmer Go application using the super small Alpine based Docker image. I copied it to the wasmer directory, but CGO always select the wasmer_runtime_c_api.so instead of my static wasmer_runtime_c_api.a library.

Because Alpine is non glibc compatible, linking go-ext-wasm with wasmer_runtime_c_api.so fails. But linking it with the static library I created for musl works fine.

Question

1-What is the best way to add the musl based static library and make bridge.go to link the right library ? 2- When linking with my static library int32_t is not recognized when I define an extern C based function. any clue why its that ?

Thanks -- Diego

diegobes avatar Feb 01 '20 05:02 diegobes

Since 8 days, we officially support musl (see https://github.com/wasmerio/wasmer/pull/1180). We can wait the next release (will happen in few days) to update go-ext-wasm and see if everything fits together. Thoughts?

Hywan avatar Feb 05 '20 12:02 Hywan

Any plan to update to the new wasmer capi from 0.14.1 ?

diegobes avatar Feb 28 '20 17:02 diegobes

Yes, we are working on updating it.

More info: https://github.com/wasmerio/go-ext-wasm/pull/120 (note: it should be merged soon)

syrusakbary avatar Feb 28 '20 18:02 syrusakbary

thanks, I don't see in #120 the static libwasmer library being added. I think the only way to link on musl ( Alpine ) is with a static library. It is still work in progress ?

diegobes avatar Mar 01 '20 18:03 diegobes

It is still a WIP.

Hywan avatar Mar 03 '20 09:03 Hywan

Hi, Any update on this ? Thanks

diegobes avatar Jul 18 '20 20:07 diegobes

Didn't make any progress on that front for the moment. I'm moving it on top of my todo list!

Hywan avatar Aug 17 '20 11:08 Hywan

Waiting on https://github.com/wasmerio/wasmer/pull/2003.

Hywan avatar Feb 04 '21 15:02 Hywan

It seems like everything is merged – how does one compile a Go binary using wasmer-go on Alpine (Docker alpine image in my case)?

blixt avatar Aug 17 '21 13:08 blixt

I think we would need to support static lib (not a big deal) before proposing musl builds. Thoughts?

Hywan avatar Aug 17 '21 13:08 Hywan