Macvim doesn't build against Homebrew python

363 views
Skip to first unread message

Ory Band

unread,
Feb 8, 2014, 2:38:51 PM2/8/14
to vim...@googlegroups.com
Numerous bugs and issues have been opened in the past few months, because Macvim fails to build against Homebrew Python. For now Homebrew devs are forced to use a hack to get around this problem, but the solution should be very simple on Macvim's side.

The source of the bug is that Macvim seems to link to Python on build by `-framework Python` instead of `python-config --ldflags`.

Here is Homebrew's Macvim formula for the exact hack-fix, note the Python paragraph at the end: https://github.com/Homebrew/homebrew/blob/master/Library/Formula/macvim.rb#L74

Besides that, please see this issues for more information, they discuss this specific problem:

https://github.com/Homebrew/homebrew/issues/17908
https://github.com/Homebrew/homebrew/issues/26496
https://github.com/Homebrew/homebrew/issues/20075
https://github.com/Homebrew/homebrew/issues/26496

Besides that, several issues have been opened on Macvim's Google Code page:

https://code.google.com/p/macvim/issues/detail?id=458
https://code.google.com/p/macvim/issues/detail?id=451
https://code.google.com/p/macvim/issues/detail?id=450

And another thread in this Google Group has also been opened, asking for a fix: https://groups.google.com/forum/#!searchin/vim_mac/homebrew/vim_mac/Pdb_XNYhPjw/jkZ6C9fXIWEJ

Please fix this, its causing a headache to a lot Macvim & Python users!


Rainer Müller

unread,
Feb 8, 2014, 9:09:49 PM2/8/14
to vim...@googlegroups.com
On 2014-02-08 20:38, Ory Band wrote:
> Numerous bugs and issues have been opened in the past few months, because Macvim fails to build against Homebrew Python. For now Homebrew devs are forced to use a hack to get around this problem, but the solution should be very simple on Macvim's side.
>
> The source of the bug is that Macvim seems to link to Python on build by `-framework Python` instead of `python-config --ldflags`.

In MacPorts I have been working around this with patches to the configure script. I only took the python versions provided by MacPorts into account, so I was able to remove some cruft for old versions of python.

https://trac.macports.org/browser/trunk/dports/editors/MacVim/files/patch-python.diff?rev=111451
https://trac.macports.org/browser/trunk/dports/editors/MacVim/files/patch-python3.diff?rev=111451

Be aware that these are untested with any other python distribution or with the Python.framework versions provided by OS X releases.

> Here is Homebrew's Macvim formula for the exact hack-fix, note the Python paragraph at the end: https://github.com/Homebrew/homebrew/blob/master/Library/Formula/macvim.rb#L74

Without having too much knowledge about Homebrew, this looks quite error-prone. You search PATH for any python-config, which will have an unknown version. But in the next line you hardcode version 2.7.

By the way, the Python detection is the same code in vanilla vim. Why don't you have this change in your formula for vim as well?

Rainer

Ory Band

unread,
Feb 9, 2014, 11:48:04 AM2/9/14
to vim...@googlegroups.com
On Sunday, February 9, 2014 4:09:49 AM UTC+2, Rainer Müller wrote:
> By the way, the Python detection is the same code in vanilla vim. Why don't you have this change in your formula for vim as well?

From what Homebrew devs have said, original Vim picks up the Homebrew Python correctly. Can't find the quote.

BTW, I've just found a message from Bjorn regarding this issue: https://github.com/Homebrew/homebrew/issues/20075#issuecomment-19050146

Ory Band

unread,
Feb 10, 2014, 11:18:32 AM2/10/14
to vim...@googlegroups.com
I've looked at src/configure.in and I think the problem is around here: https://github.com/b4winckler/macvim/blob/master/src/configure.in#L1058

The homebrew devs also used this to temporary fix stuff, might be helpful: https://github.com/Homebrew/homebrew/commit/fd2f302cc36ed6402eec20163ba4626a58bc5709#diff-e5bdde8c57ffa74024ffdadd33b5473fR121

This is a really big file and quite overwhelming. Please help!

Björn Winckler

unread,
Feb 28, 2014, 12:34:37 PM2/28/14
to vim...@googlegroups.com
My comment there still stands (reproduced below), sorry but I cannot
help out with this issue.

Björn

"MacVim dev here. This is most likely something that has to be fixed
in MacVim's configure script. Sorry guys, but I only use the system
Python version (and I have a strong aversion to autotools) so somebody
else will have to take a look at this. All I can say is that MacVim
passes -framework Pythonwhich will pick up the system Python version
when linking and this is most likely what needs to change. However, I
want that flag to be used when not building against a custom Python
version. (I'll consider patches sent to the vim_mac Google group.)"

Trevor Pierce

unread,
Aug 17, 2014, 1:14:58 AM8/17/14
to vim...@googlegroups.com
I can vouch that he Homebrew install of Vim properly points to the /usr/local Python, but the current Homebrew Macvim install still points to the System Python build. I have been trying for most of the evening to get Powerline ( https://github.com/Lokaltog/powerline ) installed on Macvim, and it took awhile to isolate where the problem lay.

I spent several mis-guided attempts installing Vim, then installing Macvim using this command:
brew install macvim --env-std --override-system-vim

Which only served to overwrite my proper Vim build with one that pointed to the System Python.

Reading through a number of issue tickets in Github and Stack Overflow, it does look like Macvim is the issue, and a fix that doesn't involve fiddling with the System Python settings hasn't been promoted.
Reply all
Reply to author
Forward
0 new messages