vim cannot be built in CentOS 7 due to " if_py_both.h:*: undefined reference to `PyUnicodeUCS4_AsEncodedString'"

1,197 views
Skip to first unread message

Marslo Jiao

unread,
Jan 6, 2016, 8:25:22 AM1/6/16
to vim_dev
vim source code from g...@github.com:vim/vim.git (configuration log has been attached):
===
$ git clone g...@github.com:vim/vim.git vimsrc
$ cd vimsrc
$ ./configure --prefix=$HOME/.marslo/myprograms/vim74 --enable-pythoninterp=yes --with-python-config-dir=/usr/local/lib/python2.7/config --enable-rubyinterp=yes --with-features=huge --disable-smack --with-compiledby=marslo@china
...
checking --enable-pythoninterp argument... yes
checking for python2... /usr/bin/python2
checking Python version... 2.7
checking Python is 2.3 or better... yep
checking Python's install prefix... /usr
checking Python's execution prefix... /usr
checking Python's configuration directory... (cached) /usr/local/lib/python2.7/config
checking if -pthread should be used... yes
checking if compile and link flags for Python are sane... yes
checking --enable-python3interp argument... no
checking if -fPIE can be added for Python... yes
...
configure: updating cache auto/config.cache
configure: creating auto/config.status
config.status: creating auto/config.mk
config.status: creating auto/config.h
$ make
...
gcc -c -I. -Iproto -DHAVE_CONFIG_H -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -I/usr/include/python2.7 -DPYTHON_HOME='"/usr"' -pthread -fPIE -o objects/if_python.o if_python.c
gcc -c -I. -Iproto -DHAVE_CONFIG_H -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -I/usr/include -I/usr/include -DRUBY_VERSION=20 -o objects/if_ruby.o if_ruby.c
...
gcc -c -I. -Iproto -DHAVE_CONFIG_H -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 version.c -o objects/version.o
link.sh: $LINK_AS_NEEDED set to 'yes': invoking linker directly.
gcc -L. -Wl,-z,relro -fstack-protector -rdynamic -Wl,-export-dynamic -L/usr/local/lib -Wl,--as-needed -o vim objects/buffer.o objects/blowfish.o objects/charset.o objects/crypt.o objects/crypt_zip.o objects/diff.o objects/digraph.o objects/edit.o objects/eval.o objects/ex_cmds.o objects/ex_cmds2.o objects/ex_docmd.o objects/ex_eval.o objects/ex_getln.o objects/fileio.o objects/fold.o objects/getchar.o objects/hardcopy.o objects/hashtab.o objects/if_cscope.o objects/if_xcmdsrv.o objects/mark.o objects/memline.o objects/menu.o objects/message.o objects/misc1.o objects/misc2.o objects/move.o objects/mbyte.o objects/normal.o objects/ops.o objects/option.o objects/os_unix.o objects/pathdef.o objects/popupmnu.o objects/quickfix.o objects/regexp.o objects/screen.o objects/search.o objects/sha256.o objects/spell.o objects/syntax.o objects/tag.o objects/term.o objects/ui.o objects/undo.o objects/version.o objects/window.o objects/if_python.o objects/if_ruby.o objects/netbeans.o objects/main.o objects/memfile.o -lm -ltinfo -lnsl -lselinux -ldl -L/usr/local/lib/python2.7/config -lpython2.7 -lpthread -ldl -lutil -lm -Xlinker -export-dynamic -lruby -lpthread -lrt -ldl -lcrypt -lm
objects/if_python.o: In function `StringToChars':
/home/marslo/.vim/vimsrc/src/if_py_both.h:136: undefined reference to `PyUnicodeUCS4_AsEncodedString'
objects/if_python.o: In function `StringToLine':
/home/marslo/.vim/vimsrc/src/if_py_both.h:3901: undefined reference to `PyUnicodeUCS4_AsEncodedString'
objects/if_python.o: In function `_ConvertFromPyObject':
/home/marslo/.vim/vimsrc/src/if_py_both.h:5921: undefined reference to `PyUnicodeUCS4_AsEncodedString'
collect2: error: ld returned 1 exit status
link.sh: Linking failed
make[1]: *** [vim] Error 1
make[1]: Leaving directory `/home/marslo/.vim/vimsrc/src'
make: *** [first] Error 2

===


Python version is 2.7.10. I install python 2.7.10 by manually:
===
$ wget https://www.python.org/ftp/python/2.7.10/Python-2.7.10.tar.xz
$ tar xf Python-2.7.10.tar.xz
$ cd Python-2.7.10
$ ./configure --prefix=/usr/local --enable-shared LDFLAGS="-Wl,-rpath /usr/local/lib"
$ make
$ sudo make altinstall
$ ln -s /usr/local/bin/python2.7 /usr/local/bin/python
$ logout
===


System information (auto/config.log. Has been attached)
===
$ auto/configure --prefix=/home/marslo/.marslo/myprograms/vim74 --enable-pythoninterp=yes --with-python-config-dir=/usr/local/lib/python2.7/config --enable-rubyinterp=yes --with-features=huge --disable-smack --with-compiledby=marslo@appliance --srcdir=. --cache-file=auto/config.cache

## --------- ##
## Platform. ##
## --------- ##

hostname = marslojiao
uname -m = x86_64
uname -r = 3.10.0-327.3.1.el7.x86_64
uname -s = Linux
uname -v = #1 SMP Wed Dec 9 14:09:15 UTC 2015

/usr/bin/uname -p = x86_64
/bin/uname -X = unknown

/bin/arch = x86_64
/usr/bin/arch -k = unknown
/usr/convex/getsysinfo = unknown
/usr/bin/hostinfo = unknown
/bin/machine = unknown
/usr/bin/oslevel = unknown
/bin/universe = unknown

PATH: /home/marslo/.marslo/myprograms/vim74/bin
PATH: /home/marslo/.marslo/myprograms/git/bin
PATH: /usr/local/bin
PATH: /usr/bin
PATH: /usr/local/sbin
PATH: /usr/sbin
PATH: /home/marslo/.local/bin
PATH: /home/marslo/bin
...
...
===

Other information:
===
$ ldd /usr/local/bin/python
linux-vdso.so.1 => (0x00007ffed118a000)
libpython2.7.so.1.0 => /usr/local/lib/libpython2.7.so.1.0 (0x00007fa310359000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fa310130000)
libdl.so.2 => /lib64/libdl.so.2 (0x00007fa30ff2c000)
libutil.so.1 => /lib64/libutil.so.1 (0x00007fa30fd29000)
libm.so.6 => /lib64/libm.so.6 (0x00007fa30fa26000)
libc.so.6 => /lib64/libc.so.6 (0x00007fa30f665000)
/lib64/ld-linux-x86-64.so.2 (0x00007fa310763000)
$ gcc --version
gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-4)
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
===
configuraion.log
auto_config.log

Marslo Jiao

unread,
Jan 6, 2016, 9:27:47 AM1/6/16
to vim_dev
Okay..
when I re-install python by using:
===
$ sudo make altlinstall
$ sudo make commoninstall
===

The vim compile works!
I checked the python Makefile, it shows:
===
commoninstall: \
altbininstall libinstall inclinstall libainstall \
sharedinstall oldsharedinstall altmaninstall \
===




Here the vim --version:
$ vim --version
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Jan 6 2016 22:01:28)
Included patches: 1-1054
Compiled by marslo@appliance
Huge version without GUI. Features included (+) or not (-):
...
+cryptv +linebreak +python +viminfo
+cscope +lispindent -python3 +vreplace
...
system vimrc file: "$VIM/vimrc"
user vimrc file: "$HOME/.vimrc"
2nd user vimrc file: "~/.vim/vimrc"
user exrc file: "$HOME/.exrc"
fall-back for $VIM: "/home/marslo/.marslo/myprograms/vim74/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: gcc -L. -Wl,-z,relro -fstack-protector -rdynamic -Wl,-export-dynamic -L/usr/local/lib -Wl,--as-needed -o vim -lm -ltinfo -lnsl -lselinux -ldl -L/usr/local/lib/python2.7/config -lpython2.7 -lpthread -ldl -lutil -lm -Xlinker -export-dynamic -lruby -lpthread -lrt -ldl -lcrypt -lm
===

:echo has('python') == 1
BUT, :python print 'abc' ==> E887: Sorry, this command is disabled, the Python's site module could not be loaded.

Marslo Jiao

unread,
Jan 6, 2016, 9:47:32 AM1/6/16
to vim_dev
Okay, from this(http://stackoverflow.com/a/32026366/2940319) answer, I've downgraded the python from 2.7.11 to 2.7.9. But the issue(E887) still there

Marslo Jiao

unread,
Jan 6, 2016, 10:04:17 AM1/6/16
to vim_dev


Vim is 64bit; python 2.7.9 is also 64bit:
===
$ file -L "$(command -v vim)"
/home/marslo/.marslo/myprograms/vim74/bin/vim: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, BuildID[sha1]=265c9e9eefa3d0bcebe49011e8115601ae6e85ad, stripped
$ file -L "$(command -v python)"
/usr/local/bin/python: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, BuildID[sha1]=cfef76ad27f2141552a72a0d9f6340f0421bdd5b, not stripped
$ python --version
Python 2.7.9
===

From this (https://groups.google.com/forum/#!msg/vim_dev/PkWFDWcg4iI/ymOA2QX1BQAJ) topic. They said the E887 is because of $PYTHONHOME. So I run command in vim:
:let $PYTHONHOME="/usr/local/"
:echo has('python')
1
:python print 'abc'


E887: Sorry, this command is disabled, the Python's site module could not be loaded.

What should I do?

Marslo Jiao

unread,
Jan 6, 2016, 11:30:49 AM1/6/16
to vim_dev


Well, here one thing looks odd, when compile python:
===


$ ./configure --prefix=/usr/local --enable-shared LDFLAGS="-Wl,-rpath /usr/local/lib"

...
checking for --with-cxx-main=<compiler>... no
checking for g++... no
configure: WARNING:

By default, distutils will build C++ extension modules with "g++".
If this is not intended, then set CXX on the configure command line.

checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /usr/bin/grep
...
$ rpm -qa | grep gcc-c++
gcc-c++-4.8.5-4.el7.x86_64
=====

Marslo Jiao

unread,
Jan 6, 2016, 10:05:43 PM1/6/16
to vim_dev
Can someone help me? Thanks in advanced.

Ken Takata

unread,
Jan 6, 2016, 11:09:31 PM1/6/16
to vim_dev
Hi Marslo,

2016/1/6 Wed 22:25:22 UTC+9 Marslo Jiao wrote:
> gcc -c -I. -Iproto -DHAVE_CONFIG_H -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -I/usr/include/python2.7 -DPYTHON_HOME='"/usr"' -pthread -fPIE -o objects/if_python.o if_python.c

Hm, it's strange that the preinstalled python header is used.
"-I/usr/include/python2.7" should be "-I/usr/local/include/python2.7", I think.
There might be a bug in our configure script?


> gcc -L. -Wl,-z,relro -fstack-protector -rdynamic -Wl,-export-dynamic -L/usr/local/lib -Wl,--as-needed -o vim objects/buffer.o objects/blowfish.o objects/charset.o objects/crypt.o objects/crypt_zip.o objects/diff.o objects/digraph.o objects/edit.o objects/eval.o objects/ex_cmds.o objects/ex_cmds2.o objects/ex_docmd.o objects/ex_eval.o objects/ex_getln.o objects/fileio.o objects/fold.o objects/getchar.o objects/hardcopy.o objects/hashtab.o objects/if_cscope.o objects/if_xcmdsrv.o objects/mark.o objects/memline.o objects/menu.o objects/message.o objects/misc1.o objects/misc2.o objects/move.o objects/mbyte.o objects/normal.o objects/ops.o objects/option.o objects/os_unix.o objects/pathdef.o objects/popupmnu.o objects/quickfix.o objects/regexp.o objects/screen.o objects/search.o objects/sha256.o objects/spell.o objects/syntax.o objects/tag.o objects/term.o objects/ui.o objects/undo.o objects/version.o objects/window.o objects/if_python.o objects/if_ruby.o objects/netbeans.o objects/main.o objects/memfile.o -lm -ltinfo -lnsl -lselinux -ldl -L/usr/local/lib/python2.7/config -lpython2.7 -lpthread -ldl -lutil -lm -Xlinker -export-dynamic -lruby -lpthread -lrt -ldl -lcrypt -lm

It seems that the python library is properly selected.
(-L/usr/local/lib/python2.7/config)


> objects/if_python.o: In function `StringToChars':
> /home/marslo/.vim/vimsrc/src/if_py_both.h:136: undefined reference to `PyUnicodeUCS4_AsEncodedString'

Vim uses PyUnicode_AsEncodedString() function, and it is replaced to
PyUnicodeUCS2_AsEncodedString or PyUnicodeUCS4_AsEncodedString depending on
a python configuration. The configuration can be found in pyconfig.h.
I think that the preinstalled python defines Py_UNICODE_SIZE as 4,
and your self-built python defines Py_UNICODE_SIZE as 2.

Maybe there is an option for the python's configure script that changes the
definition of Py_UNICODE_SIZE. Changing the size to 4 might be a workaround
for this, but we need to check the Vim's configure script.

Regards,
Ken Takata

Marslo Jiao

unread,
Jan 7, 2016, 3:40:38 AM1/7/16
to vim_dev
OH MY GOD!!!!!!! You are the best one I ever seen!!!!! It works!!!!!!!!!!!!!!!!!!

Okay, calm down.... Here what I did. Add --enable-unicode into python compile parameter:
===
./configure --prefix=/usr/local --enable-shared LDFLAGS="-Wl,-rpath /usr/local/lib" --enable-unicode=ucs4

Because of (in configure):
13302 case "$enable_unicode" in
13303 ucs2) unicode_size="2"
13304 $as_echo "#define Py_UNICODE_SIZE 2" >>confdefs.h
13305
13306 ;;
13307 ucs4) unicode_size="4"
13308 $as_echo "#define Py_UNICODE_SIZE 4" >>confdefs.h
13309
13310 ;;
13311 no) ;; # To allow --disable-unicode
13312 *) as_fn_error $? "invalid value for --enable-unicode. Use either ucs2 or ucs4 (lowercase)." "$LINENO" 5 ;;
13313 esac
===

Here the test:
===
$ python
Python 2.7.11 (default, Jan 7 2016, 16:08:28)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> if sys.maxunicode > 65535:
... print 'UCS4'
... else:
... print 'UCS2'
...
UCS4
>>> exit()

$ /usr/bin/python
Python 2.7.5 (default, Nov 20 2015, 02:00:19)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> if sys.maxunicode > 65535:
... print 'UCS4'
... else:
... print 'UCS2'
...
UCS4
>>> exit()


The preinstall (default) and newinstall (2.7.11) are all Py_UNICODE_SIZE == 2
===

Re-compile vim:
===
$ ./configure --prefix=$HOME/.marslo/myprograms/vim74 --enable-pythoninterp=yes --with-python-config-dir=/usr/local/lib/python2.7/config --enable-rubyinterp=yes --with-features=huge --disable-smack --enable-fail-if-missing --with-compiledby=marslo@appliance
$ make && make install


$ vim --version
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Jan 7 2016 16:19:17)
Included patches: 1-1054
Compiled by marslo@appliance
...
+cryptv +linebreak +python +viminfo
+cscope +lispindent -python3 +vreplace
...
system vimrc file: "$VIM/vimrc"
user vimrc file: "$HOME/.vimrc"
2nd user vimrc file: "~/.vim/vimrc"
user exrc file: "$HOME/.exrc"
fall-back for $VIM: "/home/marslo/.marslo/myprograms/vim74/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: gcc -L. -Wl,-z,relro -fstack-protector -rdynamic -Wl,-export-dynamic -L/usr/local/lib -Wl,--as-needed -o vim -lm -ltinfo -lnsl -lselinux -ldl -L/usr/local/lib/python2.7/config -lpython2.7 -lpthread -ldl -lutil -lm -Xlinker -export-dynamic -lruby -lpthread -lrt -ldl -lcrypt -lm

:python print 'test' ==> test
===
WORKS!!!!!!!!!!!!!!

Thanks very much, ken!!

Ken Takata

unread,
Jan 7, 2016, 6:18:30 AM1/7/16
to vim_dev
Hi Marslo,

2016/1/7 Thu 17:40:38 UTC+9 Marslo Jiao wrote:
> The preinstall (default) and newinstall (2.7.11) are all Py_UNICODE_SIZE == 2

Oh, really? I think it's very strange.
BTW, it's not so important.

The problem is why the Vim's configure script misdetected the python's header
directory. The configure script checks python2 command first, then python
command. If the preinstalled python has python2 command, and if your self-
built python doesn't have python2 command, the misdetection might occur.

Maybe we should use INCLUDEPY variable from <python-config-dir>/Makefile?

E.g.:

--- a/src/configure.in
+++ b/src/configure.in
@@ -1128,6 +1128,7 @@
@echo "python_LINKFORSHARED='$(LINKFORSHARED)'"
@echo "python_DLLLIBRARY='$(DLLLIBRARY)'"
@echo "python_INSTSONAME='$(INSTSONAME)'"
+ @echo "python_INCLUDEPY='$(INCLUDEPY)'"
@echo "python_PYTHONFRAMEWORK='$(PYTHONFRAMEWORK)'"
@echo "python_PYTHONFRAMEWORKPREFIX='$(PYTHONFRAMEWORKPREFIX)'"
@echo "python_PYTHONFRAMEWORKINSTALLDIR='$(PYTHONFRAMEWORKINSTALLDIR)'"
@@ -1182,9 +1183,9 @@

PYTHON_LIBS="${vi_cv_path_python_plibs}"
if test "${vi_cv_path_python_pfx}" = "${vi_cv_path_python_epfx}"; then
- PYTHON_CFLAGS="-I${vi_cv_path_python_pfx}/include/python${vi_cv_var_python_version} -DPYTHON_HOME='\"${vi_cv_path_python_pfx}\"'"
+ PYTHON_CFLAGS="-I${python_INCLUDEPY} -I${vi_cv_path_python_pfx}/include/python${vi_cv_var_python_version} -DPYTHON_HOME='\"${vi_cv_path_python_pfx}\"'"
else
- PYTHON_CFLAGS="-I${vi_cv_path_python_pfx}/include/python${vi_cv_var_python_version} -I${vi_cv_path_python_epfx}/include/python${vi_cv_var_python_version} -DPYTHON_HOME='\"${vi_cv_path_python_pfx}\"'"
+ PYTHON_CFLAGS="-I${python_INCLUDEPY} -I${vi_cv_path_python_pfx}/include/python${vi_cv_var_python_version} -I${vi_cv_path_python_epfx}/include/python${vi_cv_var_python_version} -DPYTHON_HOME='\"${vi_cv_path_python_pfx}\"'"
fi
PYTHON_SRC="if_python.c"
PYTHON_OBJ="objects/if_python.o"


Sorry, this patch is not tested at all.
(Maybe a similar patch for python3 is also needed.)


Regards,
Ken Takata

Marslo Jiao

unread,
Jan 13, 2016, 3:18:55 AM1/13/16
to vim_dev
Hi Ken,

Yes, of cause.
I'm using script to upgrade my vim version: https://github.com/Marslo/VimConfig/blob/master/Scripts/.upgrade_vim

And from the last vim-build.log, I found it find the correct python (/usr/local) after python was built by using --enable-unicode=ucs4 in configure, but use both '/usr' and '/usr/local' as PYTHON_HOME in make:
===
checking --enable-pythoninterp argument... yes
checking for python2... /usr/bin/python2
checking Python version... 2.7
checking Python is 2.3 or better... yep
checking Python's install prefix... /usr
checking Python's execution prefix... /usr
checking Python's configuration directory... (cached) /usr/local/lib/python2.7/config
...
checking if -fPIE can be added for Python... yes


make:
gcc -c -I. -Iproto -DHAVE_CONFIG_H -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -I/usr/include/python2.7 -DPYTHON_HOME='"/usr"' -pthread -fPIE -o objects/if_python.o if_python.c
...
link.sh: $LINK_AS_NEEDED set to 'yes': invoking linker directly.
gcc -L. -Wl,-z,relro -fstack-protector -rdynamic -Wl,-export-dynamic -L/usr/local/lib -Wl,--as-needed -o vim objects/buffer.o objects/blowfish.o objects/charset.o objects/crypt.o objects/crypt_zip.o objects/diff.o objects/digraph.o objects/edit.o objects/eval.o objects/ex_cmds.o objects/ex_cmds2.o objects/ex_docmd.o objects/ex_eval.o objects/ex_getln.o objects/fileio.o objects/fold.o objects/getchar.o objects/hardcopy.o objects/hashtab.o objects/if_cscope.o objects/if_xcmdsrv.o objects/mark.o objects/memline.o objects/menu.o objects/message.o objects/misc1.o objects/misc2.o objects/move.o objects/mbyte.o objects/normal.o objects/ops.o objects/option.o objects/os_unix.o objects/pathdef.o objects/popupmnu.o objects/quickfix.o objects/regexp.o objects/screen.o objects/search.o objects/sha256.o objects/spell.o objects/syntax.o objects/tag.o objects/term.o objects/ui.o objects/undo.o objects/version.o objects/window.o objects/if_python.o objects/if_ruby.o objects/netbeans.o objects/main.o objects/memfile.o -lm -ltinfo -lnsl -lselinux -ldl -L/usr/local/lib/python2.7/config -lpython2.7 -lpthread -ldl -lutil -lm -Xlinker -export-dynamic -lruby -lpthread -lrt -ldl -lcrypt -lm
link.sh: Linked fine
===

Log has been attached.
vim-build.log

Marslo Jiao

unread,
Aug 5, 2016, 11:42:06 PM8/5/16
to vim_dev
On Thursday, 7 January 2016 19:18:30 UTC+8, Ken Takata wrote:

Hi Ken Takata

Sorry for trouble you again. This error occurred again.

----------------------------
Error is:
The --with-python-config-dir=/usr/local/lib/python2.7/config has been set, but vim/Makefile still use the /usr as the PYTHON_HOME:

gcc -c -I. -Iproto -DHAVE_CONFIG_H -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -I/usr/include/python2.7 -DPYTHON_HOME='"/usr"' -pthread -fPIE -o objects/if_python.o if_python.c

if_python.c:67:20: fatal error: Python.h: No such file or directory
#include <Python.h>
^
compilation terminated.
make[1]: *** [objects/if_python.o] Error 1


make[1]: Leaving directory `/home/marslo/.vim/vimsrc/src'
make: *** [first] Error 2

