vim - 在 Fedora 23 上创建 vim 时如何修复此错误

标签 vim makefile fedora make-install

我正在尝试在我的 Fedora 23 上使用以下选项构建 vim

我想要一些插件的+python +python3 +perl +lua +ruby +gui +conceal +gui

我找不到包含所有内置功能的版本(所以我自己做)

旅程从关注Valloric开始

sudo yum install -y ruby ruby-devel lua lua-devel luajit \
    luajit-devel ctags git python python-devel \
    python3 python3-devel tcl-devel \
    perl perl-devel perl-ExtUtils-ParseXS \
    perl-ExtUtils-XSpp perl-ExtUtils-CBuilder \
    perl-ExtUtils-Embed

我还有ncurses(原始、开发、静态...)

然后

$ cd $HOME/Sources
$ git clone https://github.com/vim/vim.git
$ cd vim
$ ./configure --with-tlib=ncurses \
              --with-features=huge \
              --enable-fail-if-missing \
              --enable-luainterp=yes \
              --enable-mzschemeinterp \
              --enable-perlinterp \
              --enable-pythoninterp=yes \
              --with-python-config-dir=/usr/lib64/python2.7/config \
              --enable-python3interp=yes \
              --enable-tclinterp=yes \
              --enable-rubyinterp=yes \
              --enable-cscope \
              --enable-multibyte \
              --enable-gui=auto \
              --prefix=$HOME/Build/vim \
              --with-compiledby=statquant | tee configure.log

屏幕上打印以下内容:

/home/statquant/Sources/vim/src/config-PyMake3137:1478: warning: overriding recipe for target 'Modules/_math.o'
/home/statquant/Sources/vim/src/config-PyMake3137:1475: warning: ignoring old recipe for target 'Modules/_math.o'
/home/statquant/Sources/vim/src/config-PyMake3137:1517: warning: overriding recipe for target 'Modules/timemodule.o'
/home/statquant/Sources/vim/src/config-PyMake3137:1482: warning: ignoring old recipe for target 'Modules/timemodule.o'
configure: error: NOT FOUND!
      You need to install a terminal library; for example ncurses.
      Or specify the name of the library with --with-tlib.

然后我

制作| tee make.log

我意识到它实际上是在 $HOME/Sources/vim/src 而不是 $HOME/Build/vim 中构建了 vim (也许我的预期是错误的)

当我在 ./vim -g 上运行 :version (vim 已使用 GUI 支持构建)时,有 没有 python 没有 python3 .... enter image description here

configure.logthere , make.logthere

EDIT1:以下作品,我现在只怀念+perl +ruby

./configure --with-features=huge \
       --enable-tclinterp=yes \
       --enable-luainterp=yes \
       --enable-pythoninterp=yes \
       --enable-python3interp=yes \
       --with-compiledby=statquant \
       --prefix=$HOME/Build/vim \

make install # and yes it installs in $HOME/Build/vim  

enter image description here

编辑2 这是当我尝试添加时发生的情况

  1. +perl

我可以跑

./configure --with-features=huge \
            --enable-tclinterp=yes \
            --enable-luainterp=yes \
            --enable-pythoninterp=yes \
            --enable-python3interp=yes \
            --enable-perlinterp=yes \
            --prefix=$HOME/Build/vim \
            --with-compiledby=statquant | tee configure.log

它似乎可以工作(没有错误):configure.log

make | tee make.log
[...]
cc1: error: -Wformat-security ignored without -Wformat [-Werror=format-security]
<command-line>:0:0: warning: "_FORTIFY_SOURCE" redefined
<command-line>:0:0: note: this is the location of the previous definition
cc1: some warnings being treated as errors
make[1]: *** [objects/option.o] Error 1
Makefile:2907: recipe for target 'objects/option.o' failed
make[1]: Leaving directory '/home/statquant/Sources/vim/src'
make: *** [first] Error 2
Makefile:26: recipe for target 'first' failed

