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

CMake deprecation error < 3.5 #120

Open
D3vil0p3r opened this issue Jan 28, 2024 · 5 comments
Open

CMake deprecation error < 3.5 #120

D3vil0p3r opened this issue Jan 28, 2024 · 5 comments

Comments

@D3vil0p3r
Copy link

D3vil0p3r commented Jan 28, 2024

I'm using NixOS with Neovim. Installing telescope-fzf-native.nvim by the following telescope.lua file:

local status_ok, telescope = pcall(require, "telescope")
if not status_ok then
  return
end

local actions = require "telescope.actions"

vim.api.nvim_set_keymap('v', '<C-g>', 'y<ESC>:Telescope live_grep default_text=<c-r>0<CR>',{ noremap = true, silent = true })

telescope.setup {
  pickers = {
    find_files = {
      previewer = false,
      hidden = true
    },
    colorscheme = {
      enable_preview = true,
    },
  },
  extensions_list = { "themes", "terms" },
  defaults = {
    prompt_prefix = "",
    selection_caret = "",
    path_display = { "smart" },
    file_ignore_patterns = { "node_modules" },
    mappings = {
      i = {
        ["<C-j>"] = actions.move_selection_next,
        ["<C-k>"] = actions.move_selection_previous,
        ["<C-c>"] = actions.close,
        ["<C-n>"] = actions.cycle_history_next,
        ["<C-p>"] = actions.cycle_history_prev,
        ["<C-q>"] = actions.send_to_qflist + actions.open_qflist,
        ["<CR>"] = actions.select_default,
      },
      n = {
        ["j"] = actions.move_selection_next,
        ["k"] = actions.move_selection_previous,
        ["<C-q>"] = actions.send_to_qflist + actions.open_qflist,
        ["<C-x>"] = actions.select_horizontal,
        ["<C-v>"] = actions.select_vertical,
      },
    },
  },
}

-- Enable telescope fzf native, if installed
pcall(telescope.load_extension, 'fzf')

and when I place telescope.lua among the plugins of Neovim, when I run nvim for the first time, at compilation time of this plugin I get

image

In plugins.lua it is dealt with:

  {
    'nvim-telescope/telescope-fzf-native.nvim',
    build =
    'cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build'
  },
  {
    "nvim-telescope/telescope.nvim",
    dependencies = {
      'nvim-telescope/telescope-fzf-native.nvim', -- file icons on nvim-tree
    },
  },

Why I get this deprecation error despite I'm using CMake 3.27? The problem is in CMakeLists.txt at:

cmake_minimum_required(VERSION 3.2)

?

@Conni2461
Copy link
Member

we could bump the minimum_required cmake version to idk 3.9

@D3vil0p3r
Copy link
Author

we could bump the minimum_required cmake version to idk 3.9

We can try to see if it fixes this issue.

@ditsuke
Copy link
Contributor

ditsuke commented Jul 1, 2024

The real issue is in the build command advertised by the plugin. The final install step fails at

file(INSTALL DESTINATION "/home/x/.local/share/nvim/lazy/telescope-fzf-native.nvim/build" TYPE SHARED_LIBRARY FILES "/home/x/.local/share/nvim/lazy/telescope-fzf-native.nvim/build/libfzf.so")

At first look this install step is entirely redundant. On second look its dangerous because it is undefined behavior which new versions of cmake seem to have affected. So PSA for people coming here:

-          cmake --build build --config Release && \
-          cmake --install build --prefix build",
+          cmake --build build --config Release",

Alternatively use build = 'make'

ditsuke added a commit to ditsuke/telescope-fzf-native.nvim that referenced this issue Jul 1, 2024
Recent versions of cmake seem to affect how redundant installation
directives are handled, i.e. install source and destination are the
same. While previously they went through as a noop, they now seem
to fail as reproduced in nvim-telescope#120.
Conni2461 pushed a commit that referenced this issue Jul 1, 2024
Recent versions of cmake seem to affect how redundant installation
directives are handled, i.e. install source and destination are the
same. While previously they went through as a noop, they now seem
to fail as reproduced in #120.
@copperthief
Copy link

I get the same issue, also on NixOS. I tried changing the build command in my lua config to both 'make' and 'cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release' and it did not seem to change anything; I still get the issue.

I did, however, find a workaround: just go to your shell and manually run make:

cd [nvim data dir]/lazy/telescope-fzf-native.nvim
make

@99linesofcode
Copy link

I ran into the same issue on Nix using LazyVim. Seems they check whether cmake is installed or fall back to make if it's not. Perhaps you could add a similar check and just build with make until this gets resolved.

https://github.com/LazyVim/LazyVim/blob/12818a6cb499456f4903c5d8e68af43753ebc869/lua/lazyvim/plugins/extras/editor/telescope.lua#L65-L67

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

No branches or pull requests

5 participants