Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Compiling vim with Python3 (installed via Homebrew) support?

I have python3 installed via homebrew: brew install python3 --framework

I have the vim source (7.3) downloaded in /usr/src

I run:

./configure --prefix=/usr/local --enable-rubyinterp --enable-python3interp --disable-gpm --enable-gui=no --enable-multibyte

And in my src/auto/config.log I see:

configure:5442: checking --enable-python3interp argument   
configure:5451: result: yes  
configure:5456: checking for python3  
configure:5489: result: no

I googled around some, and found this, so I tried making the symlink for python3.2 and then running configure like this:

./configure --prefix=/usr/local --enable-rubyinterp --enable-python3interp --disable-gpm --enable-gui=no --enable-multibyte --with-python3-config-dir=/usr/local/Cellar/python3/3.2/Frameworks/Python.framework/Versions/3.2/lib/python3.2/config-3.2m

And my log shows the same error. What do I need to do to get vim compiled with Python3 support?

And no: I do not want to use MacVim.


➜ ls -al /System/Library/Frameworks/Python.framework/Versions 
total 16
drwxr-xr-x   7 root  wheel  238 May 28 15:33 .
drwxr-xr-x   7 root  wheel  238 Sep 21  2010 ..
drwxr-xr-x   8 root  wheel  272 Sep 17  2010 2.3
drwxr-xr-x  12 root  wheel  408 Dec  1 12:49 2.5
drwxr-xr-x  12 root  wheel  408 Dec  1 12:49 2.6
lrwxr-xr-x   1 root  wheel   70 May 28 15:33 Current -> /usr/local/Cellar/python3/3.2/Frameworks/Python.framework/Versions/3.2
lrwxr-xr-x   1 root  wheel    3 Sep 17  2010 old-Current -> 2.6

➜ which python3.2
/usr/local/bin/python3.2

UPDATE: I've gotten it working a la this post with Python 2.7.1 via Homebrew, but still no joy with Python 3...

like image 452
neezer Avatar asked May 28 '11 19:05

neezer


2 Answers

There is a problem with the configure script. Since python 3.2 the config and include directories get the abiflag included (see PEP 3149).

The next problem is that the configure script parses the python config and the flags for the linker are not correct for a framework build, so the test program from the configure script fails to build.

I already send a patch to vim and it got included (the mercurial repo has it).

`./configure --enable-python3interp vi_cv_path_python3=/usr/local/bin/python3.2`

should work.

Vim Patch: https://github.com/codedreality/vim/tree/fix-python3x-support

MacVim Patch: https://github.com/codedreality/macvim/tree/fix-python3x-support

like image 60
CodedReality Avatar answered Oct 09 '22 12:10

CodedReality


When you test to see if it worked, make sure you use the Vim binary created by the build - not the mvim script. mvim (even if you call the version on your source tree) will look in /Applications/ for MacVim.app first.

Maybe this will give you some joy:

./configure \
  --enable-python3interp=dynamic \
  --with-python3-config-dir=/usr/local/Cellar/python3/3.2/Frameworks/Python.framework/Versions/3.2/lib/python3.2/config/
like image 39
synthesizerpatel Avatar answered Oct 09 '22 13:10

synthesizerpatel