----------------------

The following is the part of compiled log (full log has been attached. nohup.out):


...
checking --enable-pythoninterp argument... yes

checking for python2... (cached) /bin/python2
checking Python version... (cached) 2.7


checking Python is 2.3 or better... yep

checking Python's install prefix... (cached) /usr
checking Python's execution prefix... (cached) /usr
(cached) checking Python's configuration directory... (cached) /usr/local/lib/python2.7/config
(cached) checking Python's dll name... (cached) libpython2.7.so.1.0


checking if -pthread should be used... yes
checking if compile and link flags for Python are sane... yes

...


----------------------


System: Red Hat Enterprise Linux Server 7.2

Python: 2.7.12
Python was built by:
./configure --prefix=/usr/local --enable-shared LDFLAGS="-Wl,-rpath /usr/local/lib" --enable-unicode=ucs4 --with-cxx-main=g++
make && make altinstall
ln -s /usr/local/bin/python2.7 /usr/local/bin/python

nohup.out

Ken Takata

unread,
Aug 6, 2016, 12:12:54 AM8/6/16
to vim_dev
Hi,

Did you apply the patch for checking INCLUDEPY?
https://groups.google.com/d/msg/vim_dev/e88fjqTyfCQ/imxf0v9oAwAJ

Note that need to run "make autoconf" after patching src/configure.in.

