Closed torculus closed 2 years ago
@torculus can you test it? Do you think we just need to create a build target?
Yeah, I'm willing to test it. I'm not much of a go programmer, but I think the Linux target should work well as a template
@torculus can you try to build https://github.com/zalando/go-keyring/pull/68 on your system? I just checked https://github.com/vmactions/freebsd-vm and it's a bit weird to run a VM inside macos and then I have to figure what ports I need to install (maybe you want to create a PR for the GH actions?).
@torculus we merged the change and it should built also on *BSD.
So, I attempted to build on my machine and it's complaining about u_int
and uintptr_t
being invalid types
Long story short, upsteam godbus
had an issue with compiling on FreeBSD that was fixed back in 2020 (godbus
version 5.0.4). Unfortunately, go-keyring
is pulling godbus
version 5.0.3, which is unpatched
I don't know if the requirement could be updated, but that would fix this issue
@torculus Could you try with this PR? https://github.com/zalando/go-keyring/pull/70
@mikkeloscar yes! It compiles perfectly without error!
I tried building the example module (on the README), but unfortunately my proficiency with Go is too limited to get it working as a local module. If it gets merged into master and released (go-keyring v0.1.2
), I will re-test it
Note that github.com/godbus/dbus currently does not compile on freebsd/386
. See https://github.com/godbus/dbus/issues/315.
Ah, so the problem is in fact that godbus/gobus relies on cgo and cgo is not easily available when cross-compiling. This may be tricky.
@torculus We have released version v0.2.0
with the update you can try!
@twpayne From where do you cross-compile? Does it not work to compile directly on the target?
We were able to add a CI step running in freebsd VM which works: #71 (I don't know too many details about *BSD so maybe it's different from what you mean?)
It does work when you compile directly, but I'm cross-compiling as I'm using GoReleaser to build chezmoi's release binaries. The GoReleaser job runs on Linux (on GitHub Actions) and cross-compiles binaries for other operating systems and doesn't support cgo.
In practice I think zalando/go-keyring has done all that it's possible to reasonably do here. In chezmoi, I've used build tags to activate the GNOME Keyring functionality when it is available. https://github.com/twpayne/chezmoi/pull/1919 contains the gory details if you're interested.
Thanks for the information.
I will close this issue as it seems like we have done what we could from go-keyring side and support FreeBSD under the right conditions
Considering that FreeBSD has go 1.17.5, libsecret, gnome-keyring, and dbus-daemon, please consider adding support for FreeBSD