Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

vim - configure for python3 support but still shows -python3 in version information

Tags:

vim

python-3.x

I am trying to build vim on Ubuntu 12.04 with python3 support as the default install only has python2 support. I pull the source code from https://vim.googlecode.com/hg/ and configure like so:

./configure --disable-pythoninterp --enable-python3interp --with-features huge

I tried with the --enable-pythoninterp option also.

When I run vim --version on this install I still get -python3 like so:

$ ./src/vim --version
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Oct 18 2014 09:32:02)
Included patches: 1-481
Compiled by brendan@brendan-laptop
Normal version with GTK2 GUI.  Features included (+) or not (-):
+acl             -farsi           -mouse_netterm   +syntax
-arabic          +file_in_path    -mouse_sgr       +tag_binary
+autocmd         +find_in_path    -mouse_sysmouse  +tag_old_static
+balloon_eval    +float           -mouse_urxvt     -tag_any_white
+browse          +folding         +mouse_xterm     -tcl
+builtin_terms   -footer          +multi_byte      +terminfo
+byte_offset     +fork()          +multi_lang      +termresponse
+cindent         +gettext         -mzscheme        +textobjects
+clientserver    -hangul_input    +netbeans_intg   +title
+clipboard       +iconv           +path_extra      +toolbar
+cmdline_compl   +insert_expand   -perl            +user_commands
+cmdline_hist    +jumplist        +persistent_undo +vertsplit
+cmdline_info    -keymap          +postscript      +virtualedit
+comments        -langmap         +printer         +visual
-conceal         +libcall         -profile         +visualextra
+cryptv          +linebreak       -python          +viminfo
-cscope          +lispindent      -python3         +vreplace
+cursorbind      +listcmds        +quickfix        +wildignore
+cursorshape     +localmap        +reltime         +wildmenu
+dialog_con_gui  -lua             -rightleft       +windows
+diff            +menu            -ruby            +writebackup
+digraphs        +mksession       +scrollbind      +X11
+dnd             +modify_fname    +signs           -xfontset
-ebcdic          +mouse           +smartindent     +xim
-emacs_tags      +mouseshape      -sniff           +xsmp_interact
+eval            -mouse_dec       +startuptime     +xterm_clipboard
+ex_extra        +mouse_gpm       +statusline      -xterm_save
+extra_search    -mouse_jsbterm   -sun_workshop    +xpm
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
  system gvimrc file: "$VIM/gvimrc"
    user gvimrc file: "$HOME/.gvimrc"
2nd user gvimrc file: "~/.vim/gvimrc"
    system menu file: "$VIMRUNTIME/menu.vim"
  fall-back for $VIM: "/usr/local/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK  -pthread -I/usr/include/gtk-2.0 -I/usr/lib/x86_64-linux-gnu/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/pango-1.0 -I/usr/include/gio-unix-2.0/ -I/usr/include/freetype2 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/libpng12 -I/usr/include/harfbuzz     -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1      
Linking: gcc   -L/usr/local/lib -Wl,--as-needed -o vim   -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgio-2.0 -lpangoft2-1.0 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lcairo -lpango-1.0 -lfontconfig -lgobject-2.0 -lglib-2.0 -lfreetype   -lSM -lICE -lXpm -lXt -lX11 -lXdmcp -lSM -lICE  -lm -ltinfo -lnsl  -lselinux -lacl -lattr -lgpm -ldl    

As can be seen in the above, python3 support is not included in the binary.

I also have python3-dev installed too, although I'm sure if that's required.

sudo apt-get install python3-dev

Any help would be much appreciated!

Thanks

like image 201
Brendan Maguire Avatar asked Oct 18 '14 08:10

Brendan Maguire


2 Answers

You also need to specify the python config dir with

--with-python3-config-dir=

when running configure since it appears that configure wasn't able to automatically find the directory.


The other way to make configure find that python3-config-dir automatically is make sure that python points to a python 3 executable instead of a python 2 one (which most systems default to)


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 python3 config directory or executable.

like image 111
FDinoff Avatar answered Nov 15 '22 00:11

FDinoff


Building Vim from source

  • First, install all the prerequisite libraries, including Mercurial. For a Debian-like Linux distribution like Ubuntu, that would be the following:

bash 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 For Fedora 20, that would be the following:

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

  • Remove vim if you have it already.

bash sudo apt-get remove vim vim-runtime gvim vim-tiny vim-common vim-gui-common

  • Once everything is installed, getting the source is easy. If you're not using vim 7.4, make sure to set the VIMRUNTIMEDIR variable correctly below (for instance, with vim 7.4a, use /usr/share/vim/vim74a):

bash cd ~ hg clone https://code.google.com/p/vim/ cd vim ./configure --with-features=huge \ --enable-multibyte \ --enable-rubyinterp \ --enable-python3interp vi_cv_path_python3=/usr/bin/python3.4 \ --with-python-config-dir=/usr/lib/python3.4/config-3.4m-x86_64-linux-gnu \ --enable-perlinterp \ --enable-luainterp \ --enable-gui=gtk2 --enable-cscope --prefix=/usr make VIMRUNTIMEDIR=/usr/share/vim/vim74 sudo apt-get install checkinstall sudo checkinstall

  • Set vim as your default editor with update-alternatives

bash sudo update-alternatives --install /usr/bin/editor editor /usr/bin/vim 1 sudo update-alternatives --set editor /usr/bin/vim sudo update-alternatives --install /usr/bin/vi vi /usr/bin/vim 1 sudo update-alternatives --set vi /usr/bin/vim

Done

like image 28
Garcia Sylvain Avatar answered Nov 15 '22 00:11

Garcia Sylvain