Closed prologic closed 2 years ago
Support for BSDs is added here https://github.com/gen2brain/beeep/issues/14, just some build tags. As I can see from your link the problem is godbus/dbus
with *unixTransport does not implement transport (missing SendNullByte method)
, so not sure what can be done in beeep.
@gen2brain That was my point? I can't compile on FreeBSD with your library right now. Can we fix this? I quite like beep :)
But that is not controlled by me, it is another repo, dbus?
There is also this issue https://github.com/godbus/dbus/issues/315, are you cross-compiling? Can you try on actual FreeBSD?
Also, this one https://github.com/godbus/dbus/issues/237, as stated there, is the only platform that uses CGO, so in order to cross-compile, you will need FreeBSD toolchain on Linux.
Ok, so it looks like there is no bug, after all, godbus/dbus
just happens to use CGO on FreeBSD, so it should work if you compile it on FreeBSD (not cross-compile).
What I can do here to make it easier for you is to add e.g. nodbus
build tag, and a new file that will only use notify-send/kdialog
(they are currently used only as a fallback), so you can build without CGO, but it will require one of those apps to be installed in PATH and it will just call them with exec.Command
. Does that help and do you need it? Not sure when will I find time to do it though.
There is also this issue godbus/dbus#315, are you cross-compiling? Can you try on actual FreeBSD?
I was cross-compiling yes.
But the user that had a problem was not.
There is also this issue godbus/dbus#315, are you cross-compiling? Can you try on actual FreeBSD?
Why do we depend on dbus here anyway? How is this getting pulled in?
Ok, so it looks like there is no bug, after all,
godbus/dbus
just happens to use CGO on FreeBSD, so it should work if you compile it on FreeBSD (not cross-compile).What I can do here to make it easier for you is to add e.g.
nodbus
build tag, and a new file that will only usenotify-send/kdialog
(they are currently used only as a fallback), so you can build without CGO, but it will require one of those apps to be installed in PATH and it will just call them withexec.Command
. Does that help and do you need it? Not sure when will I find time to do it though.
Oh! So you're using dbus here for something? And that forces CGO to be used? If so, yes please, if we can have a CGO-less option here that would be great 👌
@gen2brain I'm still not sure why we depend on dbus in the first place, but if we do for a good reason, is there a way we can interop with dbus without CGO? Is there a better library we can use here? I mean D-Bus has an API right?
D-Bus is used to send notifications, i.e org.freedesktop.Notifications
, and it uses CGO only on FreeBSD (maybe some other *BSD, not sure). On Linux, it does not and everything is native.
I don't know the reason for that, but there must be one otherwise devs will avoid CGO usage if possible. Sometimes that is the only possible way (i.e. OpenGL, or on Darwin where syscall is not possible etc.).
The cgo requirement comes from this file here: https://github.com/godbus/dbus/blob/master/transport_unixcred_freebsd.go It would be great if someone finds a way to replace it with go.
Building with dbus on FreeBSD could be guarded with the "cgo" build tag and use a fallback like notify-send for CGO_ENABLED=0 .
Well, the first line in that file is the reason The UnixCredentials system call is currently only implemented on Linux
. So BSD doesn't have one. It is not possible to find a way and replace it with Go, the BSD kernel must implement that system call.
As I said, I can add nodbus
tag and copy notify_unix.go
to notify_unix_nodbus.go
, remove dbus code, add build tags etc. so it only uses notify-send
or kdialog
if first is not found in path. That can be a workaround.
The other, more complicated solution for you would be to compile FreeBSD toolchain on Linux (maybe there are ready-made Docker or scripts) and compile with something similar to this:
CC=x86_64-pc-freebsd-gcc CGO_ENABLED=1 GOOS=freebsd GOARCH=amd64 go build
D-Bus is used to send notifications, i.e
org.freedesktop.Notifications
, and it uses CGO only on FreeBSD (maybe some other *BSD, not sure). On Linux, it does not and everything is native. I don't know the reason for that, but there must be one otherwise devs will avoid CGO usage if possible. Sometimes that is the only possible way (i.e. OpenGL, or on Darwin where syscall is not possible etc.).
Can we file (you should probably) upstream to the author of that dbus library to fix this? We should get native support there too!
@gen2brain Please do this 👌 Let's not ruin a good "notification" library just because BSD hasn't implement something Linux has had for a while 😂 cough* 🤣
Added
nodbus
in 0d84a3d
Nice one! 👌 Would you mind also tagging a new release when you're done too? 🙇♂️
I'm trying to see if your commit lets me cross-compile (when I do releases) but something is not working for me :/
⨯ release failed after 3.91s error=failed to build for freebsd_arm64: exit status 2: # github.com/godbus/dbus/v5
../../go/pkg/mod/github.com/godbus/dbus/v5@v5.1.0/transport_unix.go:52:3: cannot use t (type *unixTransport) as type transport in return argument:
*unixTransport does not implement transport (missing SendNullByte method)
../../go/pkg/mod/github.com/godbus/dbus/v5@v5.1.0/transport_unix.go:58:3: cannot use t (type *unixTransport) as type transport in return argument:
*unixTransport does not implement transport (missing SendNullByte method)
(⎈ |local:default)
prologic@Jamess-iMac
Wed Mar 23 23:08:15
~/Projects/saltyim
(master) 1
$ sift nodbus
Makefile:41: -tags "netgo static_build nodbus" \
.goreleaser.yml:12: - -tags=netgo static_build nodbus
What am I doing wrong?
I really don't have time to debug your project. You are probably not passing tag everywhere, for go test
etc.
I really don't have time to debug your project. You are probably not passing tag everywhere, for
go test
etc.
I wasn't expecting you to, and that came across as a "tad bit rude", I hope you didn't mean for that to happen 🤗 I'll work it out don't worry 😅
Of course, I didn't mean to be rude.
Can we add support for FreeBSD and perhaps other *BSD(s)?
As reported here this library doesn't work on FreeBSD due to some missing implemtnation?
Let's fix this!