liuchengxu / vim-clap

:clap: Modern performant fuzzy picker, tree-sitter highlighting, and more, for both Vim and NeoVim
https://liuchengxu.github.io/vim-clap/
MIT License
2.11k stars 87 forks source link

Failed to compile maple on arch linux #811

Closed sainnhe closed 2 years ago

sainnhe commented 2 years ago

Environment (please complete the following information):

Describe the bug

I can't build maple binary on Arch Linux, it said:

❯ cargo build --release
   Compiling filter v0.1.0 (/home/sainnhe/.local/share/nvim/plugins/vim-clap/crates/filter)
   Compiling maple v0.1.33 (/home/sainnhe/.local/share/nvim/plugins/vim-clap)
error: failed to run custom build command for `maple v0.1.33 (/home/sainnhe/.local/share/nvim/plugins/vim-clap)`

Caused by:
  process didn't exit successfully: `/home/sainnhe/.local/share/nvim/plugins/vim-clap/target/release/build/maple-86eb3fb85c08cd5c/build-script-build` (exit status: 127)
  --- stderr
  /home/sainnhe/.local/share/nvim/plugins/vim-clap/target/release/build/maple-86eb3fb85c08cd5c/build-script-build: error while loading shared libraries: libgit2.so.1.3: cannot open shared object file: No such file or directory
warning: build failed, waiting for other jobs to finish...
error: build failed

On arch linux, libgit2 is 1.4.0

❯ ls /usr/lib | grep libgit2
libgit2.so
libgit2.so.1.4
libgit2.so.1.4.0

Clap debug

            has cargo: 1
            has maple: /home/sainnhe/.local/share/nvim/plugins/vim-clap/target/release/maple
           maple info: version 0.1.33, built for x86_64-unknown-linux-gnu by rustc 1.61.0-nightly (532d3cda9 2022-02-23).
         has +python3: 0
has py dynamic module: ERROR: Vim(python):E319: No "python3" provider found. Run ":checkhealth provider"
            has ctags: ctags not found
        rustc version: rustc 1.61.0-nightly (532d3cda9 2022-02-23)
    Current sync impl: Lua
     Current FileType: startify
Third Party Providers: []
       Global Options:
    let g:clap#autoload_dir = '/home/sainnhe/.local/share/nvim/plugins/vim-clap/autoload'
    let g:clap#provider_alias = {'gfiles': 'git_files', 'hist:': 'command_history', 'hist/': 'search_history'}
    let g:clap_background_shadow_blend = 50
    let g:clap_cache_directory = '/home/sainnhe/.cache/nvim/clap'
    let g:clap_disable_bottom_top = 0
    let g:clap_disable_matches_indicator = v:false
    let g:clap_disable_optional_async = v:false
    let g:clap_disable_run_rooter = v:false
    let g:clap_enable_background_shadow = v:true
    let g:clap_enable_debug = v:false
    let g:clap_enable_icon = 1
    let g:clap_forerunner_status_sign = {'done': '•', 'running': '!', 'using_cache': '*'}
    let g:clap_insert_mode_only = v:false
    let g:clap_layout = {'relative': 'editor'}
    let g:clap_multi_selection_warning_silent = 0
    let g:clap_no_matches_msg = 'NO MATCHES FOUND'
    let g:clap_open_action = {'ctrl-v': 'vsplit', 'ctrl-x': 'split', 'ctrl-t': 'tab split'}
    let g:clap_open_preview = 'always'
    let g:clap_popup_border = 'single'
    let g:clap_preview_direction = 'AUTO'
    let g:clap_preview_size = 5
    let g:clap_providers_relaunch_code = '@@'
    let g:clap_search_box_border_style = 'nil'
    let g:clap_search_box_border_symbols = {'nil': ['', ''], 'curve': ['', ''], 'arrow': ['', '']}
  Provider Variables:
    let g:clap_provider_color_schemes = {'source': function('<SNR>48_clap_provider_color_schemes_source'), 'sink': function('<SNR>48_clap_provider_color_schemes_sin
k')}
    let g:clap_provider_grep_opts = '-H --no-heading --vimgrep --smart-case --hidden --no-ignore -g "!.git/"'

To Reproduce Steps to reproduce the behavior:

  1. Clone this repo and cd to the directory
  2. Run cargo build --release
  3. See error

Expected behavior

Compile successfully.

Screenshots If applicable, add screenshots to help explain your problem.

Additional context Add any other context about the problem here.

liuchengxu commented 2 years ago

So you have compiled the Rust binary successfully before and somehow now it failed to compile? I don't use arch, https://github.com/ogham/exa/issues/985 and https://github.com/dandavison/delta/issues/732 might be helpful.

If you really can't fix it on your side, you can work around it by disabling the libgit2 dep:

diff --git a/Cargo.toml b/Cargo.toml
index f432545b..81d0bf05 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -17,7 +17,7 @@ tokio = { version = "1.17", features = ["rt"] }
 maple_cli = { path = "crates/maple_cli" }

 [build-dependencies]
-built = { package = "built", version = "0.5", features = ["git2"] }
+built = { package = "built", version = "0.5" }
diff --git a/src/main.rs b/src/main.rs
index ddcc76ea..4947a401 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -6,9 +6,8 @@ pub mod built_info {

 fn version() {
     println!(
-        "version {}{}, built for {} by {}.",
+        "version {}, built for {} by {}.",
         built_info::PKG_VERSION,
-        built_info::GIT_VERSION.map_or_else(|| "".to_owned(), |v| format!(" (git {})", v)),
         built_info::TARGET,
         built_info::RUSTC_VERSION
     );
@@ -21,11 +20,7 @@ async fn main() -> Result<()> {
     match maple.command {
         Cmd::Version => version(),
         Cmd::Upgrade(upgrade) => {
-            let local_git_tag = built_info::GIT_VERSION.context("Failed to get GIT_VERSION")?;
-            if let Err(e) = upgrade.run(local_git_tag).await {
-                eprintln!("failed to upgrade: {:?}", e);
-                std::process::exit(1);
-            }
+            unimplemented!("Upgrade unsupported");
         }
         _ => {
             if let Err(e) = maple.run().await {

Only the version and upgrade command will be affected, which should be fine for the daily use.

sainnhe commented 2 years ago

Thanks for your information!

I managed to compile the binary by cleaning build cache. The old cache seems to be linked to libgit2.so.1.3