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 CGO cross building in docker container #546

Open
Stebalien opened this issue Dec 21, 2021 · 1 comment
Open

Support CGO cross building in docker container #546

Stebalien opened this issue Dec 21, 2021 · 1 comment
Labels
need/triage Needs initial labeling and prioritization team/ipdx

Comments

@Stebalien
Copy link
Member

Now that we're using a docker container for builds, it's a lot easier to setup a cross compiler to build binaries with CGO support for macos & 32bit linux.

We can probably just a docker container from https://github.com/techknowlogick/xgo and I have a feeling it'll "just work".

@aschmahmann
Copy link
Contributor

Some motivation for why being able to compile with CGO across our supported platforms (Linux, OS X, Windows) is useful is that it enables kubo (formerly go-ipfs) to be able to support using the variety of code out there that's not written in Go but is exposed via FFI. Not every binary in this repo should need to support CGO building but it should be available.

Some examples I can think of:

A couple other notes here:

  1. Just because we can use CGO it doesn't mean we should. CGO has a performance cost associated with it that might not be present in native Go code, and it has an ecosystem toll in terms of environments that don't support CGO or when dist.ipfs.io builds use different dynamically linked C code than is available in that environment (e.g. CGO vs musl).
  2. However, we should have the option for utilizing CGO if we'd like to especially when the alternative is to forgo a useful feature or settle for something worse
  3. If enough of the kubo community wants builds that do not support CGO I suspect it'll be doable to work with maintainers on how to build plugins or forks that make non-CGO builds doable. That being said IIUC most kubo users operate in environments where CGO support isn't a big problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
need/triage Needs initial labeling and prioritization team/ipdx
Projects
None yet
Development

No branches or pull requests

3 participants