Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MacOS support #2

Open
mikekosulin opened this issue Jan 3, 2023 · 1 comment
Open

MacOS support #2

mikekosulin opened this issue Jan 3, 2023 · 1 comment
Labels
wontfix This will not be worked on

Comments

@mikekosulin
Copy link

mikekosulin commented Jan 3, 2023

I tried to compile pbpctrl for MacOS.
To solve dependency issues, I installed the missing packages: brew install dbus protobuf.
Then I ran cargo build --release --target aarch64-apple-darwin, but as expected, no success.

Compile output
$ cargo build --release --target aarch64-apple-darwin
   Compiling bluer v0.15.4
error[E0432]: unresolved imports `libc::Ioctl`, `libc::SOCK_CLOEXEC`, `libc::SOCK_NONBLOCK`
 --> ~/.cargo/registry/src/github.com-1ecc6299db9ec823/bluer-0.15.4/src/sock.rs:3:40
  |
3 | use libc::{c_int, sockaddr, socklen_t, Ioctl, SOCK_CLOEXEC, SOCK_NONBLOCK};
  |                                        ^^^^^  ^^^^^^^^^^^^  ^^^^^^^^^^^^^ no `SOCK_NONBLOCK` in the root
  |                                        |      |
  |                                        |      no `SOCK_CLOEXEC` in the root
  |                                        no `Ioctl` in the root
  |
help: a similar name exists in the module
  |
3 | use libc::{c_int, sockaddr, socklen_t, ioctl, SOCK_CLOEXEC, SOCK_NONBLOCK};
  |                                        ~~~~~
help: a similar name exists in the module
  |
3 | use libc::{c_int, sockaddr, socklen_t, Ioctl, O_CLOEXEC, SOCK_NONBLOCK};
  |                                               ~~~~~~~~~
help: a similar name exists in the module
  |
3 | use libc::{c_int, sockaddr, socklen_t, Ioctl, SOCK_CLOEXEC, O_NONBLOCK};
  |                                                             ~~~~~~~~~~

error[E0432]: unresolved imports `libc::SOCK_CLOEXEC`, `libc::SOCK_NONBLOCK`
 --> ~/.cargo/registry/src/github.com-1ecc6299db9ec823/bluer-0.15.4/src/gatt/mod.rs:5:22
  |
5 | use libc::{AF_LOCAL, SOCK_CLOEXEC, SOCK_NONBLOCK, SOCK_SEQPACKET};
  |                      ^^^^^^^^^^^^  ^^^^^^^^^^^^^ no `SOCK_NONBLOCK` in the root
  |                      |
  |                      no `SOCK_CLOEXEC` in the root
  |
help: a similar name exists in the module
  |
5 | use libc::{AF_LOCAL, O_CLOEXEC, SOCK_NONBLOCK, SOCK_SEQPACKET};
  |                      ~~~~~~~~~
help: a similar name exists in the module
  |
5 | use libc::{AF_LOCAL, SOCK_CLOEXEC, O_NONBLOCK, SOCK_SEQPACKET};
  |                                    ~~~~~~~~~~

error[E0432]: unresolved imports `libc::AF_BLUETOOTH`, `libc::SOL_BLUETOOTH`, `libc::TIOCINQ`
  --> ~/.cargo/registry/src/github.com-1ecc6299db9ec823/bluer-0.15.4/src/rfcomm/mod.rs:16:12
   |
16 |     c_int, AF_BLUETOOTH, EAGAIN, EINPROGRESS, MSG_PEEK, SHUT_RD, SHUT_RDWR, SHUT_WR, SOCK_RAW, SOCK_STREAM,
   |            ^^^^^^^^^^^^ no `AF_BLUETOOTH` in the root
17 |     SOL_BLUETOOTH, SOL_SOCKET, SO_ERROR, SO_RCVBUF, TIOCINQ, TIOCOUTQ,
   |     ^^^^^^^^^^^^^ no `SOL_BLUETOOTH` in the root    ^^^^^^^ no `TIOCINQ` in the root

error[E0425]: cannot find function `accept4` in crate `libc`
   --> ~/.cargo/registry/src/github.com-1ecc6299db9ec823/bluer-0.15.4/src/sock.rs:147:15
    |
147 |         libc::accept4(socket.as_raw_fd(), saddr.as_mut_ptr() as *mut _, &mut length, SOCK_CLOEXEC | SOCK_NONBLOCK)
    |               ^^^^^^^ help: a function with a similar name exists: `accept`
    |
   ::: ~/.cargo/registry/src/github.com-1ecc6299db9ec823/libc-0.2.139/src/unix/mod.rs:641:5
    |
641 |     pub fn accept(socket: ::c_int, address: *mut sockaddr, address_len: *mut socklen_t) -> ::c_int;
    |     ---------------------------------------------------------------------------------------------- similarly named function `accept` defined here

Some errors have detailed explanations: E0425, E0432.
For more information about an error, try `rustc --explain E0425`.
error: could not compile `bluer` due to 4 previous errors
warning: build failed, waiting for other jobs to finish...
error: could not compile `bluer` due to 4 previous errors

Is it possible to use something crossplatform for bluetooth bindings?

@qzed
Copy link
Owner

qzed commented Jan 3, 2023

I currently don't have any plans for supporting other operating systems, but I'd consider PRs.

As you've spotted correctly, the problem is that we depend on the bluer crate for anything bluetooth related, which is a rust-frontend to BlueZ (Linux-only). I had a brief look at rust bluetooth libraries when I started this project, but it doesn't look like there is any (BT-classic) cross-platform crate. The only cross-platform crates I've found are for BLE only (e.g. btleplug), but we need RFCOMM support.

@qzed qzed added the wontfix This will not be worked on label Jan 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants