Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
730 views
in Technique[技术] by (71.8m points)

macos - Vim failing to compile with python on OS X

I've been trying to compile vim 7.3 with python 2.7 support on mac OS X 10.6. Vim itself compiles fine, but the embedded python not so much.

The steps I've taken:

hg clone https:/vim.googlecode.com/hg/ vim
cd vim/src
./configure --without-x --disable-gui --disable-darwin 
            --enable-pythoninterp --with-features=huge
make
make install

That gives me a working vim but without python.

The auto/config.log indicates there's a file error:

configure:5387: checking if compile and link flags for Python are sane
configure:5404: gcc -o conftest -g -O2 
     -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 
     -DPYTHON_HOME="/Library/Frameworks/Python.framework/Versions/2.7"   
     -L/usr/local/lib conftest.c  
     -L/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/config 
     -lpython2.7 -ldl -framework CoreFoundation 
     -u _PyMac_Error Python.framework/Versions/2.7/Python >&5
i686-apple-darwin10-gcc-4.2.1: Python.framework/Versions/2.7/Python: No such file or directory

<command-line>: warning: missing terminating " character
configure:5404: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME ""
| #define PACKAGE_TARNAME ""
| #define PACKAGE_VERSION ""
| #define PACKAGE_STRING ""
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE_URL ""
| #define UNIX 1
| #define STDC_HEADERS 1
| #define HAVE_SYS_WAIT_H 1
| #define FEAT_HUGE 1
| #define USE_XSMP_INTERACT 1
| /* end confdefs.h.  */
| 
| int
| main ()
| {
|  
|   ;
|   return 0;
| }
configure:5408: result: no: PYTHON DISABLED

I get this error whether I run configure with or without the --with-python-conf-dir option. It looks like the -u _PyMac_Error Python.framework/Versions/2.7/Python is the source of the problem, but I'm not sure where to go from here.

Any suggestions?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Turns out the bug is actually in the Python Makefile, believe it or not.

Open the file

/usr/local/Cellar/python/2.7.2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/config

or whatever the appropriate path is for you, and search for PyMac_Error. It should be on the line defining LINKFORSHARED, and on this line you need to change PYTHONFRAMEWORKDIR to PYTHONFRAMEWORKINSTALLDIR. Then go back to your vim source and ./configure, everything should go smooth.

Also make sure you symlink OS X's Python Frameworks to the ones in the Homebrew Cellar:

/Library/Frameworks/Python.framework/Versions/2.7
/Library/Frameworks/Python.framework/Versions/Current
/System/Library/Frameworks/Python.framework/Versions/2.7
/System/Library/Frameworks/Python.framework/Versions/Current

should all point to

/usr/local/Cellar/python/2.7.2/Frameworks/Python.framework/Versions/2.7

Not really sure why I had it in so many places, or if that's bad, but there it is.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...