编译VIM

用VIM官方网站下的安装包安装后,使用ruby脚本总是崩溃,原因不明。(比如:使用命令
:ruby puts $curbuf.line
)

今天决定下载源码(vim73_46src.zip),重新编译下,使之支持Ruby1.9.3, Lua5.1, Python2.7.

1.对Ruby的支持,我是按编译时的提示,改动了make文件,将文件拷贝到VIM源码所在目录;

2.对Lua的支持,没费多少周折,只是Lua安装路径中不能含有空格,而且生成的“pathdef.c”文件第6行会在Lua路径两边加上双引号,去掉即可;

3.对Python的支持,是最费劲的,最后是下载了最新的if_python.c替换原有同名文件才解决。

显示的错误:
if_python.obj : error LNK2001: 无法解析的外部符号 __imp__PyString_FromString
if_python.obj : error LNK2001: 无法解析的外部符号 __imp__PyDict_New
if_python.obj : error LNK2001: 无法解析的外部符号 __imp__PyObject_Init
if_python.obj : error LNK2001: 无法解析的外部符号 __imp__PyInt_FromLong
if_python.obj : error LNK2001: 无法解析的外部符号 __imp___PyArg_Parse_SizeT
if_python.obj : error LNK2001: 无法解析的外部符号 __imp__PyString_FromStringAndS
ize
if_python.obj : error LNK2001: 无法解析的外部符号 __imp__PyGILState_Release
if_python.obj : error LNK2001: 无法解析的外部符号 __imp__PyInt_AsLong
if_python.obj : error LNK2001: 无法解析的外部符号 __imp__Py_Initialize
if_python.obj : error LNK2001: 无法解析的外部符号 __imp__PyList_Size
if_python.obj : error LNK2001: 无法解析的外部符号 __imp__PyString_AsString
if_python.obj : error LNK2001: 无法解析的外部符号 __imp__PyErr_NoMemory
if_python.obj : error LNK2001: 无法解析的外部符号 __imp__PyExc_KeyboardInterrupt

if_python.obj : error LNK2001: 无法解析的外部符号 __imp__PySys_SetObject
if_python.obj : error LNK2001: 无法解析的外部符号 __imp__Py_IsInitialized
if_python.obj : error LNK2001: 无法解析的外部符号 __imp__PyExc_AttributeError
if_python.obj : error LNK2001: 无法解析的外部符号 __imp__PyEval_RestoreThread
if_python.obj : error LNK2001: 无法解析的外部符号 __imp__PyList_SetItem
if_python.obj : error LNK2001: 无法解析的外部符号 __imp__PyList_GetItem
if_python.obj : error LNK2001: 无法解析的外部符号 __imp__PyErr_SetNone
if_python.obj : error LNK2001: 无法解析的外部符号 __imp___PyArg_ParseTuple_SizeT

if_python.obj : error LNK2001: 无法解析的外部符号 __imp___Py_NoneStruct
if_python.obj : error LNK2001: 无法解析的外部符号 __imp__PyEval_SaveThread
if_python.obj : error LNK2001: 无法解析的外部符号 __imp__Py_FindMethod
if_python.obj : error LNK2001: 无法解析的外部符号 __imp__PyModule_GetDict
if_python.obj : error LNK2001: 无法解析的外部符号 __imp__PyExc_ValueError
if_python.obj : error LNK2001: 无法解析的外部符号 __imp__PyErr_Occurred
if_python.obj : error LNK2001: 无法解析的外部符号 __imp__PyDict_GetItemString
if_python.obj : error LNK2001: 无法解析的外部符号 __imp__PyObject_Malloc
if_python.obj : error LNK2001: 无法解析的外部符号 __imp__PyRun_SimpleStringFlags

