SuperBo / fugit2.nvim

Neovim git GUI powered by libgit2
MIT License
386 stars 8 forks source link

bug: Unable to install #46

Closed ptn closed 5 months ago

ptn commented 5 months ago

Did you check docs and existing issues?

Neovim version (nvim -v)

NVIM v0.10.0-dev-2960+g52d2851ca-Homebrew

Operating system/version

Sonoma 14.4.1

Describe the bug

After installing and triggering my keymap, I get the following error:


Failed to source `/Users/yoyoyo/.local/share/nvim/lazy/fugit2.nvim/plugin/fugit2.lua`

vim/_editor.lua:0: nvim_exec2()../Users/yoyoyo/.local/share/nvim/lazy/fugit2.nvim/plugin/fugit2.lua: Vim(source):E5113: Error while calling lua chunk: ...local/share/nvim/lazy/fugit2.nvim/lua/fugit2/libgit2.lua:571: dlopen(libgit2.dylib, 0x0005): tried: 'libgit2.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OSlibgit2.dylib' (no such file), '/usr/lib/libgit2.dylib' (no such file, not in dyld cache), 'libgit2.dylib' (no such file)
stack traceback:
    [C]: in function 'load'
    ...local/share/nvim/lazy/fugit2.nvim/lua/fugit2/libgit2.lua:571: in main chunk
    [C]: in function 'require'
    ...s/.local/share/nvim/lazy/fugit2.nvim/lua/fugit2/git2.lua:2: in main chunk
    [C]: in function 'require'
    ...s/.local/share/nvim/lazy/fugit2.nvim/lua/fugit2/init.lua:3: in main chunk
    [C]: in function 'require'
    ...res/.local/share/nvim/lazy/fugit2.nvim/plugin/fugit2.lua:1: in main chunk
    [C]: in function 'nvim_exec2'
    vim/_editor.lua: in function 'cmd'
    ...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:485: in function <...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:484>
    [C]: in function 'xpcall'
    .../.local/share/nvim/lazy/lazy.nvim/lua/lazy/core/util.lua:113: in function 'try'
    ...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:484: in function 'source'
    ...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:443: in function 'source_runtime'
    ...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:411: in function 'packadd'
    ...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:346: in function '_load'
    ...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:191: in function 'load'
    ...share/nvim/lazy/lazy.nvim/lua/lazy/core/handler/keys.lua:122: in function <...share/nvim/lazy/lazy.nvim/lua/lazy/core/handler/keys.lua:112>

# stacktrace:
  - vim/_editor.lua:0 _in_ **cmd**

Here's my config via lazy.vim:

  {
    "SuperBo/fugit2.nvim",
    -- enabled = false,
    opts = {
      width = 140,
    },
    config = true,
    dependencies = {
      "MunifTanjim/nui.nvim",
      "nvim-tree/nvim-web-devicons",
      "nvim-lua/plenary.nvim",
      -- {
      --   "chrisgrieser/nvim-tinygit", -- optional: for Github PR view
      --   dependencies = { "stevearc/dressing.nvim" },
      -- },
    },
    cmd = { "Fugit2", "Fugit2Graph" },
    keys = {
      { "<leader>gg", mode = "n", "<cmd>Fugit2<cr>" },
    },
  },
  {
    "sindrets/diffview.nvim",
    dependencies = { "nvim-tree/nvim-web-devicons" },
    cmd = {
      "DiffviewFileHistory",
      "DiffviewOpen",
      "DiffviewToggleFiles",
      "DiffviewFocusFiles",
      "DiffviewRefresh",
    },
  },

Libgit2 is indeed installed:

~ % brew install libgit2
Warning: libgit2 1.7.2 is already installed and up-to-date.
To reinstall 1.7.2, run:
  brew reinstall libgit2

Steps To Reproduce

  1. Libgit2 was already installed long ago.
  2. Add the above lazy.vim config.
  3. Open nvim so that lazy.vim auto installs the plugin
  4. Fire the chosen keymap

Expected Behavior

I expect the Fugit2 UI to appear, instead I get an error and the UI does not show.

ptn commented 5 months ago

I tried downgrading neovim to 0.9 and the error persists.

bdemirtas commented 5 months ago

Having the same issue.

SuperBo commented 5 months ago

Hi @ptn , @bdemirtas , could you guys provide me output of this command brew doctor.

This error happen because LD_LIBRARY_PATH isn't set up correctly. You should have this line in ~/.zprofile file eval "$(/opt/homebrew/bin/brew shellenv)"

bdemirtas commented 5 months ago

Hi @SuperBo thanks to answering quickly. In my case, I'm on Fedora and I have libgit2 installed. Here's a screenshot of what I'm getting.

Screenshot from 2024-05-06 23-53-56

ptn commented 5 months ago

Output of brew doctor, before doing that change to .zprofile:

~ % brew doctor
Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry or file an issue; just ignore this. Thanks!

Warning: A newer Command Line Tools release is available.
Update them from Software Update in System Settings.

If that doesn't show you any updates, run:
  sudo rm -rf /Library/Developer/CommandLineTools
  sudo xcode-select --install

Alternatively, manually download them from:
  https://developer.apple.com/download/all/.
You should download the Command Line Tools for Xcode 15.1.

Warning: Some installed formulae are deprecated or disabled.
You should find replacements for the following formulae:
  ilmbase
  openssl@1.1
  python@3.8

Warning: Unbrewed header files were found in /usr/local/include.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae and may need to be deleted.

Unexpected header files:
  /usr/local/include/python3.8/greenlet/greenlet.h

Warning: You have unlinked kegs in your Cellar.
Leaving kegs unlinked can lead to build-trouble and cause formulae that depend on
those kegs to fail to run properly once built. Run `brew link` on these:
  ctags
  node

Adding that line to .zprofile did not fix the issue, I am getting the same as the screenshot posted above.

SuperBo commented 5 months ago

@ptn , for you case, can you help me run these command then test whether Fugit2 works?

export LIBRARY_PATH="$LIBRARY_PATH:$(brew --prefix)/lib"
export LD_LIBRARY_PATH="$(brew --prefix)/lib${LD_LIBRARY_PATH:+:"${LD_LIBRARY_PATH}"}"
export DYLD_LIBRARY_PATH="$DYLD_LIBRARY_PATH:$(brew --prefix)/lib"
nvim
SuperBo commented 5 months ago

hi @ptn, please update to latest version then setting this to your config. Please make sure library file is on your system ls /opt/homebrew/lib/libgit2.dylib

  {
    "SuperBo/fugit2.nvim",
    opts = {
      libgit2_path = "/opt/homebrew/lib/libgit2.dylib",
      width = 140,
    },
    config = true,
    dependencies = {
      "MunifTanjim/nui.nvim",
      "nvim-tree/nvim-web-devicons",
      "nvim-lua/plenary.nvim",
    },
  }

and for @bdemirtas case with Fedora, I updated README section for Fedora, please test it to verify it works or not. https://github.com/SuperBo/fugit2.nvim#fedora

bdemirtas commented 5 months ago

You're fantastic, it's working. The path in fedora for libgit it's /usr/lib64/libgit2.so.1.7.2 in case you would like to add in the readme. Now I will be able to play with.

Thanks

SuperBo commented 5 months ago

@bdemirtas, based on testing env (fedora docker), just setting to "libgit2.so.1.7.2" or "libgit2.so.1.7" also works :D

ptn commented 4 months ago

It works! I had to use a different path though:

    opts = {
      libgit2_path = "/usr/local/opt/libgit2/lib/libgit2.dylib",
      width = 140,
    },
SuperBo commented 4 months ago

@ptn , thank you, I will add it to README