-
Notifications
You must be signed in to change notification settings - Fork 570
Better Error Message for Compiling Packages with CGO #215
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
Okay, so apparently that error only occurs on the first run of
|
If you're trying to compile That said, perhaps there should be a more graceful error message. |
Thanks for the quick response. I thought I remembered reading something ages ago about GopherJS and the |
There should be a proper error message when importing "C", but I'll check, maybe there's a regression or some other bug. @huntaub I'm curious about what you are trying to do. Will your code run in the browser? |
Well, if by, "will it run in the browser", you are asking whether I was compiling this with the expectation of it just working, then answer is no (because it does use the I can tell you that it appears that the error (panic and import) occur when the |
GopherJS doesn't support CGo. This was originally enabled to address gopherjs#215 by providing a better error when attempting to build a CGo package (instead of a compiler panic). However, this approach makes GopherJS refuse to build packages, which have a CGo and purego versions guarded by the `cgo` build tag: GopherJS woudl try to load the cgo version and error out. After this change GopherJS won't attempt to load Go sources with `import "C"`, and it will load sources with `//go:build !cgo` instead. For packages that require CGo one of the following errors will be returned: - "No buildable sources" if all Go sources import C. - "Undefined symbol" for symbols defined in the Go sources that import C and that are referenced by other Go source files. - "Unknown import path C" if you try to `gopherjs run` a source with import C directly.
GopherJS doesn't support CGo. This was originally enabled to address gopherjs#215 by providing a better error when attempting to build a CGo package (instead of a compiler panic). However, this approach makes GopherJS refuse to build packages, which have a CGo and purego versions guarded by the `cgo` build tag: GopherJS woudl try to load the cgo version and error out. After this change GopherJS won't attempt to load Go sources with `import "C"`, and it will load sources with `//go:build !cgo` instead. For packages that require CGo one of the following errors will be returned: - "No buildable sources" if all Go sources import C. - "Undefined symbol" for symbols defined in the Go sources that import C and that are referenced by other Go source files. - "Unknown import path C" if you try to `gopherjs run` a source with import C directly.
GopherJS doesn't support CGo. This was originally enabled to address gopherjs#215 by providing a better error when attempting to build a CGo package (instead of a compiler panic). However, this approach makes GopherJS refuse to build packages, which have a CGo and purego versions guarded by the `cgo` build tag: GopherJS woudl try to load the cgo version and error out. After this change GopherJS won't attempt to load Go sources with `import "C"`, and it will load sources with `//go:build !cgo` instead. For packages that require CGo one of the following errors will be returned: - "No buildable sources" if all Go sources import C. - "Undefined symbol" for symbols defined in the Go sources that import C and that are referenced by other Go source files. - "Unknown import path C" if you try to `gopherjs run` a source with import C directly.
GopherJS doesn't support CGo. This was originally enabled to address gopherjs#215 by providing a better error when attempting to build a CGo package (instead of a compiler panic). However, this approach makes GopherJS refuse to build packages, which have a CGo and purego versions guarded by the `cgo` build tag: GopherJS woudl try to load the cgo version and error out. After this change GopherJS won't attempt to load Go sources with `import "C"`, and it will load sources with `//go:build !cgo` instead. For packages that require CGo one of the following errors will be returned: - "No buildable sources" if all Go sources import C. - "Undefined symbol" for symbols defined in the Go sources that import C and that are referenced by other Go source files. - "Unknown import path C" if you try to `gopherjs run` a source with import C directly.
GopherJS doesn't support CGo. This was originally enabled to address gopherjs#215 by providing a better error when attempting to build a CGo package (instead of a compiler panic). However, this approach makes GopherJS refuse to build packages, which have a CGo and purego versions guarded by the `cgo` build tag: GopherJS woudl try to load the cgo version and error out. After this change GopherJS won't attempt to load Go sources with `import "C"`, and it will load sources with `//go:build !cgo` instead. For packages that require CGo one of the following errors will be returned: - "No buildable sources" if all Go sources import C. - "Undefined symbol" for symbols defined in the Go sources that import C and that are referenced by other Go source files. - "Unknown import path C" if you try to `gopherjs run` a source with import C directly.
So, now that I have GopherJS setup and working again, I attempted to compile my program. I get the following panic log:
I am not quite sure what is happening. The program is fairly complicated (and uses the "net" package, which I know is not supported), so I'm not sure if that could be causing it. Thanks for letting me know!
The text was updated successfully, but these errors were encountered: