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

[experiment] Build wasm using Tinygo v0.31.2 #80

Closed
andrewkroh opened this issue Apr 13, 2024 · 1 comment
Closed

[experiment] Build wasm using Tinygo v0.31.2 #80

andrewkroh opened this issue Apr 13, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@andrewkroh
Copy link
Owner

Try to reduce the .wasm binary size by using the Tinygo compiler. It uses LLVM.

@andrewkroh andrewkroh added the enhancement New feature or request label Apr 13, 2024
@andrewkroh
Copy link
Owner Author

It won't build using tinygo. Some packages are not available in tinygo. So without carefully designing the code and watching the dependencies used, then it won't be possible to use tinygo. This project reuses existing code from elastic/beats without minimal modifications. It is way beyond the project's scope to fix any of these issues.

tinygo version 0.31.2 darwin/arm64 (using go version go1.22.2 and LLVM version 17.0.1)
tinygo build -o ui/public/processors.wasm -target wasm -ldflags "-X main.version=dev" ./internal/wasm
../../../go/pkg/mod/golang.org/x/net@v0.21.0/http2/transport.go:26:2: package net/http/httptrace is not in std (/Users/akroh/Library/Caches/tinygo/goroot-d8966786d458c7609be8dd342d52f7d045b9e56e2a2ad37836ef287c148b01d3/src/net/http/httptrace)
../../../go/pkg/mod/google.golang.org/grpc@v1.58.3/internal/transport/proxy.go:29:2: package net/http/httputil is not in std (/Users/akroh/Library/Caches/tinygo/goroot-d8966786d458c7609be8dd342d52f7d045b9e56e2a2ad37836ef287c148b01d3/src/net/http/httputil)
../../../go/pkg/mod/github.com/andrewkroh/elastic-agent-libs@v0.0.0-20220713130552-0fef594e5ae3/api/routes.go:23:2: package net/http/pprof is not in std (/Users/akroh/Library/Caches/tinygo/goroot-d8966786d458c7609be8dd342d52f7d045b9e56e2a2ad37836ef287c148b01d3/src/net/http/pprof)
../../../go/pkg/mod/golang.org/x/net@v0.21.0/publicsuffix/list.go:53:2: package net/http/cookiejar is not in std (/Users/akroh/Library/Caches/tinygo/goroot-d8966786d458c7609be8dd342d52f7d045b9e56e2a2ad37836ef287c148b01d3/src/net/http/cookiejar)

Related

@andrewkroh andrewkroh changed the title [experiment] Build wasm using Tinygo [experiment] Build wasm using Tinygo v0.31.2 Apr 13, 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
Projects
None yet
Development

No branches or pull requests

1 participant