Set flags to cross-compile darwin/arm64 on darwin/amd64 and vice versa #760
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Should fix #758, but comments definitely welcome from people with more understanding than me on Go cross-compilation and the build/release process for aws-vault (@mtibben!).
In order to try and validate this, I've compiled the native target on darwin/amd64 (Catalina 10.15.7) and darwin/arm64 (Big Sur 11.2.3) and cross-compiled for the opposite architecture on both darwin/amd64 and darwin/arm64.
In all cases, I've run
aws-vault --debug
and checked for the presence of keychain in the list of backends.Original commit message follows.
This is an attempt to fix a lack of keychain support in darwin/arm64
binaries that have been cross-compiled on other platforms as described
in #758 and hinted at in
the linked
99designs/keyring@756c48d
Given the keychain support from keyring[1] is provided by cgo, and CGO
is disabled by default in cross-compilation, we need to enable that,
and deal with dev tooling/libraries.
I dug this solution from the Go issues, specifically
golang/go#44112
Be warned, I am not familiar with the ins and outs of Go compilation,
especially when it comes to cross-compilation of CGO code, but at
least in this case, this change allows for a functional cross-compiled
binary.
I fully expect that attempting to cross-compile darwin/arm64 on
anything other than darwin/amd64 (or the opposite way around) is going
to end badly.
[1] https://github.com/99designs/keyring