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

path to wasm_exec.js changed for go 1.24 #16

Closed
gedw99 opened this issue Feb 16, 2025 · 16 comments · Fixed by #15
Closed

path to wasm_exec.js changed for go 1.24 #16

gedw99 opened this issue Feb 16, 2025 · 16 comments · Fixed by #15

Comments

@gedw99
Copy link

gedw99 commented Feb 16, 2025

task: [build:css] (cd web/tailwind && npx tailwindcss -i ./orbital.scss -o /Users/apple/workspace/go/src/junk/orbital/orbital/web/orbital.css)
Error: Cannot apply unknown utility class: bg-gray-50
npm notice
npm notice New major version of npm available! 10.9.2 -> 11.1.0
npm notice Changelog: https://github.com/npm/cli/releases/tag/v11.1.0
npm notice To update run: npm install -g npm@11.1.0
npm notice
task: Failed to run task "build:css": exit status 1

apple@192-168-1-2 orbital % task build:wasm
task: [build:wasm] echo Building wasm file. OS $GOOS ARCH $GOARCH
Building wasm file. OS js ARCH wasm
task: [build:wasm] go build -o orbital/web/orbital.wasm web/wasm/main.go
task: [build:wasm] cp "$(go env GOROOT)/misc/wasm/wasm_exec.js" orbital/web/wasm_exec.js
cp: /opt/homebrew/opt/go/libexec/misc/wasm/wasm_exec.js: No such file or directory
task: Failed to run task "build:wasm": exit status 1

easy fix...

https://tip.golang.org/doc/go1.24#wasm

  • lower memory usage :)
  • changed location to wasm_exec.js
@gedw99 gedw99 changed the title path to wasm_exec path to wasm_exec changed for go 1.24 Feb 16, 2025
@gedw99 gedw99 changed the title path to wasm_exec changed for go 1.24 path to wasm_exec.js changed for go 1.24 Feb 16, 2025
@gedw99
Copy link
Author

gedw99 commented Feb 16, 2025

old

$(GOROOT)/misc/wasm/wasm_exec.js


new go 1.24

$(GOROOT)/lib/wasm/wasm_exec.js

@gedw99
Copy link
Author

gedw99 commented Feb 16, 2025

tinygo for go 1.24 tracking issue: tinygo-org/tinygo#4719

@metacatdud
Copy link
Owner

metacatdud commented Feb 16, 2025

Oh hey, These are being fixed here.

https://github.com/metacatdud/orbital/tree/refactor/wasm-engine

This is WIP. I took a detour bigger than I wanted 😅

Also, I didn't took tinygo into account here.
This branch should go inyo #12 than main.

@metacatdud
Copy link
Owner

I will need to add some github actions to create releases.

That build:css it's a bit hackish. It need improvement.

Also, maybe I will need to add some sort of command in taskfile to asses if a dev has everything in order to be able to work

@gedw99
Copy link
Author

gedw99 commented Feb 17, 2025

Cool

You can often use a taskfile in GitHub actions btw.
So one source of truth for the build.

I am a bit sick . Flu thing , so not pulling code until I feel better etc

@metacatdud
Copy link
Owner

Yeah, I know. But is not in the scope right now. If we see any utility we can separate the wasm as a separate project an think of a solution than

PS. Get well soon

@metacatdud metacatdud linked a pull request Feb 17, 2025 that will close this issue
@gedw99
Copy link
Author

gedw99 commented Feb 21, 2025

Hey @metacatdud

back in business. Needs to just sleep and chill for a bit.

Pulled code on branch "refactor/wasm-engine"

orbital/web/wasm/pkg/storage is where I got stuck. You did too ?

Anything I can do to help ?

@metacatdud
Copy link
Owner

metacatdud commented Feb 21, 2025

I have just pushed with what I think is close to what I imagined.
If you have time/ or want to try it would be a great deal of help to go over components and give some feedback.

I tried around 30 iterations. My brain is mush. I think containing the logic at the component without ANY "framework" it is a bit of wishful thinking.

I will take a small break

PS. What do you mean you got stuck at orbital/web/wasm/pkg/storage?

A very short and brief installation:

  1. You need to run the keygen first as many times as you like.
  2. Grab and secure a set of keys
  3. Run the init command (with sudo) sudo orbital init --sk secret-key-you-generated --ip 127.0.01 --datapath=/abs/path/to/a/storage/dir

