How to locally install Python3, Vim, Tmux locally without root elevation on Ubuntu?
The installation of ncurses-6.0 and libevent-2.0.22-stable
The installation of Python3
$./configure --prefix=$HOME/local
$make && make install
The installation of Tmux 2.2:
$./configure CFLAGS="-I$HOME/local/include -I$HOME/local/include/ncurses" LDFLAGS="-L$HOME/local/lib -L$HOME/local/include/ncurses -L$HOME/local/include" CPPFLAGS="-I$HOME/local/include -I$HOME/local/include/ncurses" --prefix=$HOME/local
$make && make install
The installation of VIM 7.4:
$./configure CFLAGS="-I$HOME/local/include -I$HOME/local/include/ncurses" LDFLAGS="-L$HOME/local/lib -L$HOME/local/include/ncurses -L$HOME/local/include" CPPFLAGS="-I$HOME/local/include -I$HOME/local/include/ncurses" --prefix=$HOME/local --with-features=huge --enable-multibyte --enable-rubyinterp --enable-python3interp --with-python-config-dir=$HOME/local/lib/python3.5/config-3.5m --enable-perlinterp --enable-gui=gtk2 --enable-cscope
$make && make install
Related
I use VIM a lot, and have previously been able to get +xterm_clipboard support working by using a script provided in a separate post on StackOverflow. I've re-installed Ubuntu on my machine, and have since migrated from Ubuntu 14.04.4 LTS (Wily) to Ubuntu 16.04 LTS (Xenial).
# Get the compile-dependencies of vim
sudo apt-get build-dep vim
# If you haven't got mercurial, get it
sudo apt-get install mercurial
# Get the source
hg clone https://vim.googlecode.com/hg/ vim_source
# Compile it
cd vim_source
./configure \
--enable-perlinterp=dynamic \
--enable-pythoninterp=dynamic \
--enable-rubyinterp=dynamic \
--enable-cscope \
--enable-gui=auto \
--enable-gtk2-check \
--enable-gnome-check \
--with-features=huge \
--with-x \
--with-compiledby="Your Name <youremail#domain.com>" \
--with-python-config-dir=/usr/lib/python2.7/config
make && sudo make install
However, this no longer works, and I can't make use of ",+,y to yank buffers to the system clipboard. I don't see anything obvious in the .configure output, but vim --version always shows -xterm_clipboard when I build it. How do I fix this?
You should have noticed that the source is no longer hosted on Google code via mercurial (hg) anymore, and has migrated to GitHub in the error messages generated by the provided script.
You'll need to use the new source tree, git, and some developer libraries will need to be installed in advance.
Code Listing (Updated for Ubuntu 18.04 and onward)
# Get the compile-dependencies of vim
sudo apt-get -y build-dep vim
# Install the "checkinstall" tool so the "make install" step is
# wrapped and the result is a .deb file that can be removed later by
# your package manager rather than having to hunt down every file deployed
# by "make install", which might not be possible if it overwrites existing
# system files.
sudo apt-get -y install checkinstall
# Install python dev
sudo apt-get -y install python3-dev
# Install xorg dev
sudo apt-get -y install xorg-dev
# Install git
sudo apt-get -y install git
# Get the source
git clone https://github.com/vim/vim.git vim_source
# Remove ./configure cache in case we have to run this twice due to permissions
# related issues.
rm vim_source/src/auto/config.cache
# Compile it
cd vim_source
make clean distclean
./configure \
--enable-perlinterp=yes \
--enable-python3interp=yes \
--enable-rubyinterp=yes \
--with-python3-command=python3.6 \
--with-python3-config-dir=$(python3.6-config --configdir) \
--enable-cscope \
--enable-gui=auto \
--enable-gtk2-check \
--enable-gnome-check \
--with-features=huge \
--with-x \
--with-compiledby="DevNull <darkstar#/dev/null>"
# Build quickly (parallel jobs).
make -j$(nproc)
# Need root to install
sudo checkinstall
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.
I have a minimal-install CentOS 6.6, with Desktop added afterwards. I'd like to compile the latest vim with xterm_clipboard.
I did the following
Installed *-devel packages
yum install ruby perl-devel python-devel ruby-devel \
perl-ExtUtils-Embed ncurses-devel libX11 libX11-devel \
libXtst-devel libXtst libXt-devel libXt libSM-devel libSM \
libXpm libXpm-devel
That didn't work.
Next I tried using groupinstall
yum groupinstall "Desktop" "Desktop Platform" "X Window System" \
"Fonts" "General Purpose Desktop"
No luck either.
After each of the above steps, I did
make clean
./configure --with-features=huge --enable-perlinterp \
--enable-rubyinterp --enable-pythoninterp --with-x=yes \
--enable-gui=auto
and then
grep X11 src/auto/config.h
But everytime I see
/* #undef HAVE_X11 */
Forcing a sudo make install, and then vim --version confirms that I don't have xterm_clipboard (the output shows -xterm_clipboard).
Could you all please help me?
Thank you!
The solution of my issue is
make distclean
./configure ...
I only did make clean after installing the groups, and various packages. It is not "clean" enough, the config-files are not completely restored to the initial state.
I hope this helps others with the same issue.
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
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