Regards,
Ken Takata

Marslo Jiao

unread,
Aug 6, 2016, 12:15:24 AM8/6/16
to vim_dev

Hi Ken,

I'm using the latest vim source code from github. the version is 7.4.2161. Do I still need apply patches?
Thanks.

BRs. Marslo

Ken Takata

unread,
Aug 6, 2016, 12:22:14 AM8/6/16
to vim_dev
Hi,

The patch is not included, because no one tested it.
(And I have totally forgotten about the patch.)

Regards,
Ken Takata

Marslo Jiao

unread,
Aug 6, 2016, 12:27:49 AM8/6/16
to vim_dev

Hahaha.... Okay...
Let me have a try, anything update will let you know.

Thanks.

BRs. Marslo

Marslo Jiao

unread,
Aug 6, 2016, 1:29:22 AM8/6/16
to vim_dev
On Saturday, 6 August 2016 12:22:14 UTC+8, Ken Takata wrote:
> Hi,
>

Hi Ken,

Well.... the issue has been fixed somehow. I think the issue happened in Python compile, but not in vim compile.
I'm using "# make install altinstall" instead of "# make altinstall", and reboot, and the vim built works!!

configure shows:
...
checking for python2... (cached) /usr/local/bin/python2


checking Python version... (cached) 2.7
checking Python is 2.3 or better... yep

