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

support using with tinygo #1387

Closed
wants to merge 1 commit into from

Conversation

rajatjindal
Copy link

hello

I am using logrus in a golang wasm project (code here) and when trying to build it using tinygo, I am running into following issue:

$) tinygo build -target=wasi -gc=leaking -no-debug --tags 'tinygo' -o main.wasm main.go
wasm-ld: error: /var/folders/5r/6y6fr12x1dq6qnt74zn4_1wm0000gn/T/tinygo159344941/main.o: undefined symbol: golang.org/x/sys/unix.Syscall
error: failed to link /var/folders/5r/6y6fr12x1dq6qnt74zn4_1wm0000gn/T/tinygo159344941/main: exit status 1
Error: Build command for component goodfirstissue failed with status Exited(1)

I ran into a similar problem using mattn/go-isatty, which is apparently fixed by a similar PR

therefore I am submitting this PR for logurs to allow us to use it with tinygo in a similar fashion.

Kindly let me know if this makes sense. I am happy to answer or implement any feedback that you might have.

Regards
Rajat Jindal

Signed-off-by: Rajat Jindal <[email protected]>
@rajatjindal
Copy link
Author

requesting review from @sirupsen

@sirupsen
Copy link
Owner

sirupsen commented Jun 3, 2023

Can you explain https://github.com/sirupsen/logrus/pull/1388/files vs this PR? @flavio

@flavio
Copy link
Contributor

flavio commented Jun 5, 2023

They are similar. TinyGo and the official Go compiler use a different identifier for the WASI target. TinyGo uses wasi, while the official Go compiler will use wasip1.

I think we could make the two PR conflate into a single one and make it target both GOOS values.

BTW, the usage of the tinygo identifier seems a bit too wide to me. This would identify also a TinyGo binary built for a regular linux/osx/windows system.

@rajatjindal
Copy link
Author

I am happy to have my PR closed in favor of #1388 if we want to add support of tinygo there as well. thank you.

@flavio
Copy link
Contributor

flavio commented Jun 6, 2023

I've updated my PR to include tinygo + wasi support

You can see a demo here: https://gist.github.com/flavio/f24fc3f349c09ac134e2e130109488e9

@sirupsen
Copy link
Owner

sirupsen commented Jun 6, 2023

merged the other one

@sirupsen sirupsen closed this Jun 6, 2023
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 this pull request may close these issues.

3 participants