goreleaser / goreleaser-cross

Docker image for Golang cross-compiling with CGO
MIT License
146 stars 25 forks source link

Do the sysroots need to be regenerated every time dependencies change? #7

Closed ianconsolata closed 2 years ago

ianconsolata commented 2 years ago

This looks like a great project, but I'm still trying to wrap my head around sysroots.

We have a complicated ci / build process that includes a rust project that generates C bindings, and then a go / CGO project that references those bindings. That rust project changes somewhat frequently, as do many of our other dependencies. If I understand the sysroot approach correctly, each sysroot is a slimmed down copy of the target filesystem that includes all headers and dependencies necessary for the main project to compile. Doesn't that mean that the sysroots would have to be updated every time the dependencies change?

An alternative approach, which seems to only be available with Goreleaser Pro, would be to run goreleaser in single target mode and prebuild binaries on each target architecture, and then inject those prebuilt binaries later in the pipeline and have Goreleaser handle the rest of the release process from there. That sounds complicated, but potentially still simpler than needing to manage CI jobs that regenerate the sysroots every time things change.

troian commented 2 years ago

Well, it depends on a few things:

but generally speaking - yes, every time dependencies change the sysroot should be updated.

This issue is not Go/CGO specific tho. Cross-compiling C/C++ has exactly the same issue.

troian commented 2 years ago

@ianconsolata do you have your issue fixed? if so would be awesome to share

troian commented 2 years ago

closing, please create a new issue if any more help needed