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

Go 1.17: LinkError: import object field 'runtime.walltime' is not a Function #569

Closed
nekrondev opened this issue Aug 18, 2021 · 5 comments · Fixed by #588
Closed

Go 1.17: LinkError: import object field 'runtime.walltime' is not a Function #569

nekrondev opened this issue Aug 18, 2021 · 5 comments · Fixed by #588

Comments

@nekrondev
Copy link

I updated my Go compiler and it looks like wasm_exec.js got updated within the runtime so launching the WASM failed with
LinkError: import object field 'runtime.walltime' is not a Function

It looks like walltime1() is used in the static generated script.go whereas Go 1.17 changed from walltime1() to walltime() hence the missing function exception.

@maxence-charriere
Copy link
Owner

I will take a look on it. Thanks for reporting it.

@beanpole135
Copy link

I just ran into this as well, and from looking up the information about WASM from the Go devs, it sounds like there is a history about that wasm_exec.js file changing between versions of Go, so a static-version of that file in the go-app repo is probably not a good idea for future version updates either.

It looks like the wasm_exec.js that is used needs to come from the current version of the go compiler installed on the system doing the build - since the Go devs ensure that the wasm_exec.js distributed with Go is always compatible, but that file has no backward/forward compatibility guarantee.

That file is located at "/usr/share/go/misc/wasm/wasm_exec.js" on my Linux system here, but I think you can dynamically fetch the go installation path within go itself and just copy that file at build-time instead.

@beanpole135
Copy link

More info:
It looks like go-app already does that "wasm_exec.js" find/embed routine here: https://github.com/maxence-charriere/go-app/blob/master/pkg/app/gen/scripts.go

So a short-term solution would be to just release a new package for go-app (v9-XYZ) which was build on a system using Go 1.17

Longer term: a way to move that generation routine out of the go-app pre-packaging framework (go generate) and into some kind of "setup routine" that a developer can run/re-run on their system as needed instead. Alternatively, I think I have seen other go-based WASM systems actually drop the wasm_exec.js file into the root dir of the files for the site itself, and then the server dynamically reads/uses that file (with caching as needed) instead of having a static string in memory.

@maxence-charriere
Copy link
Owner

Hey, yes so it looks like they have changed some stuff in the js support file.
Since wasm is still experimental, some stuff like that can likely happen.

I'll release v9 with the 1.17 requirement. in the meantime you can get a v9 build where it is fixed with this:

go get -u -v github.com/maxence-charriere/go-app/v9@a26b536

Working on releasing v9 soon.

@beanpole135
Copy link

That new v9 tag works great on my go 1.17 system. Thanks!

@maxence-charriere maxence-charriere mentioned this issue Sep 22, 2021
Merged
SuspendedPhan added a commit to SuspendedPhan/expresso that referenced this issue Oct 12, 2022
Import #5 module="go" function="runtime.walltime" error: function import requires a callable

maxence-charriere/go-app#569
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants