-
Notifications
You must be signed in to change notification settings - Fork 570
Question: how to debug non-compiling code? (syscall error) #1104
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
Comments
First, appreciate a detailed report, it makes a lot easier to provide support :) Are you using an M1 Mac? It is, unfortunately, a known problem that under M1 Mac GopherJS doesn't work well: #1041. The biggest problem is that neither of current GopherJS maintainers have an M1 Mac, so it's hard for us to test against it. If you build with GOOS=linux, but run on Mac OS, the crash is unsurprising — linux syscalls are incompatible with darwin. There are some long-term enhancements planned (#693), but I haven't had enough time to finish them yet. In the short term, you have several options:
Hope that helps :) |
Thanks for your help! I totally forgot to mention this, but I'm on macOS 10.14 on an Intel machine, so this is not an M1 issue at least. I'm going to actually try a slightly different route, since my eventual goal is to have this run in the browser rather than on Node I'll just see if I can use the library with a binary buffer as input rather than a filename, and then figure out how to connect a JS browser file buffer from a drag and drop operation to that. That should obviate the need for syscalls to begin with. Your list of options is very helpful, so thanks for that. I'll give it a go. |
Glad to hear that. I'll close this issue for now, feel free to reopen if you have more questions. Also, we have a #gopherjs channel in the Gophers slack, feel free to join and ask there :) |
Hi all. I'm a JS dev who's a total noob to Go, and I've been looking into GopherJS because I'm currently working on a tool that will run in the browser and would really greatly benefit from being able to run a library written in Go that's not available on any other platform.
For testing purposes I'm doing everything in Node so far. What I've been wondering about is if there's some way to more easily debug problems—for example, right now I've made a really simple script that calls the library I want and tried to use it on a single file and then print the results.
It compiles, but then crashes when running:
When compiling for Linux (I'm on macOS), it seems I get a bit more information:
After going through the document and installing the syscall module, I still get the same error compiling for Darwin, but compiling for Linux now yields the following:
My guess in this case is that the system call for opening files is not working. In the library it does the following:
I'm guessing this is probably the issue that I'd need to look into, in this particular case. Like maybe I need to use Node's own methods for loading the file and then rewrite the library code to accept a file buffer?
My question is, is there a better process for tracking down problems and knowing how to fix them? As a JS developer who hasn't worked in Go before I feel a little out of depth here and I'm not sure how to approach things that might come up. Any tips are greatly appreciated.
The text was updated successfully, but these errors were encountered: