在我之前的问题中,我描述了我们的情况:我们的开发人员将在 Windows 7 - 64 位的 cygwin 环境中使用 python,但是测试在构建期间以及在 linux 上自动执行。我们在使用 cygwin64 时遇到了一些问题,所以现在我们尝试在 cygwin32 上使用 python。
遗憾的是,在安装 psycopg2 期间,似乎同时使用 64 位和 32 位版本的 PostgreSQL 9.2 会导致 gcc 编译错误。32位版本安装日志:
$ pip 安装 psycopg2
...
下载/解压 psycopg2 下载 psycopg2-2.5.1.tar.gz (684kB):下载 684kB 运行 setup.py egg_info 以获取包 psycopg2
安装收集的包:psycopg2 为 psycopg2 运行 setup.py install 构建“psycopg2._psycopg”扩展 gcc -fno-strict-aliasing -ggdb -O2 -pipe -fdebug-prefix-map=/home/jt/rel/python-2.7。 3-1/python-2.7.3-1/build=/usr/src/debug/python-2.7.3-1 -fdebug-prefix-map=/home/jt/rel/python-2.7.3-1/ python-2.7.3-1/src/Python-2.7.3=/usr/src/debug/python-2.7.3-1 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION ="2.5.1 (dt dec pq3 ext)" -DPG_VERSION_HEX=0x090204 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/usr/include/python2.7 -I。-IC:/PROGRA~2/POSTGR~1/9.2/include -IC:/PROGRA~2/POSTGR~1/9.2/include/server -c psycopg/psycopgmodule.c -o build/temp.cygwin-1.7.24 -i686-2.7/psycopg/psycopgmodule.o
In file included from ./psycopg/config.h:120:0,
from ./psycopg/psycopg.h:33,
from psycopg/psycopgmodule.c:27:
C:/PROGRA~2/POSTGR~1/9.2/include/pthread.h:307:8: error: redefinition of ‘struct timespec’
In file included from /usr/include/stdio.h:47:0,
from /usr/include/python2.7/Python.h:33,
from ./psycopg/psycopg.h:30,
from psycopg/psycopgmodule.c:27:
/usr/include/sys/types.h:130:8: note: originally defined here
In file included from ./psycopg/config.h:120:0,
from ./psycopg/psycopg.h:33,
from psycopg/psycopgmodule.c:27:
C:/PROGRA~2/POSTGR~1/9.2/include/pthread.h:571:24: error: conflicting types for ‘pthread_t’
In file included from /usr/include/sys/types.h:473:0,
from /usr/include/stdio.h:47,
from /usr/include/python2.7/Python.h:33,
from ./psycopg/psycopg.h:30,
from psycopg/psycopgmodule.c:27:
/usr/include/cygwin/types.h:178:45: note: previous declaration of ‘pthread_t’ was here
In file included from ./psycopg/config.h:120:0,
from ./psycopg/psycopg.h:33,
from psycopg/psycopgmodule.c:27:
C:/PROGRA~2/POSTGR~1/9.2/include/pthread.h:572:34: error: conflicting types for ‘pthread_attr_t’
In file included from /usr/include/sys/types.h:473:0,
from /usr/include/stdio.h:47,
from /usr/include/python2.7/Python.h:33,
from ./psycopg/psycopg.h:30,
from psycopg/psycopgmodule.c:27:
/usr/include/cygwin/types.h:182:50: note: previous declaration of ‘pthread_attr_t’ was here
In file included from ./psycopg/config.h:120:0,
from ./psycopg/psycopg.h:33,
from psycopg/psycopgmodule.c:27:
C:/PROGRA~2/POSTGR~1/9.2/include/pthread.h:573:32: error: conflicting types for ‘pthread_once_t’
In file included from /usr/include/sys/types.h:473:0,
from /usr/include/stdio.h:47,
from /usr/include/python2.7/Python.h:33,
from ./psycopg/psycopg.h:30,
from psycopg/psycopgmodule.c:27:
/usr/include/cygwin/types.h:193:1: note: previous declaration of ‘pthread_once_t’ was here
In file included from ./psycopg/config.h:120:0,
from ./psycopg/psycopg.h:33,
from psycopg/psycopgmodule.c:27:
C:/PROGRA~2/POSTGR~1/9.2/include/pthread.h:574:33: error: conflicting types for ‘pthread_key_t’
In file included from /usr/include/sys/types.h:473:0,
from /usr/include/stdio.h:47,
from /usr/include/python2.7/Python.h:33,
from ./psycopg/psycopg.h:30,
from psycopg/psycopgmodule.c:27:
/usr/include/cygwin/types.h:181:49: note: previous declaration of ‘pthread_key_t’ was here
In file included from ./psycopg/config.h:120:0,
from ./psycopg/psycopg.h:33,
from psycopg/psycopgmodule.c:27:
C:/PROGRA~2/POSTGR~1/9.2/include/pthread.h:575:35: error: conflicting types for ‘pthread_mutex_t’
In file included from /usr/include/sys/types.h:473:0,
from /usr/include/stdio.h:47,
from /usr/include/python2.7/Python.h:33,
from ./psycopg/psycopg.h:30,
from psycopg/psycopgmodule.c:27:
/usr/include/cygwin/types.h:179:51: note: previous declaration of ‘pthread_mutex_t’ was here
In file included from ./psycopg/config.h:120:0,
from ./psycopg/psycopg.h:33,
from psycopg/psycopgmodule.c:27:
C:/PROGRA~2/POSTGR~1/9.2/include/pthread.h:576:39: error: conflicting types for ‘pthread_mutexattr_t’
In file included from /usr/include/sys/types.h:473:0,
from /usr/include/stdio.h:47,
from /usr/include/python2.7/Python.h:33,
from ./psycopg/psycopg.h:30,
from psycopg/psycopgmodule.c:27:
/usr/include/cygwin/types.h:183:55: note: previous declaration of ‘pthread_mutexattr_t’ was here
In file included from ./psycopg/config.h:120:0,
from ./psycopg/psycopg.h:33,
from psycopg/psycopgmodule.c:27:
C:/PROGRA~2/POSTGR~1/9.2/include/pthread.h:577:34: error: conflicting types for ‘pthread_cond_t’
In file included from /usr/include/sys/types.h:473:0,
from /usr/include/stdio.h:47,
from /usr/include/python2.7/Python.h:33,
from ./psycopg/psycopg.h:30,
from psycopg/psycopgmodule.c:27:
/usr/include/cygwin/types.h:185:50: note: previous declaration of ‘pthread_cond_t’ was here
In file included from ./psycopg/config.h:120:0,
from ./psycopg/psycopg.h:33,
from psycopg/psycopgmodule.c:27:
C:/PROGRA~2/POSTGR~1/9.2/include/pthread.h:578:38: error: conflicting types for ‘pthread_condattr_t’
In file included from /usr/include/sys/types.h:473:0,
from /usr/include/stdio.h:47,
from /usr/include/python2.7/Python.h:33,
from ./psycopg/psycopg.h:30,
from psycopg/psycopgmodule.c:27:
/usr/include/cygwin/types.h:184:54: note: previous declaration of ‘pthread_condattr_t’ was here
In file included from ./psycopg/config.h:120:0,
from ./psycopg/psycopg.h:33,
from psycopg/psycopgmodule.c:27:
C:/PROGRA~2/POSTGR~1/9.2/include/pthread.h:580:36: error: conflicting types for ‘pthread_rwlock_t’
In file included from /usr/include/sys/types.h:473:0,
from /usr/include/stdio.h:47,
from /usr/include/python2.7/Python.h:33,
from ./psycopg/psycopg.h:30,
from psycopg/psycopgmodule.c:27:
/usr/include/cygwin/types.h:195:52: note: previous declaration of ‘pthread_rwlock_t’ was here
In file included from ./psycopg/config.h:120:0,
from ./psycopg/psycopg.h:33,
from psycopg/psycopgmodule.c:27:
C:/PROGRA~2/POSTGR~1/9.2/include/pthread.h:581:40: error: conflicting types for ‘pthread_rwlockattr_t’
In file included from /usr/include/sys/types.h:473:0,
from /usr/include/stdio.h:47,
from /usr/include/python2.7/Python.h:33,
from ./psycopg/psycopg.h:30,
from psycopg/psycopgmodule.c:27:
/usr/include/cygwin/types.h:196:56: note: previous declaration of ‘pthread_rwlockattr_t’ was here
In file included from ./psycopg/config.h:120:0,
from ./psycopg/psycopg.h:33,
from psycopg/psycopgmodule.c:27:
C:/PROGRA~2/POSTGR~1/9.2/include/pthread.h:582:38: error: conflicting types for ‘pthread_spinlock_t’
In file included from /usr/include/sys/types.h:473:0,
from /usr/include/stdio.h:47,
from /usr/include/python2.7/Python.h:33,
from ./psycopg/psycopg.h:30,
from psycopg/psycopgmodule.c:27:
/usr/include/cygwin/types.h:194:54: note: previous declaration of ‘pthread_spinlock_t’ was here
In file included from ./psycopg/config.h:120:0,
from ./psycopg/psycopg.h:33,
from psycopg/psycopgmodule.c:27:
C:/PROGRA~2/POSTGR~1/9.2/include/pthread.h:1131:31: error: conflicting types for ‘pthread_kill’
In file included from /usr/include/signal.h:5:0,
from /usr/include/time.h:138,
from /usr/include/sys/select.h:24,
from /usr/include/cygwin/sys_time.h:13,
from /usr/include/sys/time.h:61,
from /usr/include/python2.7/pyport.h:319,
from /usr/include/python2.7/Python.h:58,
from ./psycopg/psycopg.h:30,
from psycopg/psycopgmodule.c:27:
/usr/include/sys/signal.h:170:5: note: previous declaration of ‘pthread_kill’ was here
error: command 'gcc' failed with exit status 1
...
C:/PROGRA~2/POSTGR~1/9.2/include/pthread.h:1131:31:错误:“pthread_kill”的类型冲突</p>
在 /usr/include/signal.h:5:0 包含的文件中,
from /usr/include/time.h:138,
from /usr/include/sys/select.h:24,
from /usr/include/cygwin/sys_time.h:13,
from /usr/include/sys/time.h:61,
from /usr/include/python2.7/pyport.h:319,
from /usr/include/python2.7/Python.h:58,
from ./psycopg/psycopg.h:30,
from psycopg/psycopgmodule.c:27:
/usr/include/sys/signal.h:170:5:注意:“pthread_kill”的先前声明在这里错误:命令“gcc”失败,退出状态为 1
...
我们安装了 cygwin 安装包附带的标准 Gcc 和 PostgreSQL 库。接下来做什么?
非常感谢您:Joe,公众