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

Compiling with tiny Go #23

Open
amlwwalker opened this issue Dec 9, 2023 · 2 comments
Open

Compiling with tiny Go #23

amlwwalker opened this issue Dec 9, 2023 · 2 comments

Comments

@amlwwalker
Copy link

amlwwalker commented Dec 9, 2023

Hey @codablock - i thought as we had solved the other ticket for all intent and purposes, and this isn't related, i'd ask in a new issue.... 😁

I want to compile with Tiny Go,

GOARCH=wasm tinygo build -tags wasm -x -o plugin.wasm -scheduler=none -target=wasi           

However this results in

GOARCH=wasm tinygo build -tags wasm -x -o plugin.wasm -scheduler=none -target=wasi           
package command-line-arguments
        imports github.com/user.name/python-embed/internal/python-libs/data: build constraints exclude all Go files in /Users/user.name/go/src/github.com/user.name/python-embed/internal/python-libs/data
make: *** [wasm] Error 1

I've looked through the files in the data directory and i can't see a constraint that would explicitly cause this - would you have any ideas?

If i put a file in the data folder like

package data

func HelloWorld() string {
	return "hello world"
}

and then compile I get

/usr/local/go/src/internal/cpu/cpu_wasm.go:7:7: CacheLinePadSize redeclared in this block
/usr/local/go/src/internal/cpu/cpu_arm.go:7:7:  other declaration of CacheLinePadSize
/usr/local/go/src/internal/cpu/cpu_wasm.go:9:6: doinit redeclared in this block
/usr/local/go/src/internal/cpu/cpu_arm.go:21:6:         other declaration of doinit

which seems odd as I'm on OSX but it allows a file to be compiled in the dir which exposes this issue...

@codablock
Copy link
Contributor

I have no experience with Tiny Go...but it looks like you're trying to compile to wasm, which is not supported at the moment. go-embed-python relies on python binaries and python code being packaged that are compatible with the target platform that your binary gets compiled for. These binaries are then executed via os/exec, which is not supported in Tiny Go. Even if it would be supported, there is currently no wasm build of Python that could be used in go-embed-python (this might change in the future, but there is a lot missing for this to be practical).

@amlwwalker
Copy link
Author

amlwwalker commented Dec 11, 2023

gotcha. Makes sense. If you hear of any changes, please let me know!
Basically I was hoping to write plugins for Go and then allow those plugins to be written (mainly) in python. I may however still be able to do it if the host application processes the python and not the plugin.

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

No branches or pull requests

2 participants