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

cargo install error on Alpine -- nix related? #573

Closed
moranbw opened this issue May 6, 2024 · 5 comments · Fixed by #596
Closed

cargo install error on Alpine -- nix related? #573

moranbw opened this issue May 6, 2024 · 5 comments · Fixed by #596
Labels
bug Something isn't working

Comments

@moranbw
Copy link

moranbw commented May 6, 2024

When running cargo install ironbar on my machine, I got this error:

   Compiling ironbar v0.15.1
error[E0432]: unresolved import `nix::fcntl::OFlag`
 --> /home/brian/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ironbar-0.15.1/src/clients/wayland/wlr_data_control/offer.rs:3:5
  |
3 | use nix::fcntl::OFlag;
  |     ^^^^^^^^^^^^^^^^^ no `OFlag` in `fcntl`

error[E0432]: unresolved import `nix::unistd::pipe2`
    --> /home/brian/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ironbar-0.15.1/src/clients/wayland/wlr_data_control/offer.rs:4:26
     |
4    | use nix::unistd::{close, pipe2};
     |                          ^^^^^
     |                          |
     |                          no `pipe2` in `unistd`
     |                          help: a similar name exists in the module: `pipe`
     |
note: found an item that was configured out
    --> /home/brian/.cargo/registry/src/index.crates.io-6f17d22bba15001f/nix-0.27.1/src/unistd.rs:1233:8
     |
1233 | pub fn pipe2(flags: OFlag) -> Result<(RawFd, RawFd)> {
     |        ^^^^^
     = note: the item is gated behind the `fs` feature

error[E0432]: unresolved imports `nix::fcntl::fcntl`, `nix::fcntl::F_GETPIPE_SZ`, `nix::fcntl::F_SETPIPE_SZ`
   --> /home/brian/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ironbar-0.15.1/src/clients/wayland/wlr_data_control/mod.rs:13:18
    |
13  | use nix::fcntl::{fcntl, F_GETPIPE_SZ, F_SETPIPE_SZ};
    |                  ^^^^^  ^^^^^^^^^^^^  ^^^^^^^^^^^^ no `F_SETPIPE_SZ` in `fcntl`
    |                  |      |
    |                  |      no `F_GETPIPE_SZ` in `fcntl`
    |                  no `fcntl` in `fcntl`
    |
    = help: consider importing this module instead:
            nix::fcntl
note: found an item that was configured out
   --> /home/brian/.cargo/registry/src/index.crates.io-6f17d22bba15001f/nix-0.27.1/src/fcntl.rs:509:8
    |
509 | pub fn fcntl(fd: RawFd, arg: FcntlArg) -> Result<c_int> {
    |        ^^^^^
    = note: the item is gated behind the `fs` feature

For more information about this error, try `rustc --explain E0432`.
error: could not compile `ironbar` (bin "ironbar") due to 3 previous errors
error: failed to compile `ironbar v0.15.1`, intermediate artifacts can be found at `/tmp/cargo-installgmhXjZ`.
To reuse those artifacts with a future compilation, set the environment variable `CARGO_TARGET_DIR` to that path.

I then proceeded to clone the repo and build directly (cargo build --release), and it worked! I am using Alpine Linux, so not sure if there is some weirdness going on there. But just wanted to bring it to your attention. Looking forward to playing with the bar.

System information:

  • Distro: Alpine Linux Edge
  • Compositor: labwc
  • Ironbar version: 0.15.1
@moranbw moranbw added the bug Something isn't working label May 6, 2024
@JakeStanger
Copy link
Owner

Hey, the nix crate refers to *nix rather than Nix(OS). Under the hood it binds to the platform's libc library.

Am I right in thinking alpine uses musl rather than glibc? That might be the cause here, although I've no idea why it'd work installing it one way and not the other when it's compiling on your system either way.

@rgilton
Copy link

rgilton commented May 18, 2024

I see the same errors when trying to build on Fedora 40. Building with rust 1.78.0.

@JakeStanger
Copy link
Owner

Well I guess that rules out musl then. I've just tried in a Fedora docker container from blank and it built fine, so not sure what's going on there.

I'll have a poke around in the nix crate and see if I can see any reason that fs feature flag would get turned off.

@JakeStanger
Copy link
Owner

JakeStanger commented May 18, 2024

For some reason Rust is resolving a newer version of the nix crate than what was in the lockfile for you guys, which had breaking changes. I've updated to the latest version in the above PR which also fixes the breaking changes, so this should be resolved once that's merged.

@JimitSoni18
Copy link

still facing the issue when installing using cargo:
cargo install ironbar
error[E0432]: unresolved import nix::fcntl::OFlag
--> /home/jimit/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ironbar-0.15.1/src/clients/wayland/wlr_data_control/offer.rs:3:5
|
3 | use nix::fcntl::OFlag;
| ^^^^^^^^^^^^^^^^^ no OFlag in fcntl

error[E0432]: unresolved import nix::unistd::pipe2
--> /home/jimit/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ironbar-0.15.1/src/clients/wayland/wlr_data_control/offer.rs:4:26
|
4 | use nix::unistd::{close, pipe2};
| ^^^^^
| |
| no pipe2 in unistd
| help: a similar name exists in the module: pipe
|
note: found an item that was configured out
--> /home/jimit/.cargo/registry/src/index.crates.io-6f17d22bba15001f/nix-0.27.1/src/unistd.rs:1233:8
|
1233 | pub fn pipe2(flags: OFlag) -> Result<(RawFd, RawFd)> {
| ^^^^^
= note: the item is gated behind the fs feature

error[E0432]: unresolved imports nix::fcntl::fcntl, nix::fcntl::F_GETPIPE_SZ, nix::fcntl::F_SETPIPE_SZ
--> /home/jimit/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ironbar-0.15.1/src/clients/wayland/wlr_data_control/mod.rs:13:18
|
13 | use nix::fcntl::{fcntl, F_GETPIPE_SZ, F_SETPIPE_SZ};
| ^^^^^ ^^^^^^^^^^^^ ^^^^^^^^^^^^ no F_SETPIPE_SZ in fcntl
| | |
| | no F_GETPIPE_SZ in fcntl
| no fcntl in fcntl
|
= help: consider importing this module instead:
nix::fcntl
note: found an item that was configured out
--> /home/jimit/.cargo/registry/src/index.crates.io-6f17d22bba15001f/nix-0.27.1/src/fcntl.rs:509:8
|
509 | pub fn fcntl(fd: RawFd, arg: FcntlArg) -> Result<c_int> {
| ^^^^^
= note: the item is gated behind the fs feature

error[E0308]: mismatched types
--> /home/jimit/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ironbar-0.15.1/src/clients/compositor/hyprland.rs:156:51
|
156 | let name = get_workspace_name(workspace_type);
| ------------------ ^^^^^^^^^^^^^^ expected WorkspaceType, found WorkspaceDestroyedEventData
| |
| arguments to this function are incorrect
|
note: function defined here
--> /home/jimit/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ironbar-0.15.1/src/clients/compositor/hyprland.rs:247:4
|
247 | fn get_workspace_name(name: WorkspaceType) -> String {
| ^^^^^^^^^^^^^^^^^^ -------------------

Some errors have detailed explanations: E0308, E0432.
For more information about an error, try rustc --explain E0308.
error: could not compile ironbar (bin "ironbar") due to 4 previous errors
error: failed to compile ironbar v0.15.1, intermediate artifacts can be found at /tmp/cargo-installpCyxrB.
To reuse those artifacts with a future compilation, set the environment variable CARGO_TARGET_DIR to that path.

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

Successfully merging a pull request may close this issue.

4 participants