我没有在 /home/statquant/Sources/vim/src 中内置 vim :make.log

  • + ruby

    ./configure --with-features=巨大\ --enable-tclinterp=是\ --enable-luainterp=是\ --enable-pythoninterp=是\ --enable-python3interp=是\ --enable-rubyinterp=是\ --prefix=$HOME/Build/vim\ --with-compiledby=statquant | --with-compiledby=statquant | tee配置.log

  • 它甚至不运行configure

    checking --with-tlib argument... empty: automatic terminal library selection
    checking for tgetent in -ltinfo... no
    checking for tgetent in -lncurses... no
    checking for tgetent in -ltermlib... no
    checking for tgetent in -ltermcap... no
    checking for tgetent in -lcurses... no
    no terminal library found
    checking for tgetent()... configure: error: NOT FOUND!
          You need to install a terminal library; for example ncurses.
          Or specify the name of the library with --with-tlib.
    

    这是日志:configure.log

    最佳答案

    好吧...事情就是这样。 VIM 是拥有大量补丁的程序之一,Fedora 在 GCC 级别强制执行一些安全检查,不允许您从源代码(轻松)构建它,我的建议:重建源 rpm,并不难:

    安装重建 VIM 所需的依赖项

    在 F23 中构建 VIM 需要这些软件包

    sudo dnf install gtk2-devel ncurses-devel lua-devel perl-devel perl-ExtUtils-Embed perl-ExtUtils-ParseXS perl-ExtUtils-XSpp perl-ExtUtils-CBuilder python-devel python3-devel tcl-devel ruby-devel 
    

    安装 Racket 存储库

    我发现您正在传递 --enable-mzschemeinterp 标志,该标志需要 Racket ,但官方存储库中未包含该标志。

    cat >/etc/yum.repos.d/rpm-sphere.repo <<EOF
    [rpm-sphere]
    name=RPM Sphere
    baseurl=http://download.opensuse.org/repositories/home:/zhonghuaren/Fedora_23/
    gpgkey=http://download.opensuse.org/repositories/home:/zhonghuaren/Fedora_23/repodata/repomd.xml.key
    enabled=1
    gpgcheck=1
    EOF
    

    安装 RPM 开发者工具:

    安装构建/重建 rpm 的工具需要这些

    sudo dnf install @development-tools
    sudo dnf install fedora-packager
    sudo dnf install rpmdevtools
    

    设置 RPM 构建根目录

    在您的主文件夹中创建一个名为 rpmmacros 的文件,如下所示:

    vim ~/.rpmmacros

    添加以下内容:

    %_topdir    /home/statquant/Src/rpm
    

    然后创建文件夹/home/statquant/Src/rpm

    创建 RPM 构建所需的文件夹

    您需要拥有这些文件夹,以便在安装源 rpm 时存储源代码和规范文件:

    mkdir -p ~/Src/rpm
    cd ~/Src/rpm
    mkdir BUILD RPMS SOURCES SPECS SRPMS
    mkdir RPMS/{noarch,x86,x86_64}
    

    下载 VIM 源 RPM:

    dnf dnl --source vim

    这会将源 rpm 下载到当前文件夹,例如 vim-7.4.1718-1.fc23.src.rpm

    下载后,安装它:

    rpm -ivh vim-7.4.1718-1.fc23.src.rpm

    安装后,RPM 应该创建文件 /home/statquant/Src/rpm/SPECS/vim.spec 打开此文件。

    修改配置选项

    您将看到 SPEC 文件具有配置选项和构建实际内容的 make 命令。这个文件很大,而且有很多补丁。你可以继续修改configure命令所在的区域,共有3处:

    • 一个用于 vim 最小化
    • 一个用于 vim 增强
    • 一个用于 vim 的 GUI 版本

    确保进行相应修改。我用你的选项做了一个测试构建。你可以下载我的SPEC file here 、vim、vim-enhanced 和 gvim 工作得很好。

    重建 RPM

    一旦您修改(或从我的模板复制)您想要构建基于该规范的 RPM 的规范文件,请转至 /home/statquant/Src/rpm,然后:

    rpmbuild -ba SPECS/vim.spec

    这需要一段时间,之后,您应该看到一些输出,表明包已成功构建,在我的例子中:

    Checking for unpackaged file(s): /usr/lib/rpm/check-files /home/gustavo/Src/rpm/BUILDROOT/vim-7.4.1718-1.fc23.x86_64
    Wrote: /home/gustavo/Src/rpm/SRPMS/vim-7.4.1718-1.fc23.src.rpm
    Wrote: /home/gustavo/Src/rpm/RPMS/x86_64/vim-common-7.4.1718-1.fc23.x86_64.rpm
    Wrote: /home/gustavo/Src/rpm/RPMS/x86_64/vim-minimal-7.4.1718-1.fc23.x86_64.rpm
    Wrote: /home/gustavo/Src/rpm/RPMS/x86_64/vim-enhanced-7.4.1718-1.fc23.x86_64.rpm
    Wrote: /home/gustavo/Src/rpm/RPMS/x86_64/vim-filesystem-7.4.1718-1.fc23.x86_64.rpm
    Wrote: /home/gustavo/Src/rpm/RPMS/x86_64/vim-X11-7.4.1718-1.fc23.x86_64.rpm
    Wrote: /home/gustavo/Src/rpm/RPMS/x86_64/vim-debuginfo-7.4.1718-1.fc23.x86_64.rpm
    Executing(%clean): /bin/sh -e /var/tmp/rpm-tmp.tNsBuH
    + umask 022
    + cd /home/gustavo/Src/rpm/BUILD
    + cd vim74
    + rm -rf /home/gustavo/Src/rpm/BUILDROOT/vim-7.4.1718-1.fc23.x86_64
    + exit 0
    

    安装新版本

    现在您已经按照 fedora 建议和补丁构建了软件包,您可以继续重新安装它们(如果您已经拥有默认的 fedora vim 版本,这可能是正确的),如下所示:

    cd /home/statquant/Src/rpm/RPMS/x86_64/
    sudo dnf reinstall ./vim-common-7.4.1718-1.fc23.x86_64.rpm
    sudo dnf reinstall ./vim-enhanced-7.4.1718-1.fc23.x86_64.rpm
    etc...
    

    请注意点和斜杠,这意味着 dnf 正在尝试安装本地软件包,而不是搜索其数据库,后者会下载您已有的版本。

    注释

    出于安全考虑,我没有上传我的定制软件包,但如果您不介意或想尝试一下,请 ping 我,我可以上传它们,这样您就可以省去所有这些麻烦...我已经拥有了所有这些RPM 构建工具,因为我为我构建了一些 here .

    您可能还想创建 COPR存储库,以便您自动执行此过程,如果您需要格式化磁盘、重新安装 fedora、将其安装在新计算机上等。您只需添加存储库并使用 dnf 来安装自定义包即可。

    如果您有任何其他问题,请告诉我,祝您好运!

    更新规范文件中有以# options for开头的注释,因此您可以跳转到实际的配置选项

    关于vim - 在 Fedora 23 上创建 vim 时如何修复此错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34975039/

    相关文章:

    Vim 语言特定的语法验证器?

    c - 为什么当头文件更改时 makefile 会重新编译所有内容?

    linux - 由于缺少 Build.include 文件,Ubuntu 20.04 中的 objtool 制作失败?

    c++ - undefined reference 错误,即使在链接 c 文件之后

    ruby-on-rails - 为什么 Bundler 无法获取 gem 元数据?

    Vim:如何从缩进脚本中更改文本

    reactjs - 任何 VIM 插件都可以帮助我重构 React 组件吗?

    vim - 在光标下搜索主题的 vim 帮助

    docker - 为什么默认情况下所有端口都使用此 Docker 镜像发布

    linux - 使用 inittab 中的 respawn 条目重新启动 linux 应用程序不起作用