vimmakefilefedoramake-install

How can I fix this error when making vim on Fedora 23


I am trying to build vim with the following options on my Fedora 23

I want +python +python3 +perl +lua +ruby +gui +conceal +gui for some plugins.

I could not find a version with all those built in (so I do it myself)

The journey started by following 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

I also have ncurses (raw,devel,static,...)

Then

$ 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

The following is printed on screen:

/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.

Then I

make | tee make.log

I realized that it actually built vim in $HOME/Sources/vim/src instead of $HOME/Build/vim (maybe I was wrong to expect that)

When I run :version on ./vim -g (vim has been build with GUI support) there is NO python NO python3 .... enter image description here

configure.log is there, make.log is there

EDIT1: the following works, I now only miss +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

EDIT2 Here is what happen when I try to add

  1. +perl

I can run

./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

It appears to work (no error) : 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

I get no vim built in /home/statquant/Sources/vim/src : make.log

  1. +ruby

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

It does not even run 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.

Here is the log: configure.log


Solution

  • Ok... so here's the thing. VIM is one of those programs that has a huge amount of patches, Fedora enforces some security checks at GCC level that won't allow you to build it (easily) from source code, my advice: rebuild the source rpm, is not that hard:

    Install required dependencies to rebuild VIM

    These packages are required for you to build VIM within F23

    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 
    

    Install racket repository

    I see you are passing the --enable-mzschemeinterp flag which requires racket, which is not included on the official repos.

    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
    

    Install RPM developer tools:

    These are required to install the tools to build/rebuild rpms

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

    Setup your RPM build root

    Create a file on your home folder called rpmmacros like so:

    vim ~/.rpmmacros

    Add the following contents to it:

    %_topdir    /home/statquant/Src/rpm
    

    Then create the folder /home/statquant/Src/rpm

    Create RPM build necessary folders

    You need to have these folders so the source code and spec files are stored when you install the source rpm:

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

    Download VIM source RPM:

    dnf dnl --source vim

    This will download the source rpm to the current folder, say vim-7.4.1718-1.fc23.src.rpm

    Once it has been downloaded, install it:

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

    Once installed the RPM should have created the file /home/statquant/Src/rpm/SPECS/vim.spec open this file.

    Modify configure options

    You'll see that the SPEC file has the configure options and the make commands to build the actual thing. This file is huge and it has a lot of patches. You can go ahead and modify the areas where the configure command is, there are 3:

    Make sure you modify accordingly. I did a test build with your options. You can download my SPEC file here, and vim, vim-enhanced and gvim worked just fine.

    Rebuild the RPM

    Once you modified (or copied from my template) the spec file you want to build the RPM based of that spec, go to /home/statquant/Src/rpm and then:

    rpmbuild -ba SPECS/vim.spec

    It will take a while, after that, you should see some ouput saying that the packages were built successfully, in my case:

    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
    

    Install the new version

    So now you have the packages built following fedora recommendations and patches, you can just go ahead and reinstall them (in case you already have the default fedora vim version which is probably true) like so:

    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...
    

    Please note the dot and slash meaning that dnf is trying to install a local package instead of searching through its database which would download the versions you already have.

    Notes

    Out of security concern I did not uploaded my custom-built packages but if you don't mind or want to try them out ping me and I can upload them so you save yourself all this hassle... I already had all RPM build tools because I build some for me here.

    You may also want to create a COPR repository so that you automate this process and if you need to format your disk, reinstall fedora, install it on a new machine etc. you can just add the repository and use dnf to install your custom package.

    If you have any other questions let me know, good luck!

    Update there are comments in the spec file beginning with # options for so you can jump to the actual configure options