/abs/path/to/a/storage/dir will be used by the app for storing various stuff including databases (sqlite) and files

3.1 Running without sudo should output a file in the terminal and there to put it.
Something like:

Cannot write the file. Use sudo privileges. The config file will created at: /etc/orbital/config.yaml
If you are not comfortable running Orbital with sudo, create the file manually and copy the following contents between the BEGIN and END to it

---BEGIN config.yaml---

secretKey: secret-key-you-generated
bindIp: 127.0.0.1
dataPath: /abs/path/to/a/storage/dir

---END config.yaml---

@gedw99
Copy link
Author

gedw99 commented Feb 22, 2025

Thanks for the instructions.

I will try it out and give a full reproduction if I get stuck so we can team work it.

.

@gedw99
Copy link
Author

gedw99 commented Feb 22, 2025

Same issue as before with storage.

On the refactor/wasm-engine branch.

Maybe just a go mod override you have on your side ? happens all the time..

cd web/wasm && GOOS=js GOARCH=wasm go build -o /Users/apple/workspace/go/src/github.com/gedw99/kanka-cloudflare/modules/wasm/metacatdud__orbital/.bin/orbital_wasm_bin_js_wasmgo
pkg/di/di.go:6:2: package orbital/web/wasm/pkg/storage is not in std (/opt/homebrew/opt/go/libexec/src/orbital/web/wasm/pkg/storage)

I use a specialised Make file ( cause life is short ) but you can see what I am doing.

MAKEFILE:

LD_FLAGS="-s -w -X main.Version=$(BASE_SRC_VERSION_WHICH) -X main.Compile=$(BASE_SRC_VERSION_WHICH) -X main.Branch=$(BASE_SRC_VERSION_WHICH)"
BASE_BIN_GO_BUILD_CMD:=CGO_ENABLED=0 $(BASE_DEP_BIN_GO_NAME) build -tags= -buildvcs=false -ldflags $(LD_FLAGS)


this-bin: base-bin-init base-bin-init-golang
	$(MAKE) base-bin
	$(MAKE) this-bin-wasm

	
WASM_BIN_MOD=.
WASM_BIN_ENTRY=web/wasm
WASM_BIN_NAME=$(BASE_BIN_NAME)_wasm

WASM_BIN_CMD=BASE_BIN_MOD=$(WASM_BIN_MOD) BASE_BIN_ENTRY=$(WASM_BIN_ENTRY) BASE_BIN_NAME=$(WASM_BIN_NAME)

this-bin-wasm:
	# first web / wasm..
	# I am just doing what his make file does.
	
	$(MAKE) $(WASM_BIN_CMD) base-mod-tidy
	# css
	cd $(BASE_SRC)/web/tailwind && $(BUN_DEP_NATIVE) install && $(BUN_DEP_NATIVE) run tailwindcss -i ./orbital.scss -o $(BASE_SRC)/web/orbital.css
	# wasm
	$(MAKE) $(WASM_BIN_CMD) base-bin-wasm
	#$(MAKE) $(BOOKS_BIN_CMD) base-bin-wasm-tiny
	# brotli
	$(MAKE) ARG=$(WASM_BIN_NAME) base-bin-arc-brotli-compress

SH at the point of the wasm build. All the other stuff works fine.

bun works fine btw. works on every nom, yarn stuff I ever hit.
Its the storage import that blows for me..

cd /Users/apple/workspace/go/src/github.com/gedw99/kanka-cloudflare/modules/wasm/metacatdud__orbital/.src/orbital && go mod tidy
make[2]: Leaving directory '/Users/apple/workspace/go/src/github.com/gedw99/kanka-cloudflare/modules/wasm/metacatdud__orbital'
# css
cd /Users/apple/workspace/go/src/github.com/gedw99/kanka-cloudflare/modules/wasm/metacatdud__orbital/.src/orbital/web/tailwind && bun_bin_darwin_arm64 install && bun_bin_darwin_arm64 run tailwindcss -i ./orbital.scss -o /Users/apple/workspace/go/src/github.com/gedw99/kanka-cloudflare/modules/wasm/metacatdud__orbital/.src/orbital/web/orbital.css
bun install v1.1.38 (bf2f153f)
[5.36ms] migrated lockfile from package-lock.json
Saved lockfile

