Skip to content
This repository has been archived by the owner on Nov 24, 2021. It is now read-only.

tinygo #22

Open
gedw99 opened this issue Mar 23, 2021 · 1 comment
Open

tinygo #22

gedw99 opened this issue Mar 23, 2021 · 1 comment

Comments

@gedw99
Copy link

gedw99 commented Mar 23, 2021

The latest release has been working for me on 2 golang projects so far.

Might be worth trying it out for benthos lab.

This is able to compile a golang badgerDB to tinygo.

all: g-dep js-dep js-dep-os g-all js-build

all-delete: g-dep-delete js-dep-delete

# https://github.com/genjidb/genji

LIB_NAME=genji
LIB=github.com/genjidb/$(LIB_NAME)


g-dep:
	git clone https://$(LIB)
g-dep-delete:
	rm -rf $(LIB_NAME)

g-init:
	cd $(LIB_NAME) && go mod tidy
g-all:
	cd $(LIB_NAME) && $(MAKE) all
g-gen:
	cd $(LIB_NAME) && $(MAKE) gen
g-build:
	cd $(LIB_NAME) && $(MAKE) build
g-test:	
	cd $(LIB_NAME) && $(MAKE) test
g-bench:
	cd $(LIB_NAME) && $(MAKE) bench
g-run:
	genji -h

#### JS / WASM

# https://github.com/genjidb/genji.js

JS_LIB_NAME=genji.js
JS_LIB=github.com/genjidb/$(JS_LIB_NAME)


js-dep:
	git clone https://$(JS_LIB)
js-dep-delete:
	rm -rf $(JS_LIB_NAME)

js-dep-os:
	# tinygo
	brew tap tinygo-org/tools
	brew install tinygo
	tinygo version

js-build:
	# also calls tinygo.
	cd $(JS_LIB_NAME) && yarn install && yarn build
@gedw99
Copy link
Author

gedw99 commented Mar 23, 2021

Mhhh

No luck and i think it might be reflection, but need to look further.

here is repro of me trying to build benthos-lab.

dep tinygo:

	brew tap tinygo-org/tools
	brew install tinygo
	tinygo version

build golang wasm: ( works )

GOOS=js GOARCH=wasm go build -ldflags="-s -w" -o /Users/apple/workspace/go/src/github.com/gedw99/research/servers/dataflow/benthos/_bin/benthos-lab-wasm.wasm ./client/wasm/benthos-lab.go

build tinygo wasm: ( does not work )

tinygo build -o /Users/apple/workspace/go/src/github.com/gedw99/research/servers/dataflow/benthos/_bin/benthos-lab-wasm.wasm -target wasm --no-debug ./client/wasm/benthos-lab.go
../../../../../../../../pkg/mod/github.com/rcrowley/[email protected]/debug.go:4:2: package runtime/debug is not in GOROOT (/Users/apple/Library/Caches/tinygo/goroot-go1.16.2-53d3c84e483c6ef0ed352a46dda63ea5bb8115d56e71e900a29c71fcd629271d/src/runtime/debug)
/Users/apple/Library/Caches/tinygo/goroot-go1.16.2-53d3c84e483c6ef0ed352a46dda63ea5bb8115d56e71e900a29c71fcd629271d/src/net/http/pprof/pprof.go:73:2: package runtime/trace is not in GOROOT (/Users/apple/Library/Caches/tinygo/goroot-go1.16.2-53d3c84e483c6ef0ed352a46dda63ea5bb8115d56e71e900a29c71fcd629271d/src/runtime/trace)
make: *** [build-lab-tinygo] Error 1

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

No branches or pull requests

1 participant