if_python.obj : error LNK2001: 无法解析的外部符号 __imp__PyErr_BadArgument
if_python.obj : error LNK2001: 无法解析的外部符号 __imp__PyErr_SetString
if_python.obj : error LNK2001: 无法解析的外部符号 __imp___Py_BuildValue_SizeT
if_python.obj : error LNK2001: 无法解析的外部符号 __imp__PySys_SetArgv
if_python.obj : error LNK2001: 无法解析的外部符号 __imp__PyType_Type
if_python.obj : error LNK2001: 无法解析的外部符号 __imp__Py_Finalize
if_python.obj : error LNK2001: 无法解析的外部符号 __imp__PyErr_Clear
if_python.obj : error LNK2001: 无法解析的外部符号 __imp__PyString_Size
if_python.obj : error LNK2001: 无法解析的外部符号 __imp__PyEval_InitThreads
if_python.obj : error LNK2001: 无法解析的外部符号 __imp__PyList_New
if_python.obj : error LNK2001: 无法解析的外部符号 __imp__PyGILState_Ensure
if_python.obj : error LNK2001: 无法解析的外部符号 __imp__PyExc_TypeError
if_python.obj : error LNK2001: 无法解析的外部符号 __imp__PyDict_SetItemString
if_python.obj : error LNK2001: 无法解析的外部符号 __imp__PyExc_IndexError
if_python.obj : error LNK2001: 无法解析的外部符号 __imp__Py_InitModule4
if_python.obj : error LNK2001: 无法解析的外部符号 __imp__PyList_Append
gvim.exe : fatal error LNK1120: 46 个无法解析的外部命令

上网查到:http://translate.google.com.hk/translate?hl=zh-CN&sl=en&tl=zh-CN&u=http%3A%2F%2Fvim.1045645.n5.nabble.com%2FLink-Fails-for-183-td1196603.html&anno=2
(不能直接从Google搜出的链接上进入,网页快照也不行,要先点“翻译此页”,再“查看原文”,上面的链接就是这样得到的)

网上VIM之if_python.c最新源码网址:
http://code.google.com/p/vim/source/search?q=if_python&origq=if_python&btnG=Search+Trunk

编译:
msvc2010.bat

nmake -f Make_mvc.mak GUI=yes RUBY=F:\TDDOWNLOAD\ruby-1.9.3-p194 RUBY_VER=191 RUBY_VER_LONG=1.9.1 RUBY_PLATFORM=i386-mswin32_100 LUA=E:\Lua\5.1 PYTHON=E:\Python27 PYTHON_VER=27 DYNAMIC_PYTHON=yes OLE=yes MBYTE=yes IME=yes GIME=yes NIFF=yes CSCOPE=yes POSTSCRIPT=yes autocmd=yes balloon_eval=yes browse=yes builtin_terms=yes byte_offset=yes cindent=yes clientserver=yes clipboard=yes cmdline_compl=yes cmdline_hist=yes cmdline_info=yes comments=yes conceal=yes cryptv=yes cscope=yes cursorbind=yes cursorshape=yes dialog_con_gui=yes diff=yes digraphs=yes emacs_tags=yes eval=yes ex_extra=yes extra_search=yes farsi=yes file_in_path=yes find_in_path=yes float=yes folding=yes  insert_expand=yes jumplist=yes keymap=yes langmap=yes libcall=yes linebreak=yes lispindent=yes listcmds=yes localmap=yes menu=yes mksession=yes modify_fname=yes mouse=yes mouseshape=yes  multi_lang=yes netbeans_intg=yes ole=yes path_extra=yes persistent_undo=yes printer=yes   quickfix=yes reltime=yes rightleft=yes scrollbind=yes signs=yes smartindent=yes startuptime=yes statusline=yes syntax=yes tag_binary=yes tag_old_static=yes textobjects=yes title=yes toolbar=yes user_commands=yes vertsplit=yes virtualedit=yes visual=yes visualextra=yes viminfo=yes vreplace=yes wildignore=yes wildmenu=yes windows=yes writebackup=yes xpm_w32=yes


(本来是只想让VIM正常支持Ruby脚本即可,后来索性把lua和Python加上了。附件中是编译好的VIM和相关的dll,用它们替换官方安装包中的同名文件即可。为防止意外,请先备份原有文件)

猜你喜欢

转载自zxggmail.iteye.com/blog/1722279