+ autoprefixer@10.4.20
+ npm@10.9.0
+ postcss@8.4.49
+ postcss-cli@11.0.0
+ tailwindcss@3.4.15
+ postcss-import@16.1.0
+ sass@1.81.0

167 packages installed [147.00ms]

Blocked 1 postinstall. Run `bun pm untrusted` for details.

Rebuilding...

Done in 111ms.
# wasm
make BASE_BIN_MOD=. BASE_BIN_ENTRY=web/wasm BASE_BIN_NAME=orbital_wasm base-bin-wasm
make[2]: Entering directory '/Users/apple/workspace/go/src/github.com/gedw99/kanka-cloudflare/modules/wasm/metacatdud__orbital'
fatal: No names found, cannot describe anything.
# golang

--- golang wasm ---
cd /Users/apple/workspace/go/src/github.com/gedw99/kanka-cloudflare/modules/wasm/metacatdud__orbital/.src/orbital && cd web/wasm && GOOS=js GOARCH=wasm go build -o /Users/apple/workspace/go/src/github.com/gedw99/kanka-cloudflare/modules/wasm/metacatdud__orbital/.bin/orbital_wasm_bin_js_wasmgo
pkg/di/di.go:6:2: package orbital/web/wasm/pkg/storage is not in std (/opt/homebrew/opt/go/libexec/src/orbital/web/wasm/pkg/storage)
make[2]: *** [/Users/apple/workspace/go/src/github.com/gedw99/kanka-cloudflare/modules/wasm/metacatdud__orbital/../../base.mk:1974: base-bin-wasm] Error 1
make[2]: Leaving directory '/Users/apple/workspace/go/src/github.com/gedw99/kanka-cloudflare/modules/wasm/metacatdud__orbital'
make[1]: *** [Makefile:106: this-bin-wasm] Error 2
make[1]: Leaving directory '/Users/apple/workspace/go/src/github.com/gedw99/kanka-cloudflare/modules/wasm/metacatdud__orbital'
make: *** [Makefile:89: this-bin] Error 2

@metacatdud
Copy link
Owner

Do you store your projects in $HOME/go?
I usually put my projects outside this folder. I had some isseus in the past.

I have something like $HOME/projects, all my projects are in one place despite the language.

I don't have this issue, and honestly don't know how to reproduce, I will try to put the project in GOPATH. I don't have access to an apple, but I don't think is the case.

@metacatdud
Copy link
Owner

I think it's trying to reference this as module: github.com/gedw99/kanka-cloudflare/ or the module in the project is orbital as this is supposed to work entirely stand-alone.

If so, you need to start replacing the entire project orbital for github.com/gedw99/kanka-cloudflare

Example

package di

import (
	"orbital/web/wasm/pkg/events"
	"orbital/web/wasm/pkg/state"
	"orbital/web/wasm/pkg/storage"
	"orbital/web/wasm/templates"
)

change to

package di

import (
	"github.com/gedw99/kanka-cloudflare/web/wasm/pkg/events"
	"github.com/gedw99/kanka-cloudflare/web/wasm/pkg/state"
	"github.com/gedw99/kanka-cloudflare/web/wasm/pkg/storage"
	"github.com/gedw99/kanka-cloudflare/web/wasm/templates"
)

See if this works.

Do you try to use the wasm part on a different project? Could you give me a bit more context? I can't reproduce this issue (Mostly because I don't know how). Like I said, I had some strange path referencing issues before go.mod era similar to what you have.

I never considered WASM a separate project (Not soon at least)

@metacatdud
Copy link
Owner

I am just making an update and I've noticed I accidentally added that storage in ignore and it's not there.
I think I am going to finish today. So, it's not you it's me 😄

@gedw99
Copy link
Author

gedw99 commented Feb 22, 2025

There we go . Easy one .

Will try again today .

@metacatdud
Copy link
Owner

Leave it for now. I am still redoing some composition flows. I can't decide which is better:

  • on parent component to have all components instantiated in stand by and activate and render them via state
  • or intantiate, bind data, mount all at once when needed.
    I don's know how costly 1st option would be. This gives me the async option via state/events.

I will do some more iterations next week. I am beat, but it starts to get there :)

@gedw99
Copy link
Author

gedw99 commented Feb 22, 2025

no worries mate !!

Take a rest and breath...

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.

2 participants