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

Cannot build on musl targets #53

Closed
lu-zero opened this issue Oct 18, 2022 · 3 comments
Closed

Cannot build on musl targets #53

lu-zero opened this issue Oct 18, 2022 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@lu-zero
Copy link
Contributor

lu-zero commented Oct 18, 2022

While building for aarch64-unknown-linux-musl:

   Compiling bluer v0.15.1 (/tmp/bluer/bluer)
error[E0308]: mismatched types
   --> bluer/src/sys.rs:188:38
    |
188 | pub const RFCOMMCREATEDEV: c_ulong = request_code_write!('R', 200, size_of::<c_int>());
    |                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `u64`, found `i32`
    |
    = note: this error originates in the macro `ioc` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0308]: mismatched types
   --> bluer/src/sys.rs:189:39
    |
189 | pub const RFCOMMRELEASEDEV: c_ulong = request_code_write!('R', 201, size_of::<c_int>());
    |                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `u64`, found `i32`
    |
    = note: this error originates in the macro `ioc` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0061]: this function takes at least 2 arguments but 3 arguments were supplied
   --> bluer/src/sock.rs:303:24
    |
303 |     let ret = unsafe { libc::ioctl(socket.as_raw_fd(), request, value.as_mut_ptr()) };
    |                        ^^^^^^^^^^^                     -------  ------------------ argument unexpected
    |                                                        |
    |                                                        expected `i32`, found `u64`
    |
note: function defined here
   --> /home/lu_zero/.cargo/registry/src/github.com-1ecc6299db9ec823/libc-0.2.135/src/unix/linux_like/linux/musl/mod.rs:727:12
    |
727 |     pub fn ioctl(fd: ::c_int, request: ::c_int, ...) -> ::c_int;
    |            ^^^^^
help: you can convert a `u64` to an `i32` and panic if the converted value doesn't fit
    |
303 |     let ret = unsafe { libc::ioctl(socket.as_raw_fd(), request.try_into().unwrap(), value.as_mut_ptr()) };
    |                                                               ++++++++++++++++++++
help: remove the extra argument
    |
303 |     let ret = unsafe { libc::ioctl(socket.as_raw_fd(), /* i32 */) };
    |                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

error[E0061]: this function takes at least 2 arguments but 3 arguments were supplied
   --> bluer/src/sock.rs:314:24
    |
314 |     let ret = unsafe { libc::ioctl(socket.as_raw_fd(), request, value as *const _) };
    |                        ^^^^^^^^^^^                     -------  ----------------- argument unexpected
    |                                                        |
    |                                                        expected `i32`, found `u64`
    |
note: function defined here
   --> /home/lu_zero/.cargo/registry/src/github.com-1ecc6299db9ec823/libc-0.2.135/src/unix/linux_like/linux/musl/mod.rs:727:12
    |
727 |     pub fn ioctl(fd: ::c_int, request: ::c_int, ...) -> ::c_int;
    |            ^^^^^
help: you can convert a `u64` to an `i32` and panic if the converted value doesn't fit
    |
314 |     let ret = unsafe { libc::ioctl(socket.as_raw_fd(), request.try_into().unwrap(), value as *const _) };
    |                                                               ++++++++++++++++++++
help: remove the extra argument
    |
314 |     let ret = unsafe { libc::ioctl(socket.as_raw_fd(), /* i32 */) };
    |                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

error[E0308]: mismatched types
   --> bluer/src/l2cap.rs:404:64
    |
404 |         let value: c_int = sock::ioctl_read(self.fd.get_ref(), TIOCINQ)?;
    |                            ----------------                    ^^^^^^^ expected `u64`, found `i32`
    |                            |
    |                            arguments to this function are incorrect
    |
note: function defined here
   --> bluer/src/sock.rs:301:8
    |
