-
Notifications
You must be signed in to change notification settings - Fork 465
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
Add Windows Support #1219
Add Windows Support #1219
Conversation
directories is able to detect platform and return the correct config directory (~/.config, ~/AppData/Roaming). Adjust Cargo deps accordingly. Also change some use declarations to be platform specific to address build warnings.
im currently getting these errors on Windows 11: error[E0433]: failed to resolve: could not find `unix` in `os`
--> C:\Users\bowen\.cargo\registry\src\index.crates.io-6f17d22bba15001f\daemonize-0.5.0\src\lib.rs:55:14
|
55 | use std::os::unix::ffi::OsStringExt;
| ^^^^ could not find `unix` in `os`
error[E0433]: failed to resolve: could not find `unix` in `os`
--> C:\Users\bowen\.cargo\registry\src\index.crates.io-6f17d22bba15001f\daemonize-0.5.0\src\lib.rs:56:14
|
56 | use std::os::unix::io::AsRawFd;
| ^^^^ could not find `unix` in `os`
Compiling hex v0.4.3
error[E0433]: failed to resolve: could not find `uid_t` in `libc`
--> C:\Users\bowen\.cargo\registry\src\index.crates.io-6f17d22bba15001f\daemonize-0.5.0\src\lib.rs:396:74
|
396 | ...e((pid, libc::uid_t::MAX - 1, gid)),
| ^^^^^ could not find `uid_t` in `libc`
error[E0433]: failed to resolve: could not find `gid_t` in `libc`
--> C:\Users\bowen\.cargo\registry\src\index.crates.io-6f17d22bba15001f\daemonize-0.5.0\src\lib.rs:397:79
|
397 | ...d, uid, libc::gid_t::MAX - 1)),
| ^^^^^ could not find `gid_t` in `libc`
error[E0412]: cannot find type `uid_t` in crate `libc`
--> C:\Users\bowen\.cargo\registry\src\index.crates.io-6f17d22bba15001f\daemonize-0.5.0\src\lib.rs:67:14
|
67 | Id(libc::uid_t),
| ^^^^^ not found in `libc`
error[E0412]: cannot find type `uid_t` in crate `libc`
--> C:\Users\bowen\.cargo\registry\src\index.crates.io-6f17d22bba15001f\daemonize-0.5.0\src\lib.rs:87:44
|
87 | inner: UserImpl::Id(t as libc::uid_t),
| ^^^^^ not found in `libc`
error[E0412]: cannot find type `gid_t` in crate `libc`
--> C:\Users\bowen\.cargo\registry\src\index.crates.io-6f17d22bba15001f\daemonize-0.5.0\src\lib.rs:95:14
|
95 | Id(libc::gid_t),
| ^^^^^ not found in `libc`
error[E0412]: cannot find type `gid_t` in crate `libc`
--> C:\Users\bowen\.cargo\registry\src\index.crates.io-6f17d22bba15001f\daemonize-0.5.0\src\lib.rs:115:45
|
115 | inner: GroupImpl::Id(t as libc::gid_t),
| ^^^^^ not found in `libc`
error[E0412]: cannot find type `mode_t` in crate `libc`
--> C:\Users\bowen\.cargo\registry\src\index.crates.io-6f17d22bba15001f\daemonize-0.5.0\src\lib.rs:123:18
|
123 | inner: libc::mode_t,
| ^^^^^^ not found in `libc`
error[E0412]: cannot find type `mode_t` in crate `libc`
--> C:\Users\bowen\.cargo\registry\src\index.crates.io-6f17d22bba15001f\daemonize-0.5.0\src\lib.rs:129:35
|
129 | inner: inner as libc::mode_t,
| ^^^^^^ not found in `libc`
error[E0425]: cannot find function `umask` in crate `libc`
--> C:\Users\bowen\.cargo\registry\src\index.crates.io-6f17d22bba15001f\daemonize-0.5.0\src\lib.rs:375:19
|
375 | libc::umask(self.umask.inner);
| ^^^^^ not found in `libc`
error[E0412]: cannot find type `uid_t` in crate `libc`
--> C:\Users\bowen\.cargo\registry\src\index.crates.io-6f17d22bba15001f\daemonize-0.5.0\src\lib.rs:393:50
|
393 | let args: Option<(PathBuf, libc::uid_t, libc::gid_t)> =
| ^^^^^ not found in `libc`
error[E0412]: cannot find type `gid_t` in crate `libc`
--> C:\Users\bowen\.cargo\registry\src\index.crates.io-6f17d22bba15001f\daemonize-0.5.0\src\lib.rs:393:63
|
393 | let args: Option<(PathBuf, libc::uid_t, libc::gid_t)> =
| ^^^^^ not found in `libc`
error[E0412]: cannot find type `pid_t` in crate `libc`
--> C:\Users\bowen\.cargo\registry\src\index.crates.io-6f17d22bba15001f\daemonize-0.5.0\src\lib.rs:434:49
|
434 | unsafe fn perform_fork() -> Result<Option<libc::pid_t>, ErrorKind> {
| ^^^^^ not found in `libc`
error[E0425]: cannot find function `fork` in crate `libc`
--> C:\Users\bowen\.cargo\registry\src\index.crates.io-6f17d22bba15001f\daemonize-0.5.0\src\lib.rs:435:31
|
435 | let pid = check_err(libc::fork(), ErrorKind::Fork)?;
| ^^^^ not found in `libc`
error[E0412]: cannot find type `pid_t` in crate `libc`
--> C:\Users\bowen\.cargo\registry\src\index.crates.io-6f17d22bba15001f\daemonize-0.5.0\src\lib.rs:443:30
|
443 | unsafe fn waitpid(pid: libc::pid_t) -> Result<libc::c_int, ErrorKind> {
| ^^^^^ not found in `libc`
error[E0425]: cannot find function `waitpid` in crate `libc`
--> C:\Users\bowen\.cargo\registry\src\index.crates.io-6f17d22bba15001f\daemonize-0.5.0\src\lib.rs:445:22
|
445 | check_err(libc::waitpid(pid, &mut child_ret, 0), ErrorKind::Wait)?;
| ^^^^^^^ not found in `libc`
error[E0425]: cannot find function `setsid` in crate `libc`
--> C:\Users\bowen\.cargo\registry\src\index.crates.io-6f17d22bba15001f\daemonize-0.5.0\src\lib.rs:450:21
|
450 | check_err(libc::setsid(), ErrorKind::DetachSession)?;
| ^^^^^^ help: a function with a similar name exists: `getpid`
|
::: C:\Users\bowen\.cargo\registry\src\index.crates.io-6f17d22bba15001f\libc-0.2.140\src\windows\mod.rs:486:5
|
486 | pub fn getpid() -> ::c_int;
| -------------------------- similarly named function `getpid` defined here
error[E0425]: cannot find value `STDIN_FILENO` in crate `libc`
--> C:\Users\bowen\.cargo\registry\src\index.crates.io-6f17d22bba15001f\daemonize-0.5.0\src\lib.rs:478:25
|
478 | process_stdio(libc::STDIN_FILENO, stdin)?;
| ^^^^^^^^^^^^ not found in `libc`
error[E0425]: cannot find value `STDOUT_FILENO` in crate `libc`
--> C:\Users\bowen\.cargo\registry\src\index.crates.io-6f17d22bba15001f\daemonize-0.5.0\src\lib.rs:479:25
|
479 | process_stdio(libc::STDOUT_FILENO, stdout)?;
| ^^^^^^^^^^^^^ not found in `libc`
error[E0425]: cannot find value `STDERR_FILENO` in crate `libc`
--> C:\Users\bowen\.cargo\registry\src\index.crates.io-6f17d22bba15001f\daemonize-0.5.0\src\lib.rs:480:25
|
480 | process_stdio(libc::STDERR_FILENO, stderr)?;
| ^^^^^^^^^^^^^ not found in `libc`
error[E0412]: cannot find type `gid_t` in crate `libc`
--> C:\Users\bowen\.cargo\registry\src\index.crates.io-6f17d22bba15001f\daemonize-0.5.0\src\lib.rs:487:51
|
487 | unsafe fn get_group(group: Group) -> Result<libc::gid_t, ErrorKind> {
| ^^^^^ not found in `libc`
error[E0412]: cannot find type `gid_t` in crate `libc`
--> C:\Users\bowen\.cargo\registry\src\index.crates.io-6f17d22bba15001f\daemonize-0.5.0\src\lib.rs:500:34
|
500 | unsafe fn set_group(group: libc::gid_t) -> Result<(), ErrorKind> {
| ^^^^^ not found in `libc`
error[E0425]: cannot find function `setgid` in crate `libc`
--> C:\Users\bowen\.cargo\registry\src\index.crates.io-6f17d22bba15001f\daemonize-0.5.0\src\lib.rs:501:21
|
501 | check_err(libc::setgid(group), ErrorKind::SetGroup)?;
| ^^^^^^ help: a function with a similar name exists: `getpid`
|
::: C:\Users\bowen\.cargo\registry\src\index.crates.io-6f17d22bba15001f\libc-0.2.140\src\windows\mod.rs:486:5
|
486 | pub fn getpid() -> ::c_int;
| -------------------------- similarly named function `getpid` defined here
error[E0412]: cannot find type `uid_t` in crate `libc`
--> C:\Users\bowen\.cargo\registry\src\index.crates.io-6f17d22bba15001f\daemonize-0.5.0\src\lib.rs:505:48
|
505 | unsafe fn get_user(user: User) -> Result<libc::uid_t, ErrorKind> {
| ^^^^^ not found in `libc`
error[E0412]: cannot find type `uid_t` in crate `libc`
--> C:\Users\bowen\.cargo\registry\src\index.crates.io-6f17d22bba15001f\daemonize-0.5.0\src\lib.rs:518:32
|
518 | unsafe fn set_user(user: libc::uid_t) -> Result<(), ErrorKind> {
| ^^^^^ not found in `libc`
error[E0425]: cannot find function `setuid` in crate `libc`
--> C:\Users\bowen\.cargo\registry\src\index.crates.io-6f17d22bba15001f\daemonize-0.5.0\src\lib.rs:519:21
|
519 | check_err(libc::setuid(user), ErrorKind::SetUser)?;
| ^^^^^^ help: a function with a similar name exists: `getpid`
|
::: C:\Users\bowen\.cargo\registry\src\index.crates.io-6f17d22bba15001f\libc-0.2.140\src\windows\mod.rs:486:5
|
486 | pub fn getpid() -> ::c_int;
| -------------------------- similarly named function `getpid` defined here
error[E0425]: cannot find function `flock` in crate `libc`
--> C:\Users\bowen\.cargo\registry\src\index.crates.io-6f17d22bba15001f\daemonize-0.5.0\src\lib.rs:532:15
|
532 | libc::flock(fd, libc::LOCK_EX | libc::LOCK_NB),
| ^^^^^ not found in `libc`
error[E0425]: cannot find value `LOCK_EX` in crate `libc`
--> C:\Users\bowen\.cargo\registry\src\index.crates.io-6f17d22bba15001f\daemonize-0.5.0\src\lib.rs:532:31
|
532 | libc::flock(fd, libc::LOCK_EX | libc::LOCK_NB),
| ^^^^^^^ not found in `libc`
error[E0425]: cannot find value `LOCK_NB` in crate `libc`
--> C:\Users\bowen\.cargo\registry\src\index.crates.io-6f17d22bba15001f\daemonize-0.5.0\src\lib.rs:532:47
|
532 | libc::flock(fd, libc::LOCK_EX | libc::LOCK_NB),
| ^^^^^^^ not found in `libc`
error[E0412]: cannot find type `uid_t` in crate `libc`
--> C:\Users\bowen\.cargo\registry\src\index.crates.io-6f17d22bba15001f\daemonize-0.5.0\src\lib.rs:540:16
|
540 | uid: libc::uid_t,
| ^^^^^ not found in `libc`
error[E0412]: cannot find type `gid_t` in crate `libc`
--> C:\Users\bowen\.cargo\registry\src\index.crates.io-6f17d22bba15001f\daemonize-0.5.0\src\lib.rs:541:16
|
541 | gid: libc::gid_t,
| ^^^^^ not found in `libc`
error[E0425]: cannot find function `chown` in crate `libc`
--> C:\Users\bowen\.cargo\registry\src\index.crates.io-6f17d22bba15001f\daemonize-0.5.0\src\lib.rs:545:15
|
545 | libc::chown(path_c.as_ptr(), uid, gid),
| ^^^^^ not found in `libc`
error[E0425]: cannot find function `ftruncate` in crate `libc`
--> C:\Users\bowen\.cargo\registry\src\index.crates.io-6f17d22bba15001f\daemonize-0.5.0\src\lib.rs:556:21
|
556 | check_err(libc::ftruncate(fd, 0), ErrorKind::TruncatePidfile)?;
| ^^^^^^^^^ help: a function with a similar name exists: `strncat`
|
::: C:\Users\bowen\.cargo\registry\src\index.crates.io-6f17d22bba15001f\libc-0.2.140\src\windows\mod.rs:356:5
|
356 | pub fn strncat(s: *mut c_char, ct: *const c_char, n: size_t) -> *mut c_ch...
| --------------------------------------------------------------------------- similarly named function `strncat` defined here
error[E0425]: cannot find function `fcntl` in crate `libc`
--> C:\Users\bowen\.cargo\registry\src\index.crates.io-6f17d22bba15001f\daemonize-0.5.0\src\lib.rs:572:37
|
572 | ... let flags = check_err(libc::fcntl(fd, libc::F_GETFD), ErrorKind:...
| ^^^^^ not found in `libc`
error[E0425]: cannot find value `F_GETFD` in crate `libc`
--> C:\Users\bowen\.cargo\registry\src\index.crates.io-6f17d22bba15001f\daemonize-0.5.0\src\lib.rs:572:53
|
572 | ...bc::fcntl(fd, libc::F_GETFD), ErrorKind::GetPidfileFlags)?;
| ^^^^^^^ not found in `libc`
error[E0425]: cannot find function `fcntl` in crate `libc`
--> C:\Users\bowen\.cargo\registry\src\index.crates.io-6f17d22bba15001f\daemonize-0.5.0\src\lib.rs:575:19
|
575 | libc::fcntl(fd, libc::F_SETFD, flags | libc::FD_CLOEXEC),
| ^^^^^ not found in `libc`
error[E0425]: cannot find value `F_SETFD` in crate `libc`
--> C:\Users\bowen\.cargo\registry\src\index.crates.io-6f17d22bba15001f\daemonize-0.5.0\src\lib.rs:575:35
|
575 | libc::fcntl(fd, libc::F_SETFD, flags | libc::FD_CLOEXEC),
| ^^^^^^^ not found in `libc`
error[E0425]: cannot find value `FD_CLOEXEC` in crate `libc`
--> C:\Users\bowen\.cargo\registry\src\index.crates.io-6f17d22bba15001f\daemonize-0.5.0\src\lib.rs:575:58
|
575 | libc::fcntl(fd, libc::F_SETFD, flags | libc::FD_CLOEXEC),
| ^^^^^^^^^^ not found in `libc`
error[E0425]: cannot find function `ioctl` in crate `libc`
--> C:\Users\bowen\.cargo\registry\src\index.crates.io-6f17d22bba15001f\daemonize-0.5.0\src\lib.rs:579:25
|
579 | ... check_err(libc::ioctl(fd, libc::FIOCLEX), ErrorKind::SetPidfileF...
| ^^^^^ not found in `libc`
error[E0425]: cannot find value `FIOCLEX` in crate `libc`
--> C:\Users\bowen\.cargo\registry\src\index.crates.io-6f17d22bba15001f\daemonize-0.5.0\src\lib.rs:579:41
|
579 | ... check_err(libc::ioctl(fd, libc::FIOCLEX), ErrorKind::SetPidfileF...
| ^^^^^^^ not found in `libc`
error[E0425]: cannot find function `chroot` in crate `libc`
--> C:\Users\bowen\.cargo\registry\src\index.crates.io-6f17d22bba15001f\daemonize-0.5.0\src\lib.rs:586:21
|
586 | check_err(libc::chroot(path_c.as_ptr()), ErrorKind::Chroot)?;
| ^^^^^^ not found in `libc`
error[E0412]: cannot find type `gid_t` in crate `libc`
--> C:\Users\bowen\.cargo\registry\src\index.crates.io-6f17d22bba15001f\daemonize-0.5.0\src\lib.rs:590:59
|
590 | unsafe fn get_gid_by_name(name: &CString) -> Option<libc::gid_t> {
| ^^^^^ not found in `libc`
error[E0425]: cannot find function `getgrnam` in crate `libc`
--> C:\Users\bowen\.cargo\registry\src\index.crates.io-6f17d22bba15001f\daemonize-0.5.0\src\lib.rs:591:21
|
591 | let ptr = libc::getgrnam(name.as_ptr() as *const libc::c_char);
| ^^^^^^^^ not found in `libc`
error[E0412]: cannot find type `uid_t` in crate `libc`
--> C:\Users\bowen\.cargo\registry\src\index.crates.io-6f17d22bba15001f\daemonize-0.5.0\src\lib.rs:600:59
|
600 | unsafe fn get_uid_by_name(name: &CString) -> Option<libc::uid_t> {
| ^^^^^ not found in `libc`
error[E0425]: cannot find function `getpwnam` in crate `libc`
--> C:\Users\bowen\.cargo\registry\src\index.crates.io-6f17d22bba15001f\daemonize-0.5.0\src\lib.rs:601:21
|
601 | let ptr = libc::getpwnam(name.as_ptr() as *const libc::c_char);
| ^^^^^^^^ not found in `libc`
error[E0599]: no method named `as_raw_fd` found for struct `File` in the current scope
--> C:\Users\bowen\.cargo\registry\src\index.crates.io-6f17d22bba15001f\daemonize-0.5.0\src\lib.rs:470:35
|
470 | let raw_fd = file.as_raw_fd();
| ^^^^^^^^^ method not found in `File`
error[E0308]: mismatched types
--> C:\Users\bowen\.cargo\registry\src\index.crates.io-6f17d22bba15001f\daemonize-0.5.0\src\lib.rs:559:64
|
559 | ... libc::write(fd, pid_c.as_ptr() as *const libc::c_void, pid_length),
| ----------- arguments to this function are incorrect ^^^^^^^^^^ expected `u32`, found `usize`
|
note: function defined here
--> C:\Users\bowen\.cargo\registry\src\index.crates.io-6f17d22bba15001f\libc-0.2.140\src\windows\mod.rs:502:12
|
502 | pub fn write(fd: ::c_int, buf: *const ::c_void, count: ::c_uint) -...
| ^^^^^
help: you can convert a `usize` to a `u32` and panic if the converted value doesn't fit
|
559 | libc::write(fd, pid_c.as_ptr() as *const libc::c_void, pid_length.try_into().unwrap()),
| ++++++++++++++++++++
error[E0308]: mismatched types
--> C:\Users\bowen\.cargo\registry\src\index.crates.io-6f17d22bba15001f\daemonize-0.5.0\src\lib.rs:563:18
|
563 | if written < pid_length as isize {
| ------- ^^^^^^^^^^^^^^^^^^^ expected `i32`, found `isize`
| |
| expected because this is `i32`
|
help: you can convert an `isize` to an `i32` and panic if the converted value doesn't fit
|
563 | if written < (pid_length as isize).try_into().unwrap() {
| + +++++++++++++++++++++
error[E0599]: no method named `into_vec` found for struct `OsString` in the current scope
--> C:\Users\bowen\.cargo\registry\src\index.crates.io-6f17d22bba15001f\daemonize-0.5.0\src\lib.rs:611:40
|
611 | ...o_os_string().into_vec()).map_err(|_| ErrorKind::PathContainsNul)
| ^^^^^^^^ method not found in `OsString`
Some errors have detailed explanations: E0308, E0412, E0425, E0433, E0599.
For more information about an error, try `rustc --explain E0308`.
error: could not compile `daemonize` (lib) due to 50 previous errors
warning: build failed, waiting for other jobs to finish... |
That is odd, daemonize shouldn't be getting pulled in at all when building on Windows. I've been testing on Windows 10, but can set up a Windows 11 VM on Monday to build in. For now, you can try doing |
@CrispyBaccoon sorry it took a few extra days, my Windows 11 VM kept freezing every time I tried to use it so I had to make one on a different computer. I was able to get a successful build with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for taking soo long to review this PR, I had a review sitting around for some time and forgot to finish it. :/
Thanks for the work anyway, other than the comments, this looks quite good to me.
No worries! I'll try and get to both comments tonight or tomorrow. |
…ndows Signed-off-by: Bailey Kasin <[email protected]>
Pushing a rebase to resolve the merge conflict + moving the log file. Starting to fall asleep at my computer, so I'll come back to this in the afternoon. |
Signed-off-by: Bailey Kasin <[email protected]>
Signed-off-by: Bailey Kasin <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
Initial work by JCapucho in #602.
This PR rebases their work onto the latest commit in master. The
librespot
--with-tremor
errors people were running into in some comments in the initial PR seem to be fixed. Config file handling should probably be updated, I'll look at it some tomorrow the next time I boot into Windows.I built with:
cargo build --release --no-default-features --features rodio_backend