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

'time' package adds 'syscall/js' dependencies to wasip1 build #4659

Open
falconandy opened this issue Dec 15, 2024 · 2 comments
Open

'time' package adds 'syscall/js' dependencies to wasip1 build #4659

falconandy opened this issue Dec 15, 2024 · 2 comments
Labels
wasm WebAssembly

Comments

@falconandy
Copy link

falconandy commented Dec 15, 2024

tinygo version 0.34.0 linux/amd64 (using go version go1.23.4 and LLVM version 18.1.2)

Without time package:

package main

//go:wasmexport add
func add(a, b int32) int32 {
	//_ = time.Time{}
	return a + b
}

func main() {}

GOOS=wasip1 GOARCH=wasm tinygo build -o ./wasmtest.wasm -buildmode=c-shared --no-debug -scheduler=none .

Result size: 9563 bytes

image

With time package:

package main

import (
	"time"
)

//go:wasmexport add
func add(a, b int32) int32 {
	_ = time.Time{}
	return a + b
}

func main() {}

GOOS=wasip1 GOARCH=wasm tinygo build -o ./wasmtest.wasm -buildmode=c-shared --no-debug -scheduler=none .

Result size: 13698 bytes

image

Is it intended to have syscall/js dependencies in wasip1 builds?

@deadprogram deadprogram added the wasm WebAssembly label Dec 16, 2024
@mattjohnsonpint
Copy link

I can confirm this happens when relying on GOOS=wasip1 GOARCH=wasm, but it does not happen when passing -target=wasip1. Same as in #4439. (It's not specific to the time package.)

Occurs both on 0.34.0 and 0.35.0.

@deadprogram
Copy link
Member

Please see #4437 and #4447 for details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wasm WebAssembly
Projects
None yet
Development

No branches or pull requests

3 participants