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

uucore doesn't build on NetBSD #5288

Closed
tertsdiepraam opened this issue Sep 20, 2023 · 8 comments · Fixed by #5289
Closed

uucore doesn't build on NetBSD #5288

tertsdiepraam opened this issue Sep 20, 2023 · 8 comments · Fixed by #5289

Comments

@tertsdiepraam
Copy link
Member

tertsdiepraam commented Sep 20, 2023

See the full report at: nushell/nushell#10435

   Compiling uucore v0.0.21
error[E0308]: mismatched types
   --> /usr/pkgsrc/wip/nushell/work/vendor/uucore-0.0.21/src/lib/features/fs.rs:121:16
    |
111 |     pub fn number_of_links(&self) -> u64 {
    |                                      --- expected `u64` because of return type
...
121 |         return self.0.st_nlink;
    |                ^^^^^^^^^^^^^^^ expected `u64`, found `u32`
    |
help: you can convert a `u32` to a `u64`
    |
121 |         return self.0.st_nlink.into();
    |                               +++++++

For more information about this error, try `rustc --explain E0308`.
error: could not compile `uucore` (lib) due to previous error
warning: build failed, waiting for other jobs to finish...
*** Error code 101
@0323pin
Copy link
Contributor

0323pin commented Sep 20, 2023

Can confirm that the following patch fixes the nu build:

$NetBSD$

Add support for NetBSD.

--- ../vendor/uucore-0.0.21/src/lib/features/fs.rs.orig	2006-07-24 01:21:28.000000000 +0000
+++ ../vendor/uucore-0.0.21/src/lib/features/fs.rs
@@ -114,6 +114,7 @@ impl FileInformation {
             not(target_vendor = "apple"),
             not(target_os = "android"),
             not(target_os = "freebsd"),
+            not(target_os = "netbsd"),
             not(target_arch = "aarch64"),
             not(target_arch = "riscv64"),
             target_pointer_width = "64"
@@ -125,6 +126,7 @@ impl FileInformation {
                 target_vendor = "apple",
                 target_os = "android",
                 target_os = "freebsd",
+                target_os = "netbsd",
                 target_arch = "aarch64",
                 target_arch = "riscv64",
                 not(target_pointer_width = "64")
@@ -137,9 +139,9 @@ impl FileInformation {
 
     #[cfg(unix)]
     pub fn inode(&self) -> u64 {
-        #[cfg(all(not(target_os = "freebsd"), target_pointer_width = "64"))]
+        #[cfg(all(not(any(target_os = "freebsd", target_os = "netbsd")), target_pointer_width = "64"))]
         return self.0.st_ino;
-        #[cfg(any(target_os = "freebsd", not(target_pointer_width = "64")))]
+        #[cfg(any(target_os = "freebsd", target_os = "netbsd", not(target_pointer_width = "64")))]
         return self.0.st_ino.into();
     }
 }

I can do a PR if you want but, I'm afraid this pattern is likely to be general across other uu utils 😟

@tertsdiepraam
Copy link
Member Author

A PR would be great. To helo catch the other cases, would you also be able to helo us set up a NetBSD CI? I'm personally in favor of making it an officially supported platform.

@0323pin
Copy link
Contributor

0323pin commented Sep 20, 2023

would you also be able to helo us set up a NetBSD CI?

Oh, I don't know how to do these things but, both NetBSD and OpenBSD have been added to cirrus-ci, https://cirrus-ci.com/build/6221284932583424

I'm personally in favor of making it an officially supported platform.

That would be great thanks!

grep -r "freebsd" coreutills/ gives quite a lot of information about where we could expect trouble 😉

@tertsdiepraam
Copy link
Member Author

For the CI, I was thinking about copying this https://github.com/uutils/coreutils/blob/main/.github/workflows/freebsd.yml and adapting it to NetBSD. It might just work, but if there is some stuff that needs to change in that workflow, we would need some help for the NetBSD-specific stuff and you seem like the perfect person to ask :)

@0323pin
Copy link
Contributor

0323pin commented Sep 20, 2023

we would need some help for the NetBSD-specific stuff and you seem like the perfect person to ask

That's fine. I'm happy to help.

Line 42: pkg install should be replaced by either pkg_add or pkgin. pkgin is to pkg_add what apt-get is to dpkg

I could have missed something but, just ask.

@0323pin
Copy link
Contributor

0323pin commented Sep 21, 2023

@tertsdiepraam Any chance of getting #5289 merged?

Edit: Oh, I see the checks have resumed now.

sylvestre pushed a commit that referenced this issue Sep 21, 2023
* Add NetBSD support to uucore.

Fixes #5288
@sylvestre
Copy link
Contributor

done, sorry!

@0323pin
Copy link
Contributor

0323pin commented Sep 21, 2023

@sylvestre Thank you!

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

Successfully merging a pull request may close this issue.

3 participants