-
-
Notifications
You must be signed in to change notification settings - Fork 218
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
Cross-compile for Linux? #35
Comments
I'm having the same issue, I can only compile the binary that corresponds to the OS of my laptop. I've ran the following tests on the same project: On Mac:
On Ubuntu:
It would be great to be able to cross-compile for using things like Goreleaser with CI. |
@jimafisk chiming in here after learning more. Cross-compiling any cgo packages without additional compiler flags is not possible. What you can try doing is installing different compilers to cross-compile. I haven't tested this with V8, but the general idea is here: mattn/go-sqlite3#384 (comment) You can also try: https://github.com/mattn/go-sqlite3#cross-compiling-from-mac-osx. Hope this helps. Please report back if you come up with anything. |
Thanks for pointing me in the right direction here @matthewmueller! There was a lot I didn't know about cross compiling CGO. Looks like goreleaser has a cgo docker image you could use: goreleaser/goreleaser#795 I was already using GoReleaser Action and wanted to continue using it: goreleaser/goreleaser-action#233. So ultimately I created a project that lets me do that: https://github.com/plentico/osxcross-target. Hopefully it helps someone else out! |
Very cool, thanks for sharing! |
Hey, thanks a lot for creating this package!
I've found it the example script works beautifully on mac but when I try to cross-compile for Linux, I get the following:
This looks a bit like I'm just missing the package or something, but it does work when I remove the
GOOS=linux
.Here's my details:
The text was updated successfully, but these errors were encountered: