jedahan / zr

zsh plugin manager written in rust
Mozilla Public License 2.0
180 stars 12 forks source link

compilation is somewhat broken (libiconv and git2) #41

Open eirnym opened 10 months ago

eirnym commented 10 months ago

My environment:

I've downloaded the repository and tried to build. I have following output

  = note: Undefined symbols for architecture arm64:
            "_iconv", referenced from:
                _git_fs_path_iconv in liblibgit2_sys-3bac40090542004f.rlib(fs_path.o)
               (maybe you meant: _git_fs_path_iconv_clear, _git_fs_path_iconv_init_precompose , _git_fs_path_iconv )
            "_iconv_close", referenced from:
                _git_fs_path_iconv_clear in liblibgit2_sys-3bac40090542004f.rlib(fs_path.o)
            "_iconv_open", referenced from:
                _git_fs_path_iconv_init_precompose in liblibgit2_sys-3bac40090542004f.rlib(fs_path.o)
          ld: symbol(s) not found for architecture arm64
          clang: error: linker command failed with exit code 1 (use -v to see invocation)

After upgrading all dependencies as below (I've changed only version numbers to the latest) it compiles successfully without any prompts.

[dependencies]
git2 = "0.18.1"
directories = "5.0.1"
url = "2.5.0"
git2_credentials = "0.13.0"

The compiled version works fine except it unable to fetch repositories.jedahan/zr selected as an example repo

$ RUST_BACKTRACE=full ./zr jedahan/zr
cloning https://github.com/jedahan/zr into "/Users/eirnym/Library/Caches/zr/jedahan/zr"
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Error { code: -16, klass: 23, message: "authentication required but no callback set" }', src/plugin.rs:22:60
stack backtrace:
   0:        0x100b7d344 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hb005c7b0db18e81c
   1:        0x100b8a3c4 - core::fmt::write::hd5dc98bbb37df0ea
   2:        0x100b5d180 - std::io::Write::write_fmt::h042e9f2909d3f218
   3:        0x100b7d198 - std::sys_common::backtrace::print::h6f40cdd50ebad80c
   4:        0x100b5d9b4 - std::panicking::default_hook::{{closure}}::hf87eed59167f92bd
   5:        0x100b5d7a0 - std::panicking::default_hook::h8fd4653aa15f3663
   6:        0x100b5def0 - std::panicking::rust_panic_with_hook::h35d52c7b2c1a812e
   7:        0x100b7d5fc - std::panicking::begin_panic_handler::{{closure}}::h0b6f57be552c83ee
   8:        0x100b7d414 - std::sys_common::backtrace::__rust_end_short_backtrace::hccd979d3efaf26cb
   9:        0x100b5db50 - _rust_begin_unwind
  10:        0x100b978b0 - core::panicking::panic_fmt::h8c741ce671c330d0
  11:        0x100b97680 - core::result::unwrap_failed::h4840784c52597da0
  12:        0x10096a558 - core::result::Result<T,E>::unwrap::hefb636d91bdc29a0
                               at /opt/local/libexec/rust/src/rustc-1.71.1-src/library/core/src/result.rs:1076:23
  13:        0x100952dc0 - zr::plugin::Plugin::clone_if_empty::he830949ac662143c
                               at /Users/eirnym/Developer/random/zsh_plugin_manager_speed/zr/src/plugin.rs:22:13
  14:        0x100952f14 - zr::plugin::Plugin::new::h431893b1b5604a19
                               at /Users/eirnym/Developer/random/zsh_plugin_manager_speed/zr/src/plugin.rs:42:9
  15:        0x10095b288 - zr::plugins::Plugins::new::h94d5b0f5ad392633
                               at /Users/eirnym/Developer/random/zsh_plugin_manager_speed/zr/src/plugins.rs:68:33
  16:        0x100963894 - zr::load::h2352131748569891
                               at /Users/eirnym/Developer/random/zsh_plugin_manager_speed/zr/src/main.rs:59:12
  17:        0x10096315c - zr::main::hd3cec197118ac393
                               at /Users/eirnym/Developer/random/zsh_plugin_manager_speed/zr/src/main.rs:31:27
  18:        0x10095bd48 - core::ops::function::FnOnce::call_once::ha77fa836e0a309b8
                               at /opt/local/libexec/rust/src/rustc-1.71.1-src/library/core/src/ops/function.rs:250:5
  19:        0x10096207c - std::sys_common::backtrace::__rust_begin_short_backtrace::h56e8e90aef06863f
                               at /opt/local/libexec/rust/src/rustc-1.71.1-src/library/std/src/sys_common/backtrace.rs:135:18
  20:        0x100959afc - std::rt::lang_start::{{closure}}::h59b60254073d6017
                               at /opt/local/libexec/rust/src/rustc-1.71.1-src/library/std/src/rt.rs:166:18
  21:        0x100b5da40 - std::panicking::try::hd60736db1a330482
  22:        0x100b79d98 - std::rt::lang_start_internal::he3aa91ba7dc1ac47
  23:        0x100959ac8 - std::rt::lang_start::hc2e5e0ff45c64b8a
                               at /opt/local/libexec/rust/src/rustc-1.71.1-src/library/std/src/rt.rs:165:17
  24:        0x100963b90 - _main

My git config contains following lines and works perfectly with other commands.

[url "ssh://git@github.com/"]
    insteadOf = https://github.com/
jedahan commented 10 months ago

I split the second issue out from here

jedahan commented 10 months ago

Thanks for the bugreport - there are a lot of variables that unfortunately make it hard for me to reproduce this error.

OS: I only have access to a macOS 14 install (Sonoma), not macOS 12. Is there a way you know to test/virtualize this?

toolchain: I was able to install rustc 1.71.1 with rustup install 1.71.1, but that also uses cargo 1.71.1, not 1.71.2 (hope this is not a big issue). Was not able to reproduce the build error. What architecture are you running on? Can you post the output of rustup show?

I'm surprised updating directories or url let you build. Can you still build if you revert those to the old versions? Just want to make sure we are looking at the exact dependency thats causing the error.

eirnym commented 10 months ago

I recommend to set up GitHub CI with automatic building and testing different scenarios for each PR. I prefer to use renovate bot over dependabot, but I'd live your preference to you.

eirnym commented 10 months ago

I've installed rust and cargo using MacPorts. I don't use rustup.

My guess that exact OS version might have no difference, rather where a library has been set up to search for an alternative dependencies.

eirnym commented 10 months ago

Old version of the git2 dependency haven't looked in $PATH-based as it should and some users might never encounter it as they use Homebrew on x86 or install using a package manager.