lsd-rs / lsd

The next gen ls command
Apache License 2.0
13.16k stars 429 forks source link

[Bug]: Fails to build on NetBSD #881

Closed 0323pin closed 5 months ago

0323pin commented 1 year ago

Version

version

lsd v1.0.0 fails to build on NetBSD using Rust-1.71.1

What OS are you seeing the problem on?

Others

installation

Package maintainer building from source.

term

alacritty

ls-colors

Not relevant.

What happened?

The problem is a conflicting dependency version. lsd-1.0.0 depends on git2-0.16.1 which in turn pulls-in libgit2-sys-0.14.2+1.5.1
These are rather old versions, NetBSD defaults to libgit2-1.6.4 as the native version and linking fails due to mismatched versions.

What expected?

The package builds from source.

What else?

Solution: update crate dependencies, git2 to 0.17.2 and consequently libgit2-sys to 0.15.2+1.6.4
0323pin commented 1 year ago

Applying the following patch,

$NetBSD$

Avoid libgit2 version mismatch.

--- Cargo.toml.orig 2023-08-25 16:44:13.000000000 +0000
+++ Cargo.toml
@@ -45,7 +45,7 @@ vsort = "0.1.0"

 [target."cfg(not(all(windows, target_arch = \"x86\", target_env = \"gnu\")))".dependencies]
 # if ssl feature is enabled compilation will fail on arm-unknown-linux-gnueabihf and i686-pc-windows-gnu
-git2 = { version = "0.16", optional = true, default-features = false }
+git2 = { version = "0.17", optional = true, default-features = false }

 [target.'cfg(unix)'.dependencies]
 users = "0.11.*"

and re-generating Cargo.lock fixes the build.

I've applied this internally and merged the update into the main pkgsrc branch. Please consider this for your next release.

Btw, there's an inconsistency in Cargo.toml. The file states, git2 = { version = "0.16", optional = true, default-features = false } but further down it has the following,

[features]
default = ["git2"]
sudo = []
no-git = [] # force disabling git even if available by default

So, is git2 a default feature or, not?

0323pin commented 5 months ago

fixed on latest release.