On Thursday, 7 January 2016 12:09:31 UTC+8, Ken Takata wrote:
> 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
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!!
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.