[GH-ISSUE #932] [BUG] Error building on Windows #341

Closed
opened 2026-02-27 08:16:45 +03:00 by kerem · 1 comment
Owner

Originally created by @EvanAnderson on GitHub (Jul 15, 2024).
Original GitHub issue: https://github.com/lldap/lldap/issues/932

Describe the bug
Doing a cargo build on Windows 10 x64 running Rust 1.79 x86_64-pc-windows-msvc returns an error:

   Compiling lldap v0.5.1-alpha (C:\Users\EAnderson\Downloads\lldap\lldap-main\server)
error[E0433]: failed to resolve: could not find `unix` in `os`
   --> server\src\infra\configuration.rs:239:22
    |
239 |         use std::os::unix::fs::PermissionsExt;
    |                      ^^^^ could not find `unix` in `os`
    |
note: found an item that was configured out
   --> /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081\library\std\src\os\mod.rs:26:9
note: found an item that was configured out
   --> /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081\library\std\src\os\mod.rs:64:9

error[E0599]: no method named `set_mode` found for struct `Permissions` in the current scope
   --> server\src\infra\configuration.rs:240:21
    |
240 |         permissions.set_mode(0o400);
    |                     ^^^^^^^^ method not found in `Permissions`

Some errors have detailed explanations: E0433, E0599.
For more information about an error, try `rustc --explain E0433`.
error: could not compile `lldap` (bin "lldap") due to 2 previous errors

To Reproduce
Execute cargo build on Windows

Expected behavior
The build to succeed.

Workaround
Commented-out lines 239 - 242 of configration.rs.

Originally created by @EvanAnderson on GitHub (Jul 15, 2024). Original GitHub issue: https://github.com/lldap/lldap/issues/932 **Describe the bug** Doing a `cargo build` on Windows 10 x64 running Rust 1.79 x86_64-pc-windows-msvc returns an error: ``` Compiling lldap v0.5.1-alpha (C:\Users\EAnderson\Downloads\lldap\lldap-main\server) error[E0433]: failed to resolve: could not find `unix` in `os` --> server\src\infra\configuration.rs:239:22 | 239 | use std::os::unix::fs::PermissionsExt; | ^^^^ could not find `unix` in `os` | note: found an item that was configured out --> /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081\library\std\src\os\mod.rs:26:9 note: found an item that was configured out --> /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081\library\std\src\os\mod.rs:64:9 error[E0599]: no method named `set_mode` found for struct `Permissions` in the current scope --> server\src\infra\configuration.rs:240:21 | 240 | permissions.set_mode(0o400); | ^^^^^^^^ method not found in `Permissions` Some errors have detailed explanations: E0433, E0599. For more information about an error, try `rustc --explain E0433`. error: could not compile `lldap` (bin "lldap") due to 2 previous errors ``` **To Reproduce** Execute `cargo build` on Windows **Expected behavior** The build to succeed. **Workaround** Commented-out lines 239 - 242 of configration.rs.
kerem 2026-02-27 08:16:45 +03:00
Author
Owner

@nitnelave commented on GitHub (Jul 17, 2024):

Well met from HN ;)
Ah, I thought that if cfg! would do the right thing, but no, we need a conditional compilation, something like

#[cfg(unix)]
{
  ...
}

Do you think you can make a PR for that?

<!-- gh-comment-id:2234213206 --> @nitnelave commented on GitHub (Jul 17, 2024): Well met from HN ;) Ah, I thought that `if cfg!` would do the right thing, but no, we need a conditional compilation, something like ```rust #[cfg(unix)] { ... } ``` Do you think you can make a PR for that?
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/lldap-lldap#341
No description provided.