checking Python's install prefix... (cached) /usr/local
checking Python's execution prefix... (cached) /usr/local


(cached) checking Python's configuration directory... (cached) /usr/local/lib/python2.7/config
(cached) checking Python's dll name... (cached) libpython2.7.so.1.0

...


The build can be succeed, but python still cannot works in vim:
:python print 'abc'

E887: Sorry, this command is disabled, the Python's site module could not be loaded.

Press ENTER or type command to continue

Marslo Jiao

unread,
Aug 6, 2016, 1:44:18 AM8/6/16
to vim_dev
On Saturday, 6 August 2016 12:22:14 UTC+8, Ken Takata wrote:
> Hi,
>

Here what I did:

$ git diff *
diff --git a/src/configure.in b/src/configure.in
index 504aca6..2da7a6a 100644
--- a/src/configure.in
+++ b/src/configure.in
@@ -1186,6 +1186,7 @@ __:


@echo "python_LINKFORSHARED='$(LINKFORSHARED)'"
@echo "python_DLLLIBRARY='$(DLLLIBRARY)'"
@echo "python_INSTSONAME='$(INSTSONAME)'"
+ @echo "python_INCLUDEPY='$(INCLUDEPY)'"
@echo "python_PYTHONFRAMEWORK='$(PYTHONFRAMEWORK)'"
@echo "python_PYTHONFRAMEWORKPREFIX='$(PYTHONFRAMEWORKPREFIX)'"
@echo "python_PYTHONFRAMEWORKINSTALLDIR='$(PYTHONFRAMEWORKINSTALLDIR)'"