301 | pub fn ioctl_read<T>(socket: &OwnedFd, request: c_ulong) -> Result<T> {
    |        ^^^^^^^^^^    ----------------  ----------------
help: you can convert an `i32` to a `u64` and panic if the converted value doesn't fit
    |
404 |         let value: c_int = sock::ioctl_read(self.fd.get_ref(), TIOCINQ.try_into().unwrap())?;
    |                                                                       ++++++++++++++++++++

error[E0308]: mismatched types
   --> bluer/src/l2cap.rs:412:64
    |
412 |         let value: c_int = sock::ioctl_read(self.fd.get_ref(), TIOCOUTQ)?;
    |                            ----------------                    ^^^^^^^^ expected `u64`, found `i32`
    |                            |
    |                            arguments to this function are incorrect
    |
note: function defined here
   --> bluer/src/sock.rs:301:8
    |
301 | pub fn ioctl_read<T>(socket: &OwnedFd, request: c_ulong) -> Result<T> {
    |        ^^^^^^^^^^    ----------------  ----------------
help: you can convert an `i32` to a `u64` and panic if the converted value doesn't fit
    |
412 |         let value: c_int = sock::ioctl_read(self.fd.get_ref(), TIOCOUTQ.try_into().unwrap())?;
    |                                                                        ++++++++++++++++++++

error[E0308]: mismatched types
   --> bluer/src/rfcomm/mod.rs:254:64
    |
254 |         let value: c_int = sock::ioctl_read(self.fd.get_ref(), TIOCINQ)?;
    |                            ----------------                    ^^^^^^^ expected `u64`, found `i32`
    |                            |
    |                            arguments to this function are incorrect
    |
note: function defined here
   --> bluer/src/sock.rs:301:8
    |
301 | pub fn ioctl_read<T>(socket: &OwnedFd, request: c_ulong) -> Result<T> {
    |        ^^^^^^^^^^    ----------------  ----------------
help: you can convert an `i32` to a `u64` and panic if the converted value doesn't fit
    |
254 |         let value: c_int = sock::ioctl_read(self.fd.get_ref(), TIOCINQ.try_into().unwrap())?;
    |                                                                       ++++++++++++++++++++

error[E0308]: mismatched types
   --> bluer/src/rfcomm/mod.rs:262:64
    |
262 |         let value: c_int = sock::ioctl_read(self.fd.get_ref(), TIOCOUTQ)?;
    |                            ----------------                    ^^^^^^^^ expected `u64`, found `i32`
    |                            |
    |                            arguments to this function are incorrect
    |
note: function defined here
   --> bluer/src/sock.rs:301:8
    |
301 | pub fn ioctl_read<T>(socket: &OwnedFd, request: c_ulong) -> Result<T> {
    |        ^^^^^^^^^^    ----------------  ----------------
help: you can convert an `i32` to a `u64` and panic if the converted value doesn't fit
    |
262 |         let value: c_int = sock::ioctl_read(self.fd.get_ref(), TIOCOUTQ.try_into().unwrap())?;
    |

I wonder if the socket abstraction couldn't now go away since std has its own OwnedFd now.

@surban
Copy link
Collaborator

surban commented Oct 18, 2022

Hi!

Thanks for reporting this.

Would you be willing to submit a PR that includes musl targets in CI testing?

@lu-zero
Copy link
Contributor Author

lu-zero commented Oct 18, 2022

It would be probably easier once bluer moves to zbus though, spinning up an alpine image is the easiest way to test otherwise. At least that I can think of.

@surban
Copy link
Collaborator

surban commented Oct 19, 2022

Yes, moving to zbus would indeed be great. The only limiting factor here is manpower and that libdbus works well enough currently.

@surban surban closed this as completed Oct 19, 2022
@surban surban added the bug Something isn't working label Oct 19, 2022
otaviojr added a commit to otaviojr/bluer that referenced this issue May 10, 2023
# This is the 1st commit message:

BLE Passive Scanning

# This is the commit message #2:

monitor

# This is the commit message bluez#3:

monitor

# This is the commit message bluez#4:

monitor

# This is the commit message bluez#5:

monitor

# This is the commit message bluez#6:

monitor

# This is the commit message bluez#7:

monitor

# This is the commit message bluez#8:

monitor

# This is the commit message bluez#9:

monitor

# This is the commit message bluez#10:

monitor

# This is the commit message bluez#11:

monitor

# This is the commit message bluez#12:

monitor

# This is the commit message bluez#13:

monitor

# This is the commit message bluez#14:

monitor

# This is the commit message bluez#15:

monitor

# This is the commit message bluez#16:

monitor

# This is the commit message bluez#17:

monitor

# This is the commit message bluez#18:

monitor

# This is the commit message bluez#19:

monitor

# This is the commit message bluez#20:

monitor

# This is the commit message bluez#21:

monitor

# This is the commit message bluez#22:

monitor

# This is the commit message bluez#23:

monitor

# This is the commit message bluez#24:

monitor

# This is the commit message bluez#25:

monitor

# This is the commit message bluez#26:

monitor

# This is the commit message bluez#27:

monitor

# This is the commit message bluez#28:

monitor

# This is the commit message bluez#29:

monitor

# This is the commit message bluez#30:

monitor

# This is the commit message bluez#31:

monitor

# This is the commit message bluez#32:

monitor

# This is the commit message bluez#33:

monitor

# This is the commit message bluez#34:

monitor

# This is the commit message bluez#35:

monitor

# This is the commit message bluez#36:

monitor

# This is the commit message bluez#37:

monitor

# This is the commit message bluez#38:

monitor

# This is the commit message bluez#39:

monitor

# This is the commit message bluez#40:

monitor

# This is the commit message bluez#41:

monitor

# This is the commit message bluez#42:

monitor

# This is the commit message bluez#43:

monitor

# This is the commit message bluez#44:

monitor

# This is the commit message bluez#45:

monitor

# This is the commit message bluez#46:

monitor

# This is the commit message bluez#47:

monitor

# This is the commit message bluez#48:

monitor

# This is the commit message bluez#49:

monitor

# This is the commit message bluez#50:

monitor

# This is the commit message bluez#51:

monitor

# This is the commit message bluez#52:

monitor

# This is the commit message bluez#53:

monitor

# This is the commit message bluez#54:

monitor

# This is the commit message bluez#55:

monitor

# This is the commit message bluez#56:

monitor

# This is the commit message bluez#57:

monitor

# This is the commit message bluez#58:

monitor

# This is the commit message bluez#59:

monitor

# This is the commit message bluez#60:

monitor

# This is the commit message bluez#61:

monitor

# This is the commit message bluez#62:

monitor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants