I'm trying to build it myself since the version in debian apt-get is too old for a plugin I need, and this plugin needs lua.
I did apt-get install libtolua-dev
And am runnning the command
./configure --with-features=huge \
--enable-rubyinterp \
--enable-pythoninterp \
--with-python-config-dir=/usr/lib/python2.7/config \
--enable-perlinterp \
--enable-gui=gtk2 --enable-cscope --prefix=/usr \
--enable-luainterp \
When I run this command, at some point the program will say checking Lua version... (cached) 5.0.3 when I actually have version 5.2 installed. When I run the configure I get:
checking for lua... (cached) /usr/bin/lua
checking if lua.h can be found in /usr/include... no
checking if lua.h can be found in /usr/include/lua5.0.3... no
So I tried to copy all the files from /usr/include/lua5.2 to a new directory /usr/include/lua5.0.3
Then I'll get
checking if lua.h can be found in /usr/include... no
checking if lua.h can be found in /usr/include/lua5.0.3... yes
checking if link with -L/usr/lib -llua5.0.3 is sane... no
I don't understand how to make it use lua 5.2.
For those who are interested by a manner that worked for me to build vim with lua support and a solid basis to setup spf13 with full Neocomplete support here are the steps followed to do it:
Download the vim sources from git:
git clone https://github.com/vim/vim.git
Setup dependancies (on ArchLinux, adapt according to your distribution):
pacman -Suy ruby perl python2 python lua luajit
Link luajit headers for the compilation:
cd /usr/local/include
sudo ln -sv /usr/include/luajit-2.0/lua.h
sudo ln -sv /usr/include/luajit-2.0/luaconf.h
sudo ln -sv /usr/include/luajit-2.0/lualib.h
sudo ln -sv /usr/include/luajit-2.0/lauxlib.h
Run the following commands to build vim (include lua support as desired):
./configure --with-features=huge --enable-multibyte --enable-rubyinterp --enable-pythoninterp --with-python-config-dir=/usr/lib/python2.7/config --enable-gui=no --without-x enable-cscope --enable-multibyte --enable-fontset --enable-largefile --enable-cscope --enable-perlinterp --enable-luainterp --enable-fail-if-missing --with-lua-prefix=/usr/local/ --with-luajit --prefix=/usr
Compile:
make VIMRUNTIMEDIR=/usr/share/vim/vim80
Install Vim:
sudo make install
Use vim --version command to verify lua support (+lua):
vim --version
And that's it!
You need to include the --with-lua-prefix=<dir> flag when running configure. This flag tells the configure script where lua is installed. (You could also set the LUA_PREFIX environment variable if you do not pass the flag).
I would also recommend running configure with --enable-fail-if-missing so that the configure script will fail instead of quietly warning that it didn't find a lua config directory or executable.
Related
While trying to install GCC 6.4.0 on Alpine, I run into:
checking for the correct version of gmp.h... yes
checking for the correct version of mpfr.h... yes
checking for the correct version of mpc.h... yes
checking for the correct version of the gmp/mpfr/mpc libraries... no
But in /usr/lib, which seems to be the standard lookup directory, I have:
libgmp.a
libgmp.so
libgmp.so.10
libgmp.so.10.3.2
libmpc.so.3
libmpc.so.3.0.0
libmpfr.so.4
libmpfr.so.4.1.5
What could be wrong?
The quickest way to install GCC on Alpine Linux is by issuing the following command:
apk add build-base
source: https://wiki.alpinelinux.org/wiki/GCC
The best way to install all necessary libraries to compile gcc is using ./contrib/download_prerequisites script in the gcc source directory. That will download the support libraries and create symlinks, causing them to be built automatically as part of the gcc build process.
The steps to compile gcc version 6.4.0 on Alpine linux are:
apk add --no-cache make build-base
wget https://ftp.gnu.org/gnu/gcc/gcc-6.4.0/gcc-6.4.0.tar.gz
tar -xzvf gcc-6.4.0.tar.gz
cd gcc-6.4.0
./contrib/download_prerequisites
cd ..
mkdir objdir
cd objdir
./../gcc-6.4.0/configure --prefix=$HOME/GCC-6.4.0 --disable-multilib
make all-gcc
make all-target-libgcc
make install-gcc
make install-target-libgcc
It turns out that in this particular case one needs to install mpc1-dev, gmp-dev or mpfr-dev. I was missing out on mpc1-dev.
sudo apk add mpc1-dev
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 ....
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
EDIT2
Here is what happen when I try to add
+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
+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
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:
One for vim minimal
One for vim enhanced
One for the GUI version of vim
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
You have enabled -Werror=format-security. This treats any susceptible usage of format of printf or scanf currently treated as `error.
You can either fix the usage in if_perl.c, I believe this is generated file. or remove the flag -Werror=format-security
The python problem was this...
--with-python-config-dir=/usr/lib64/python2.7/config \
--enable-python3interp=yes \
Version 2 config with a version 3 interpreter.
Your missing the ncurses-devel library, I can see that you dropped it from configure.
sudo yum install ncurses-devel
configure actually worked for me even when I didn't have the perl dev packages installed ie it didn't fail asking me to install them which I found odd. Do you have all the dev packages you need installed.
sudo yum install perl-devel
sudo yum install ruby-devel
If you are missing some dev package for ruby or perl the configure script say something like : "disabling this option". Just did this with ruby. After installing the ruby-dev package the ruby option is enabled in vim. Same with libperl-dev.
There is now a Vim issue filed about this:
https://github.com/vim/vim/issues/1081
I'm using a work-around that I mentioned in a comment to that issue:
https://github.com/vim/vim/issues/1081#issuecomment-269920486
I've copied most of that comment below in case it may be helpful.
I ran into this problem on Fedora 25 (x86_64). Vim's configure script asks ruby about LDFLAGS without a corresponding query regarding CFLAGS:
https://github.com/vim/vim/blob/v8.0.0134/src/auto/configure#L7174
rubyldflags=`$vi_cv_path_ruby -r rbconfig -e "print $ruby_rbconfig::CONFIG['LDFLAGS']"`
Since Fedora 23, all RPMs have been "hardened" by default:
https://fedoraproject.org/wiki/Changes/Harden_All_Packages
When an RPM is built, the %configure macro used in the RPM SPEC file is automatically adjusted to provide CFLAGS, LDFLAGS, and several other environment variables using hardened settings. When using Fedora's ruby package, the above query using rbconfig returns hardened linker flags. Because Vim's configure script doesn't use a corresponding rbconfig to query ruby's CFLAGS, the compiling and linking flags are mismatched, leading to the error:
configure: error: NOT FOUND!
You need to install a terminal library; for example ncurses.
Or specify the name of the library with --with-tlib.
In src/auto/config.log, this mismatch of flags causes this error:
configure:11318: checking for tgetent in -lncurses
configure:11343: gcc -o conftest -g -O2 -L. -Wl,-z,relro -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -fstack-protector -rdynamic -Wl,-export-dynamic -Wl,--enable-new-dtags -Wl,-z,relro -L/usr/local/lib conftest.c -lncurses -lselinux >&5
/usr/bin/ld: /tmp/cckpDslF.o: relocation R_X86_64_PC32 against undefined symbol `tgetent' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Bad value
collect2: error: ld returned 1 exit status
I can successfully build with a work-around, but I don't know enough about autoconf to suggest a proper fix to the configure script. The work-around involves first installing some RPM-related packages:
sudo dnf install -y rpm-build redhat-rpm-config
Next, set these variables at the shell prompt via:
eval $(rpmbuild --eval '%{configure}' | egrep '^\s*[A-Z]+=')
The above uses rpmbuild --eval '%{configure}' to query the definition of the %configure macro which begins with a number of environment variable assignments. This provides the same default compilation environment that is provided in the %configure macro. Now running the below invocation succeeds:
./configure --quiet --with-features=huge --enable-rubyinterp
This is what I did:
# Install lua
curl -R -O http://www.lua.org/ftp/lua-5.2.2.tar.gz
tar zxf lua-5.2.2.tar.gz
cd lua-5.2.2
sudo make linux install
# build vim
sudo apt-get install libncurses5-dev libgnome2-dev libgnomeui-dev \
libgtk2.0-dev libatk1.0-dev libbonoboui2-dev \
libcairo2-dev libx11-dev libxpm-dev libxt-dev python-dev ruby-dev mercurial
sudo apt-get remove vim vim-runtime gvim
sudo apt-get remove vim-tiny vim-common vim-gui-common
cd ~
hg clone https://code.google.com/p/vim/
cd vim
./configure --with-features=huge \
--enable-rubyinterp \
--enable-pythoninterp \
--with-python-config-dir=/usr/lib/python2.7-config \
--enable-perlinterp \
--enable-gui=gtk2 --enable-cscope --prefix=/usr \
--enable-luainterp \
--with-lua-prefix=/usr/local/bin/lua
make VIMRUNTIMEDIR=/usr/share/vim/vim74
sudo make install
But the ./configure step returns:
checking --enable-luainterp argument... yes
checking --with-lua-prefix argument... /usr/local/bin/lua
checking --with-luajit... no
checking for lua... (cached) /usr/local/bin/lua
checking Lua version... (cached) 5.2
checking if lua.h can be found in /usr/local/bin/lua/include... no
checking if lua.h can be found in /usr/local/bin/lua/include/lua5.2... no
I can verify that lua.h can't be found in those locations, but I don't know where it can be found.
Edit
I tried this again, ran into problems, and discovered a package vim-nox that already has vim support.
Original answer
I'm not entirely sure how I did this in the end, but thanks to #wrikken for the tip about headers.
# Install lua from binaries (these are out-of-date but at least they worked).
sudo apt-get install lua50 liblua50-dev liblualib50-dev
# Remove old vims
sudo apt-get remove vim vim-runtime gvim
sudo apt-get remove vim-tiny vim-common vim-gui-common
# Download and build a new vim
sudo apt-get install libncurses5-dev libgnome2-dev libgnomeui-dev \
libgtk2.0-dev libatk1.0-dev libbonoboui2-dev \
libcairo2-dev libx11-dev libxpm-dev libxt-dev python-dev ruby-dev mercurial
cd ~
hg clone https://code.google.com/p/vim/
cd vim
cd ~/vim
./configure --with-features=huge \
--enable-rubyinterp \
--enable-pythoninterp \
--with-python-config-dir=/usr/lib/python2.7-config \
--enable-perlinterp \
--enable-gui=gtk2 --enable-cscope --prefix=/usr \
--enable-luainterp \
--with-lua-prefix=/usr/local
At this point, check the output of ./configure to see that it found lua.h. If not, find out where it is (I'm afraid I can't remember where it was). Symlink to it in /usr/local with e.g. sudo ln -s ../lua.h and rerun ./configure.
Finally:
sudo make VIMRUNTIMEDIR=/usr/share/vim/vim74
sudo make install
If it still won't work, post on a forum somewhere and go for a walk in the outdoors. You'll find it suddenly starts to behave.
What worked for me:
sudo apt-get install liblua5.1-dev
copy all files from /usr/include/lua5.1/ to /usr/include/lua5.1/include/
sudo ln -s /usr/lib/x86_64-linux-gnu/liblua5.1.so /usr/local/lib/liblua.so
Go to the vim source folder
cd src
make distclean
clear
./configure --with-features=huge --enable-cscope --enable-pythoninterp=yes --with-python-config-dir=/usr/lib/python2.7/config-x86_64-linux-gnu --enable-multibyte --enable-fontset --enable-gui=gnome2 --disable-netbeans --enable-luainterp=yes --with-lua-prefix=/usr/include/lua5.1 --enable-largefile --enable-rubyinterp
sudo make
sudo make install
This will also install the GUI version, remove the --enable-gui=gnome2 if you will only use it in the command line.
Most of these I found it in here
Right now I'm trying to build Automake on my Mac, and so far everything has been going swimmingly. I built Autoconf and m4 without any issues out of the packages (as opposed to git pulls). And then I get to Automake, and that's where things fall apart:
checking whether autoconf is installed... yes
checking whether autoconf works... yes
checking whether autoconf is recent enough... no
configure: error: Autoconf 2.65 or better is required.
The issue persists if I build and install autoconf 2.68. Is there some sort of trick I'm missing on this one?
The make file is detecting an older version of Autoconf in your $PATH. Take a look at this post in Sebastien's blog, especially the part that tells you to add your new Autoconf bin dir to the $PATH before building Automake. If you want to follow "standard" OSX folder structure convention, install Autoconf in /usr/local.
Allow me to shamelessly copy Daniel Farrelly version of Sebastien's script.
export build=~/devtools # or wherever you'd like to build
mkdir -p $build
##
# Autoconf
# http://ftpmirror.gnu.org/autoconf
cd $build
curl -OL http://ftpmirror.gnu.org/autoconf/autoconf-2.69.tar.gz
tar xzf autoconf-2.69.tar.gz
cd autoconf-2.69
./configure --prefix=/usr/local
make
sudo make install
export PATH=/usr/local/bin
##
# Automake
# http://ftpmirror.gnu.org/automake
cd $build
curl -OL http://ftpmirror.gnu.org/automake/automake-1.13.2.tar.gz
tar xzf automake-1.13.2.tar.gz
cd automake-1.13.2
./configure --prefix=/usr/local
make
sudo make install
I want to compile the current version of vim with:
+clipboard +xterm_clipboard and ruby support
But every time I compile it the clipboard and the xterm_clipboard options aren't enabled.
Is there a lib needed or must I add any other options in the configuration step?
./configure \
--enable-rubyinterp=dynamic \
--enable-cscope \
--enable-gui=auto \
--enable-gtk2-check \
--enable-gnome-check \
--with-features=huge \
--with-x
make && sudo make install
You can see if configure manage to find a working X lib by checking the output of (or scroll through the output of configure in your terminal):
$ grep X11 src/auto/config.h
#define HAVE_X11
If configure failed then you'll see:
$ grep X11 src/auto/config.h
/* #undef HAVE_X11 */
You'll need to install the appropriate X development library like xlib and xtst for --with-x to work.
On ubuntu it should be enough to install libx11-dev and libxtst-dev.
ubuntu18.04.4
sudo apt install libx11-dev libxtst-dev libxt-dev libsm-dev libxpm-dev
./configure --enable-python3interp=dynamic --prefix=$HOME/.local --enable-rubyinterp=dynamic --enable-gtk2-check --enable-gnome-check --with-features=huge --with-x
make install
./src/vim ---version | grep clip