cogentcore / core

A free and open source framework for building powerful, fast, elegant 2D and 3D apps that run on macOS, Windows, Linux, iOS, Android, and the web with a single Go codebase, allowing you to Code Once, Run Everywhere.
http://cogentcore.org/core
BSD 3-Clause "New" or "Revised" License
1.73k stars 82 forks source link

core run web not working #1109

Closed suntong closed 2 months ago

suntong commented 2 months ago

It prints that when you do core run web

Oh, hmm, it prints nothing for me. It's about five minutes now.

My core setup was successful...

Originally posted by @suntong in https://github.com/cogentcore/core/issues/1108#issuecomment-2267116051

kkoreilly commented 2 months ago

Vulkan should not effect whether core run web works. Can you try running core run web -v and paste in the output here? Also, can you try just doing core run and see whether that works to run an app locally? Also, what code are you running?

suntong commented 2 months ago

How to debug core run web? Oh, ok:

$ cat hello_world.go 
package main

import "cogentcore.org/core/core"

func main() {
        b := core.NewBody()
        core.NewButton(b).SetText("Hello, World!")
        b.RunMainWindow()
}

$ core run web -v
go build -o /.../cogentcore/bin/web/app.wasm -ldflags -X cogentcore.org/core/system.CoreVersion=v0.3.0
go run -tags offscreen,generatehtml .
^C

-- That's five minutes later.

$ core run
go build -ldflags -s -w -X cogentcore.org/core/system.CoreVersion=v0.3.0 -o /.../cogentcore/Cogentcore
# github.com/goki/vulkan
/.../Go/pkg/mod/github.com/goki/vulkan@v1.0.8/errors.go:8:19: undefined: Result
/.../Go/pkg/mod/github.com/goki/vulkan@v1.0.8/vk_null64.go:12:16: undefined: Semaphore
/.../Go/pkg/mod/github.com/goki/vulkan@v1.0.8/vk_null64.go:14:12: undefined: Fence
/.../Go/pkg/mod/github.com/goki/vulkan@v1.0.8/vk_null64.go:16:19: undefined: DeviceMemory
/.../Go/pkg/mod/github.com/goki/vulkan@v1.0.8/vk_null64.go:18:13: undefined: Buffer
/.../Go/pkg/mod/github.com/goki/vulkan@v1.0.8/vk_null64.go:20:12: undefined: Image
/.../Go/pkg/mod/github.com/goki/vulkan@v1.0.8/vk_null64.go:22:12: undefined: Event
/.../Go/pkg/mod/github.com/goki/vulkan@v1.0.8/vk_null64.go:24:16: undefined: QueryPool
/.../Go/pkg/mod/github.com/goki/vulkan@v1.0.8/vk_null64.go:26:17: undefined: BufferView
/.../Go/pkg/mod/github.com/goki/vulkan@v1.0.8/vk_null64.go:28:16: undefined: ImageView
/.../Go/pkg/mod/github.com/goki/vulkan@v1.0.8/vk_null64.go:28:16: too many errors
core run failed: error building app: build: error building for platform linux/amd64: failed to run "go build -ldflags -s -w -X cogentcore.org/core/system.CoreVersion=v0.3.0 -o /.../cogentcore/Cogentcore: exit status 1"

$ go version
go version go1.22.2 linux/amd64

$ uname -rm
6.8.0-1010-azure x86_64

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 24.04 LTS
Release:        24.04
Codename:       noble
kkoreilly commented 2 months ago

Oh, I realize what the issue is. You are using a version of the Cogent Core command line tool that does not match the version of Cogent Core itself that you are using. I recently made a change that breaks if you don't have that. Please run go get cogentcore.org/core@main and then it should work. I will release a new version to fix that now.

suntong commented 2 months ago

Hmm.., same result:

$ go get cogentcore.org/core@main
go: upgraded cogentcore.org/core v0.3.0 => v0.3.1-0.20240802052248-0fbbdd8f54e9

$ core run
... undefined: Result
... undefined: Semaphore
. . .

$ time core run web -v
go build -o /.../cogentcore/bin/web/app.wasm -ldflags -X cogentcore.org/core/system.CoreVersion=v0.3.0
go run -tags offscreen,generatehtml .
^C
real    2m20.578s
user    0m0.275s
sys     0m0.109s

Is it because the cogentcore.org/core/system.CoreVersion is still at v0.3.0?

kkoreilly commented 2 months ago

Can you try running go mod tidy and then run it again? If it still says v0.3.0, can you paste in the go.mod here? It should not say v0.3.0. Thank you!

suntong commented 2 months ago

Yeah, it's working now.

Serving at http://localhost:8080
^C
real    9m21.255s
user    0m57.839s
sys     0m2.860s

Although core run still get the above errors.

Thanks for your help @kkoreilly !

kkoreilly commented 2 months ago

Great! The core run errors should be fixed soon with #507.