On Monday, June 10, 2013 12:55:16 PM UTC+2, Bram Moolenaar wrote:
> On my work system I ran into problems when trying to build with both
> 
> Python 2 and 3.
> 
> 
> 
> The first error is:
> 
> 
> 
> vim/src/if_python3.c:87: warning: "PyString_Check" redefined [enabled by 
> default]
> 
>  926 /usr/include/python2.7/stringobject.h:58: note: this is the location of 
> the previous definition
> 
> 
> 
> I didn't see this error on my home system.  I wonder if there is
> 
> something wrong with the configure stuff.  config.log:
> 
> 
> 
> configure:5221: checking --enable-pythoninterp argument
> 
> configure:5230: result: yes
> 
> configure:5237: checking for python2
> 
> configure:5255: found /usr/bin/python2
> 
> configure:5267: result: /usr/bin/python2
> 
> configure:5280: checking Python version
> 
> configure:5289: result: 2.7
> 
> configure:5292: checking Python is 2.2 or better
> 
> configure:5297: result: yep
> 
> configure:5300: checking Python's install prefix
> 
> configure:5309: result: /usr
> 
> configure:5312: checking Python's execution prefix
> 
> configure:5321: result: /usr
> 
> configure:5343: checking Python's configuration directory
> 
> configure:5365: result: /usr/lib/python2.7/config
> 
> configure:5424: checking if -pthread should be used
> 
> configure:5451: gcc -o conftest -O2 -fno-strength-reduce -Wall -pthread
> 
> -I/usr/local/include  -L/usr/local/lib conftest.c   >&5
> 
> configure:5451: $? = 0
> 
> configure:5452: result: yes
> 
> configure:5467: checking if compile and link flags for Python are sane
> 
> configure:5484: gcc -o conftest -O2 -fno-strength-reduce -Wall
> 
> -I/usr/include/python2.7 -DPYTHON_HOME=\"/usr\" -pthread
> 
> -I/usr/local/include  -L/usr/local/lib conftest.c
> 
> -L/usr/lib/python2.7/config -lpython2.7 -lpthread -ldl -lutil -lm
> 
> -Xlinker -export-dynamic -Wl,-O1 -Wl,-Bsymbolic-functions >&5
> 
> <command-line>:0:14: warning: missing terminating " character [enabled
> 
> by default]
> 
> configure:5484: $? = 0
> 
> configure:5485: result: yes
> 
> configure:5526: checking --enable-python3interp argument
> 
> configure:5535: result: yes
> 
> configure:5542: checking for python3
> 
> configure:5575: result: no
> 
> configure:5542: checking for python
> 
> configure:5560: found /usr/bin/python
> 
> configure:5572: result: /usr/bin/python
> 
> configure:5585: checking Python version
> 
> configure:5594: result: 2.7
> 
> configure:5597: checking Python's abiflags
> 
> configure:5611: result: 
> 
> configure:5614: checking Python's install prefix
> 
> configure:5623: result: /usr
> 
> configure:5626: checking Python's execution prefix
> 
> configure:5635: result: /usr
> 
> configure:5657: checking Python's configuration directory
> 
> configure:5683: result: /usr/lib/python2.7/config
> 
> configure:5729: checking if -pthread should be used
> 
> configure:5756: gcc -o conftest -O2 -fno-strength-reduce -Wall -pthread
> 
> -I/usr/local/include  -L/usr/local/lib conftest.c    >&5
> 
> configure:5756: $? = 0
> 
> configure:5757: result: yes
> 
> configure:5772: checking if compile and link flags for Python 3 are sane
> 
> 
> 
> Looks like Python 2.7 was not rejected when looking for Python 3.
> 
> Can we think of a proper check that the found Python actually is Python
> 
> 3?

We could do it the same way it is done with Python 2. Please, see the patch 
(vim 7.3.1163).

Also, though unrelated to this problem, older GCC compilers (version < 4) do 
not accept "-pthread" on Solaris, so to add support for multithreading using 
the POSIX threads library we need to use "-pthreads".

I added a fix for this as well.

-- 
-- 
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 vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


--- ../vim-orig/src/configure.in	Tue Jun 10 23:20:19 2013
+++ src/configure.in	Tue Jun 10 23:03:21 2013
@@ -986,6 +986,9 @@
 	    threadsafe_flag="-D_THREAD_SAFE"
 	    thread_lib="-pthread"
 	  fi
+	  if test "`(uname) 2>/dev/null`" = SunOS; then
+	    threadsafe_flag="-pthreads"
+	  fi
 	fi
 	libs_save_old=$LIBS
 	if test -n "$threadsafe_flag"; then
@@ -1058,6 +1061,13 @@
           ${vi_cv_path_python3} -c 'import sys; print(sys.version[:3])'`
     ]])
 
+    dnl -- it must be at least version 3
+    AC_MSG_CHECKING(Python is 3.0 or better)
+    if ${vi_cv_path_python3} -c \
+    "import sys; sys.exit(${vi_cv_var_python3_version} < 3.0)"
+    then
+      AC_MSG_RESULT(yep)
+
     dnl -- get abiflags for python 3.2 or higher (PEP 3149)
     AC_CACHE_CHECK(Python's abiflags,vi_cv_var_python3_abiflags,
     [
@@ -1176,6 +1186,9 @@
           threadsafe_flag="-D_THREAD_SAFE"
           thread_lib="-pthread"
         fi
+        if test "`(uname) 2>/dev/null`" = SunOS; then
+          threadsafe_flag="-pthreads"
+        fi
       fi
       libs_save_old=$LIBS
       if test -n "$threadsafe_flag"; then
@@ -1213,6 +1226,9 @@
         PYTHON3_CFLAGS=
       fi
     fi
+    else
+      AC_MSG_RESULT(too old; need Python version 3.0 or later)
+    fi
   fi
 fi
 

Raspunde prin e-mail lui