简体   繁体   English

在 Ubuntu 上使用 python 支持编译 vim

[英]compiling vim with python support on Ubuntu

I am trying to compile vim from source with python interpreter on Ubuntu. I have installed the dependencies for vim, installed python2.7-devel and python2.7-dbg packages on Ubuntu and do the configure step like this我正在尝试使用 Ubuntu 上的 python 解释器从源代码编译 vim。我已经安装了 vim 的依赖项,在 Ubuntu 上安装了 python2.7-devel 和 python2.7-dbg 包,并执行这样的配置步骤

./configure --enable-pythoninterp --with-python-config-dir=/usr/lib/python2.7/config

The config directory does contain the config.c file.配置目录确实包含 config.c 文件。 The make step fails with the following error. make 步骤失败并出现以下错误。

...

objects/py_config.o:(.data+0xcc): undefined reference to `initcStringIO'
objects/py_config.o:(.data+0xd4): undefined reference to `initcPickle'
objects/py_config.o:(.data+0xdc): undefined reference to `initzlib'
collect2: ld returned 1 exit status
make: *** [vim] Error 1

I have tried stable builds, tweaked around configure etc. But do not find a definitive answer.我已经尝试过稳定的构建,围绕配置进行调整等。但没有找到明确的答案。 Also vim builds without the python-interpreter. vim 也没有 python 解释器。

Here the complete这里是完整的

output - http://paste.pocoo.org/show/577749/ output - http://paste.pocoo.org/show/577749/

error - http://paste.pocoo.org/show/577752/错误 - http://paste.pocoo.org/show/577752/

Makefile - http://paste.pocoo.org/show/577751/ Makefile - http://paste.pocoo.org/show/577751/

Answering my own question after doing significant research.在进行大量研究后回答我自己的问题。 Looks in certain Ubuntu installs, the files which vim is looking for compilation may be missing .在某些Ubuntu安装中查找,vim正在寻找编译的文件可能会丢失

After realizing that I went ahead with custom install of Python source ( ./configure --prefix=/home/senthil/localpython; make; make install ) and then proceeded with vim compilation aginst this one.在意识到我继续自定义安装 Python 源代码( ./configure --prefix=/home/senthil/localpython; make; make install )然后继续进行 vim 编译反对这个。

  1. Set your path so that python points to the new local install.设置您的路径,使python指向新的本地安装。

    PATH=/home/senthil/localpython/bin:$PATH PATH=/home/senthil/localpython/bin:$PATH

  2. Then start the compilation with the following flags.然后使用以下标志开始编译。

    ./configure --enable-pythoninterp --with-features=huge --with-python-config-dir=/home/senthil/localpython/lib/python2.7/config ./configure --enable-pythoninterp --with-features=huge --with-python-config-dir=/home/senthil/localpython/lib/python2.7/config

You should see that vim compiles fine with using the local python interpreter.您应该看到 vim 使用本地 python 解释器编译得很好。 As has been informed by various sources, this increases the size of vim and I also felt that the speed had significant become slower.正如各种消息来源所告知的那样,这增加了 vim 的大小,我也觉得速度明显变慢了。 Just after finishing this exercise (in a really way with patience), I think, I would like to use the system compiled vim itself.刚完成这个练习(非常有耐心),我想,我想使用系统编译 vim 本身。

get the configdir with /usr/bin/python2.7-config --configdir使用/usr/bin/python2.7-config --configdir获取配置目录

ie: IE:

sudo apt-get build-dep vim 
hg clone https://vim.googlecode.com/hg/ vim
./configure --enable-pythoninterp --with-features=huge --prefix=$HOME/opt/vim --with-python-config-dir=$(/usr/bin/python2.7-config --configdir)
make && make install

Before compiling Vim, install python-dev and python2.7-dev (or whichever dev matches your python version).在编译 Vim 之前,安装python-devpython2.7-dev (或任何与您的 python 版本匹配的开发)。 Those two packages might point to the same files, but it worked for me.这两个包可能指向相同的文件,但它对我有用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM