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

musl libc support #332

Open
apprehensions opened this issue Dec 14, 2024 · 1 comment
Open

musl libc support #332

apprehensions opened this issue Dec 14, 2024 · 1 comment

Comments

@apprehensions
Copy link

warning: use of deprecated type alias `uapi::c::time_t`: This type is changed to 64-bit in musl 1.2.0, we'll follow that change in the future release. See #1848 for more info.
   --> src/time.rs:105:59
    |
105 |         let secs = (rhs.as_nanos() / 1_000_000_000) as c::time_t;
    |                                                           ^^^^^^
    |
    = note: `#[warn(deprecated)]` on by default

error[E0063]: missing field `__pad1` in initializer of `cmsghdr`
  --> src/io_uring/ops/sendmsg.rs:47:27
   |
47 |                 let hdr = c::cmsghdr {
   |                           ^^^^^^^^^^ missing `__pad1`

error[E0308]: mismatched types
  --> src/io_uring/ops/sendmsg.rs:69:36
   |
69 |             st.msghdr.msg_iovlen = st.iovecs.len();
   |             --------------------   ^^^^^^^^^^^^^^^ expected `i32`, found `usize`
   |             |
   |             expected due to the type of this binding

error[E0308]: mismatched types
   --> src/udmabuf.rs:113:52
    |
113 |         let dmabuf = unsafe { ioctl(self.fd.raw(), UDMABUF_CREATE, &mut cmd) };
    |                               -----                ^^^^^^^^^^^^^^ expected `i32`, found `u64`
    |                               |
    |                               arguments to this function are incorrect
    |
note: function defined here
   --> /home/sewn/.local/share/cargo/registry/src/index.crates.io-6f17d22bba15001f/libc-0.2.153/src/unix/linux_like/linux/musl/mod.rs:850:12
    |
850 |     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
    |
113 |         let dmabuf = unsafe { ioctl(self.fd.raw(), UDMABUF_CREATE.try_into().unwrap(), &mut cmd) };
    |                                                                  ++++++++++++++++++++

error[E0308]: mismatched types
   --> src/video/dmabuf.rs:82:44
    |
82  |     let res = unsafe { ioctl(dmabuf.raw(), DMA_BUF_IOCTL_EXPORT_SYNC_FILE, &mut data) };
    |                        -----               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `i32`, found `u64`
    |                        |
    |                        arguments to this function are incorrect
    |
note: function defined here
   --> /home/sewn/.local/share/cargo/registry/src/index.crates.io-6f17d22bba15001f/libc-0.2.153/src/unix/linux_like/linux/musl/mod.rs:850:12
    |
850 |     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
    |
82  |     let res = unsafe { ioctl(dmabuf.raw(), DMA_BUF_IOCTL_EXPORT_SYNC_FILE.try_into().unwrap(), &mut data) };
    |                                                                          ++++++++++++++++++++

error[E0308]: mismatched types
   --> src/video/dmabuf.rs:99:44
    |
99  |     let res = unsafe { ioctl(dmabuf.raw(), DMA_BUF_IOCTL_IMPORT_SYNC_FILE, &mut data) };
    |                        -----               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `i32`, found `u64`
    |                        |
    |                        arguments to this function are incorrect
    |
note: function defined here
   --> /home/sewn/.local/share/cargo/registry/src/index.crates.io-6f17d22bba15001f/libc-0.2.153/src/unix/linux_like/linux/musl/mod.rs:850:12
    |
850 |     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
    |
99  |     let res = unsafe { ioctl(dmabuf.raw(), DMA_BUF_IOCTL_IMPORT_SYNC_FILE.try_into().unwrap(), &mut data) };
    |                                                                          ++++++++++++++++++++

error[E0308]: mismatched types
   --> src/video/drm/sys.rs:26:37
    |
26  |         ret = unsafe { c::ioctl(fd, request, &mut *t) };
    |                        --------     ^^^^^^^ expected `i32`, found `u64`
    |                        |
    |                        arguments to this function are incorrect
    |
note: function defined here
   --> /home/sewn/.local/share/cargo/registry/src/index.crates.io-6f17d22bba15001f/libc-0.2.153/src/unix/linux_like/linux/musl/mod.rs:850:12
    |
850 |     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
    |
26  |         ret = unsafe { c::ioctl(fd, request.try_into().unwrap(), &mut *t) };
    |                                            ++++++++++++++++++++

Some errors have detailed explanations: E0063, E0308.
For more information about an error, try `rustc --explain E0063`.
warning: `jay-compositor` (bin "jay") generated 1 warning
error: could not compile `jay-compositor` (bin "jay") due to 6 previous errors; 1 warning emitted
@mahkoh
Copy link
Owner

mahkoh commented Dec 14, 2024

warning: use of deprecated type alias `uapi::c::time_t`: This type is changed to 64-bit in musl 1.2.0, we'll follow that change in the future release. See #1848 for more info.
   --> src/time.rs:105:59
    |
105 |         let secs = (rhs.as_nanos() / 1_000_000_000) as c::time_t;
    |                                                           ^^^^^^
    |
    = note: `#[warn(deprecated)]` on by default

The type of the tv_sec field in timespec is time_t. What else do they want us to use?

error[E0063]: missing field `__pad1` in initializer of `cmsghdr`
  --> src/io_uring/ops/sendmsg.rs:47:27
   |
47 |                 let hdr = c::cmsghdr {
   |  

I suppose this could be fixed relatively easily by using pod::zeroed and the manually initializing the fields.

error[E0308]: mismatched types
  --> src/io_uring/ops/sendmsg.rs:69:36
   |
69 |             st.msghdr.msg_iovlen = st.iovecs.len();
   |             --------------------   ^^^^^^^^^^^^^^^ expected `i32`, found `usize`
   |             |
   |             expected due to the type of this binding

There is no cross-platform way to initialize this field. It is usize in glibc and u32 in musl.

error[E0308]: mismatched types
   --> src/udmabuf.rs:113:52
    |
113 |         let dmabuf = unsafe { ioctl(self.fd.raw(), UDMABUF_CREATE, &mut cmd) };
    |                               -----                ^^^^^^^^^^^^^^ expected `i32`, found `u64`
    |                               |
    |                               arguments to this function are incorrect
    |

Same here.


In general, musl is not a supported libc for Jay.

@mahkoh mahkoh changed the title Rust E0063 and E0308 musl libc support Dec 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants