NixOS / nix

Nix, the purely functional package manager
https://nixos.org/
GNU Lesser General Public License v2.1
12.14k stars 1.47k forks source link

nix v0.15.0 with rustc 1.63.0 on riscv64 target board #8583

Closed kush930 closed 1 year ago

kush930 commented 1 year ago

Hi all,

I am building firefox, during building time i am facing nix package issue.

Compiling nix v0.15.0
 1:52.61 error[E0432]: unresolved import `self::consts`
 1:52.62   --> /home/root/luvkhush/firefox/third_party/rust/nix/src/sys/ioctl/linux.rs:50:15
 1:52.62    |
 1:52.62 50 | pub use self::consts::*;
 1:52.63    |               ^^^^^^ could not find `consts` in `self`
 1:53.92 error[E0425]: cannot find value `SIZEBITS` in this scope
 1:53.92   --> /home/root/luvkhush/firefox/third_party/rust/nix/src/sys/ioctl/linux.rs:59:50
 1:53.93    |
 1:53.93 59 | pub const DIRSHIFT: ioctl_num_type = SIZESHIFT + SIZEBITS as ioctl_num_type;
 1:53.94    |                                                  ^^^^^^^^ not found in this scope
 1:53.97 error[E0425]: cannot find value `SIZEBITS` in this scope
 1:53.97   --> /home/root/luvkhush/firefox/third_party/rust/nix/src/sys/ioctl/linux.rs:66:44
 1:53.97    |
 1:53.98 66 | pub const SIZEMASK: ioctl_num_type = (1 << SIZEBITS) - 1;
 1:53.98    |                                            ^^^^^^^^ not found in this scope
 1:54.01 error[E0425]: cannot find value `DIRBITS` in this scope
 1:54.02   --> /home/root/luvkhush/firefox/third_party/rust/nix/src/sys/ioctl/linux.rs:68:43
 1:54.02    |
 1:54.02 13 | pub const NRBITS: ioctl_num_type = 8;
 1:54.03    | ------------------------------------- similarly named constant `NRBITS` defined here
 1:54.03 ...
 1:54.04 68 | pub const DIRMASK: ioctl_num_type = (1 << DIRBITS) - 1;
 1:54.04    |                                           ^^^^^^^ help: a constant with a similar name exists: `NRBITS`
 2:11.58 dom/console
 2:13.73 Some errors have detailed explanations: E0425, E0432.
 2:13.73 For more information about an error, try `rustc --explain E0425`.
 2:13.81 error: could not compile `nix` due to 4 previous errors

Can anyone help me in this, I want to build nix v0.15.0 on riscv64 platform.

T&R luvkhush

SuperSandro2000 commented 1 year ago

@fricklerhandwerk I think this should be moved to nixpkgs

cole-h commented 1 year ago

This seems like an issue with the nix Rust crate (https://crates.io/crates/nix) and not the Nix package manager. Please file your issue with them instead.

kush930 commented 1 year ago

Hi all,

can anyone suggest me how to add local patches in cargo.

when i was looking inside source code,I found in one file linux.rs is not having riscv support, manually i added riscv in linux.rs but its failing.

now i want to apply patch in cargo, i have no any idea how to add patch in cargo.

i created patch by using diff -Naur a b > riscv.patch

riscv.patch-

--- a/linux.rs
+++ b/linux.rs
@@ -33,6 +33,8 @@
           target_arch = "arm",
           target_arch = "s390x",
           target_arch = "x86_64",
+          target_arch = "riscv32",
+          target_arch = "riscv64",
           target_arch = "aarch64"))]
 mod consts {
     #[doc(hidden)]

i added riscv line in linux.rs file.

// "Generic" ioctl protocol
#[cfg(any(
    target_arch = "x86",
    target_arch = "arm",
    target_arch = "s390x",
    target_arch = "x86_64",
    target_arch = "aarch64",
    target_arch = "riscv32",
    target_arch = "riscv64"
))]

with the help of Cargo.toml file we can apply patches, but i want to know how to add,.

Can anyone help me in this.

T&R luvkhush

cole-h commented 1 year ago

Once more, your issue appears to have nothing to do with the Nix package manager (this repo), and instead is a problem with the nix Rust crate, which provides Rust-y bindings to "various *nix system functions".

Please file your issue with them.