@@ -1240,9 +1241,9 @@ eof

PYTHON_LIBS="${vi_cv_path_python_plibs}"
if test "${vi_cv_path_python_pfx}" = "${vi_cv_path_python_epfx}"; then
- PYTHON_CFLAGS="-I${vi_cv_path_python_pfx}/include/python${vi_cv_var_python_version} -DPYTHON_HOME='\"${vi_cv_path_python_pfx}\"'"
+ PYTHON_CFLAGS="-I${python_INCLUDEPY} -I${vi_cv_path_python_pfx}/include/python${vi_cv_var_python_version} -DPYTHON_HOME='\"${vi_cv_path_python_pfx}\"'"
else
- PYTHON_CFLAGS="-I${vi_cv_path_python_pfx}/include/python${vi_cv_var_python_version} -I${vi_cv_path_python_epfx}/include/python${vi_cv_var_python_version} -DPYTHON_HOME='\"${vi_cv_path_python_pfx}\"'"
+ PYTHON_CFLAGS="-I${python_INCLUDEPY} -I${vi_cv_path_python_pfx}/include/python${vi_cv_var_python_version} -I${vi_cv_path_python_epfx}/include/python${vi_cv_var_python_version} -DPYTHON_HOME='\"${vi_cv_path_python_pfx}\"'"
fi
PYTHON_SRC="if_python.c"
PYTHON_OBJ="objects/if_python.o"


$ make autoconf
make: *** No rule to make target `autoconf'. Stop.

$ cd src/

$ make autoconf
if test ! -f configure.save; then mv configure configure.save; fi
autoconf
sed -e 's+>config.log+>auto/config.log+' -e 's+\./config.log+auto/config.log+' configure > auto/configure
chmod 755 auto/configure
mv -f configure.save configure
rm -rf autom4te.cache
rm -f auto/config.status auto/config.cache

$ cd ..

$ ./configure --prefix=$HOME/.marslo/myprograms/vim74 --enable-pythoninterp=yes --with-python-config-dir=/usr/local/lib/python2.7/config --with-features=huge --disable-smack --enable-fail-if-missing --with-compiledby=marslo@China
...
checking for python2... /usr/local/bin/python2
checking Python version... 2.7


checking Python is 2.3 or better... yep

checking Python's install prefix... /usr/local
checking Python's execution prefix... /usr/local


checking Python's configuration directory... (cached) /usr/local/lib/python2.7/config

/home/marslo/.vim/vimsrc/src/config-PyMake2206:1542: *** missing separator. Stop.


checking Python's dll name...

...

Reply all
Reply to author
Forward
0 new messages