-
-
Notifications
You must be signed in to change notification settings - Fork 678
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
Document setting up a cross-compiling toolchain with cgo #1642
Comments
+1 Specifically looking for Linux to Mac|Windows cross-compilation for projects with cgo. |
@jayconrod is there any support for this documentation in the near future? |
@prestonvanloon Does #1956 solve your problem with non-empty archives? It should be released soon. About setting up cross-compilation, I wrote Configuring a custom C toolchain some time ago. It doesn't get into cross-compilation specifically, but maybe it will be helpful. |
Not quite. We have this target here https://github.com/prysmaticlabs/bazel-go-ethereum/blob/master/crypto/secp256k1/BUILD.bazel#L4-L50 which happily produces an empty Generated file looks something like this:
|
Any updates? |
I've managed to to cross compile from 64-bit linux to 32-bit Windows. I may have overcomplicated, but it seems to work. I borrowed a lot from https://docs.bazel.build/versions/3.3.0/tutorial/cc-toolchain-config.html. The following is tested with;
That's it! You should be able to run this on a 64-bit linux machine (with the 32-bit mingw toolchain installed) and produce a Go binary for 32-bit Windows. |
I know it has been a while but I believe this is much needed. Note on
|
Setting up C/C++ cross-compiling toolchains in Bazel is non-trivial. We should document how to do this in a way that works with cgo.
The text was updated successfully, but these errors were encountered: