Skip to content
This repository has been archived by the owner on Jan 16, 2025. It is now read-only.

Macvim Build Failing #29940

Closed
ssbanerje opened this issue Jun 6, 2014 · 10 comments
Closed

Macvim Build Failing #29940

ssbanerje opened this issue Jun 6, 2014 · 10 comments
Labels

Comments

@ssbanerje
Copy link

I am having a problem with the MacVim build on OSX 10.9.3. I am using the homebrew python, and it seems that the MacVim build is not able to find python -

...
...
clang -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_MACVIM -Wall -Wno-unknown-pragmas -pipe  -DMACOS_X_UNIX  -g -O2 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk -mmacosx-version-min=10.9 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1       -DRUBY_VERSION=20 -o objects/if_ruby.o if_ruby.c
if_python.c:59:11: fatal error: 'Python/Python.h' file not found
# include <Python/Python.h>
          ^
1 error generated.
make[1]: *** [objects/if_python.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [first] Error 2

Looks like the header files for Python are there in /usr/local/Cellar/python/2.7.7_1/Frameworks/Python.framework/Versions/2.7/include/python2.7/. I am not sure where MacVim is looking for them though. This might be related to #20392, but it seems that was fixed. I tried the soft linking trick mentioned in that issue, but it does not seem to work.

Config, doctor, build log attached in the Gist -
https://gist.github.com/ssbanerje/1bae1de2e08d99bba958

@adamv adamv added the python label Jun 6, 2014
@lucastheis
Copy link

This did the trick for me:

ln -s /usr/local/Cellar/python/2.7.7_1/Frameworks/Python.framework/Versions/2.7/include/python2.7 /usr/local/include/Python

@ssbanerje
Copy link
Author

Is this a homebrew problem or a MacVim one?

@Debilski
Copy link
Contributor

Debilski commented Jun 9, 2014

Manually setting the CFLAGS to the brewed Python framework, also seems to work: #29994. At least for Python 2.7 only builds.

@adamv adamv closed this as completed in d8af29d Jun 9, 2014
@mgarabed
Copy link

Unfortunately, this pull request created an odd problem where the system python would get linked inside MacVim, but the home-brewed site-packages directory would be referenced when running :python import sys;sys.path

This led to cases of aborts on startup (with YouCompleteMe installed in plugins):

Fatal Python error: PyThreadState_Get: no current thread
Vim: Caught deadly signal ABRT

After uninstalling python, macvim, and vim, then brew installing each of them in order, the startup error changed to:

ImportError: No module named site

And no window would appear.

Commenting out the CFLAGS line from the referenced pull request (line 78), and rebuilding MacVim led to a stable install. Here is the linking section from :version

Linking: clang   -L. -L/usr/local/lib -L. -L/usr/local/lib -L/usr/local/Cellar/python/2.7.8/Frameworks/Python.framework/Versions/2.7/lib/
python2.7/config -F/usr/local/Cellar/python/2.7.8/Frameworks -L/usr/local/lib -o Vim -framework Cocoa -framework Carbon       -lm  -lncur
ses -liconv -framework Cocoa   -fstack-protector -L/usr/local/lib  -L/System/Library/Perl/5.16/darwin-thread-multi-2level/CORE -lperl -fr
amework Python  -F/System/Library/Frameworks -framework Tcl -framework CoreFoundation -framework Ruby

@MikeMcQuaid
Copy link
Member

Sigh. No winning with vim and python it seems.

@byronyi
Copy link

byronyi commented Jul 26, 2014

Check if your YCM's python interpreter path is set right.

I accidentally found that my previous hack (i.e. set the YCM's python path to system's python in .vimrc) causes the DEAD SIGNAL after re-compiling vim from source, which is linked to the brew's python.

Here's my correct vimrc and vim flag now.
let g:ycm_path_to_python_interpreter = '/usr/local/bin/python'

Compilation: /usr/bin/clang -c -I. -Iproto -DHAVE_CONFIG_H -F/usr/local/Frameworks -DMACOS_X_UNIX -Os -w -pipe -march=native -mmacosx-version-min=10.9 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: /usr/bin/clang -L. -L/usr/local/lib -L/usr/local/lib -F/usr/local/Frameworks -Wl,-headerpad_max_install_names -o vim -lm -lncurses -liconv -framework Cocoa -lruby.2.0.0 -lobjc

I did the hack to handle the problem between virtualenv and YCM. YCM cannot detect the python interpreter in a virtualenv, and this might be your case as well.

Hope this helps.

@bengolder
Copy link

So Björn Winckler (@b4winckler), the sole MacVim developer, said in earlier discussions that he basically hardcoded the link to the system python in MacVim.
You can see the line here in the macvim repo. It looks like this:

        if test "x$MACOSX" = "xyes" && ${vi_cv_path_python} -c \
        "import sys; sys.exit(${vi_cv_var_python_version} < 2.3)"; then
          vi_cv_path_python_plibs="-framework Python"

He also said that he couldn't fix it himself, but if someone made a pull request wouldn't make the brewed python a requirement for MacVim (so he could still use the system python), that he would accept such a pull request.

In that piece of code, is there a path variable that can be used in place of his hardcoded "-framework Python" that would discover whether to use the system python or the homebrew python?

@adamv
Copy link
Contributor

adamv commented Sep 4, 2014

The correct approach isn't to try to discover, it's to have an option that lets it be set explicitly.

@bengolder
Copy link

Thanks for the correction @adamv. It looks like there might be a pull request that resolves this properly waiting to be merged. I'm excited and hopeful.

@mgarabed
Copy link

mgarabed commented Sep 5, 2014

Thanks for the pointer @bengolder ! That pull request has been incorporated as of just a short while ago - after a brew update and macvim reinstall, it builds clean and links against brewed python. Here is the link section:

Linking: clang -L. -L/usr/local/lib -L. -L/usr/local/lib -L/usr/local/Cellar/python/
2.7.8_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/config -framework CoreF
oundation -lpython2.7 -L/usr/local/lib -o Vim -framework Cocoa -framework Carbon
-lm -lncurses -liconv -framework Cocoa -fstack-protector -L/usr/local/lib -L/Syst
em/Library/Perl/5.16/darwin-thread-multi-2level/CORE -lperl -framework Python -F/Syst
em/Library/Frameworks -framework Tcl -framework CoreFoundation -framework Ruby

@Homebrew Homebrew locked and limited conversation to collaborators Feb 17, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

8 participants