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

[BUG] Compiling to wasm fails #1844

Closed
paulm17 opened this issue Dec 13, 2024 · 5 comments
Closed

[BUG] Compiling to wasm fails #1844

paulm17 opened this issue Dec 13, 2024 · 5 comments
Assignees
Labels
bug Someting isn't working

Comments

@paulm17
Copy link

paulm17 commented Dec 13, 2024

I'm following the article: https://permify.co/post/wasm-go/

Step 1:

GOOS=js GOARCH=wasm go build -o permify.wasm main.go

Results in:

# go.opentelemetry.io/otel/exporters/jaeger/internal/third_party/thrift/lib/go/thrift
/Users/paul/go/pkg/mod/go.opentelemetry.io/otel/exporters/[email protected]/internal/third_party/thrift/lib/go/thrift/socket_unix_conn.go:60:63: undefined: syscall.MSG_PEEK
/Users/paul/go/pkg/mod/go.opentelemetry.io/otel/exporters/[email protected]/internal/third_party/thrift/lib/go/thrift/socket_unix_conn.go:60:80: undefined: syscall.MSG_DONTWAIT
@paulm17 paulm17 added the bug Someting isn't working label Dec 13, 2024
@tolgaOzen
Copy link
Member

Hello @paulm17, could you please pull the latest updates and try again? Navigate to the path pkg/development/wasm by running:

cd pkg/development/wasm

Then, execute the following command to build:

GOOS=js GOARCH=wasm go build -o permify.wasm main.go

Alternatively, you can simplify this process by using:

make wasm-build

Let me know if it works!

@paulm17
Copy link
Author

paulm17 commented Dec 18, 2024

@tolgaOzen

Running the two examples:

paul@Pauls-MBP-2 permify % make wasm-build
cd ./pkg/development/wasm && GOOS=js GOARCH=wasm go build -ldflags="-s -w" -o main.wasm && wasm-opt main.wasm --enable-bulk-memory -Oz -o play.wasm
/bin/sh: wasm-opt: command not found
make: *** [wasm-build] Error 127
paul@Pauls-MBP-2 permify % cd pkg/development/wasm
paul@Pauls-MBP-2 wasm % ls
main.go		main.wasm
paul@Pauls-MBP-2 wasm % GOOS=js GOARCH=wasm go build -o permify.wasm main.go
paul@Pauls-MBP-2 wasm % ls
main.go		main.wasm	permify.wasm

@tolgaOzen
Copy link
Member

Hello, as you can see, the second one works, and for the first one, you need to install the wasm-opt package. After that it should work

@paulm17
Copy link
Author

paulm17 commented Dec 18, 2024

Yes, I just wanted to confirm with you. Many thanks for resolving this! 👍

@paulm17 paulm17 closed this as completed Dec 18, 2024
@tolgaOzen
Copy link
Member

You are welcome 🙌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Someting isn't working
Projects
None yet
Development

No branches or pull requests

3 participants