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

build: support emscripten compiler for cgo on wasm #55351

Open
gucio321 opened this issue Sep 22, 2022 · 7 comments
Open

build: support emscripten compiler for cgo on wasm #55351

gucio321 opened this issue Sep 22, 2022 · 7 comments
Labels
arch-wasm WebAssembly issues NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@gucio321
Copy link

gucio321 commented Sep 22, 2022

Hi there!
In reference to #40543

is cgo will support for wasm in future?

very unlikely as you would need a C to wasm compiler for you C dependencies.

I'm going to close this question as answered based on the answer from @randall77 above.

After a while of googling I found that C to wasm compiler already exists: https://emscripten.org/index.html

Is it possible to make CGO support webgl build target and allow to specify compiler e.g. with CC="..." and CXX="..." ?

@ianlancetaylor
Copy link
Contributor

This is not a proposal. Turning into a normal issue.

It may be possible, but somebody would have to do the work.

@ianlancetaylor ianlancetaylor changed the title proposal: cgo: build: support emscripten compiler for cgo on wasm Sep 25, 2022
@ianlancetaylor ianlancetaylor added NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. arch-wasm WebAssembly issues and removed Proposal labels Sep 25, 2022
@ianlancetaylor ianlancetaylor modified the milestones: Proposal, Backlog Sep 25, 2022
@ianlancetaylor
Copy link
Contributor

CC @neelance

@gucio321
Copy link
Author

Thank you for your information! Looking forward to seeing this feature implemented in the future release of go!

@neelance
Copy link
Member

Seems possible in theory, but very unlikely to happen. I think you should rather try to compile your Go code and C code to WebAssembly separately, load both in the same WebAssembly environment and then connect them somehow.

@gucio321
Copy link
Author

gucio321 commented Nov 1, 2022

@neelance could you please provide some step-by-step tutorial about that?

@neelance
Copy link
Member

neelance commented Nov 2, 2022

Not really. The "somehow" meant that I don't know how exactly to do it, just that I think it should be possible.

@gucio321
Copy link
Author

Are there any updates/plans for that? I'm looking forward to see this feature as I really need it 😕

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arch-wasm WebAssembly issues NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

4 participants