Coder Social home page Coder Social logo

Comments (22)

gen2brain avatar gen2brain commented on June 22, 2024 2

Added nodbus in 0d84a3d

from beeep.

gen2brain avatar gen2brain commented on June 22, 2024 1

There is also this issue godbus/dbus#315, are you cross-compiling? Can you try on actual FreeBSD?

from beeep.

gen2brain avatar gen2brain commented on June 22, 2024 1

Also, this one godbus/dbus#237, as stated there, is the only platform that uses CGO, so in order to cross-compile, you will need FreeBSD toolchain on Linux.

from beeep.

gen2brain avatar gen2brain commented on June 22, 2024 1

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.

from beeep.

gen2brain avatar gen2brain commented on June 22, 2024 1

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.).

from beeep.

srlehn avatar srlehn commented on June 22, 2024 1

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 .

from beeep.

gen2brain avatar gen2brain commented on June 22, 2024 1

I really don't have time to debug your project. You are probably not passing tag everywhere, for go test etc.

from beeep.

gen2brain avatar gen2brain commented on June 22, 2024 1

Of course, I didn't mean to be rude.

from beeep.

gen2brain avatar gen2brain commented on June 22, 2024

Support for BSDs is added here #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.

from beeep.

prologic avatar prologic commented on June 22, 2024

@gen2brain That was my point? I can't compile on FreeBSD with your library right now. Can we fix this? I quite like beep :)

from beeep.

gen2brain avatar gen2brain commented on June 22, 2024

But that is not controlled by me, it is another repo, dbus?

from beeep.

prologic avatar prologic commented on June 22, 2024

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.

from beeep.

prologic avatar prologic commented on June 22, 2024

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?

from beeep.

prologic avatar prologic commented on June 22, 2024

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.

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 👌

from beeep.

prologic avatar prologic commented on June 22, 2024

@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?

from beeep.

gen2brain avatar gen2brain commented on June 22, 2024

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

from beeep.

prologic avatar prologic commented on June 22, 2024

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!

from beeep.

prologic avatar prologic commented on June 22, 2024

@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 🤣

from beeep.

prologic avatar prologic commented on June 22, 2024

Added nodbus in 0d84a3d

Nice one! 👌 Would you mind also tagging a new release when you're done too? 🙇‍♂️

from beeep.

prologic avatar prologic commented on June 22, 2024

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/[email protected]/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/[email protected]/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?

from beeep.

prologic avatar prologic commented on June 22, 2024

See: https://git.mills.io/prologic/saltyim/pulls/47

from beeep.

prologic avatar prologic commented on June 22, 2024

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 😅

from beeep.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.