使用交叉编译链编译psycopg2: 已经做的准备工作: yum install postgresql-devel*
错误日志: (psycopg) [root@localhost openGauss-connector-python-psycopg2]# python setup.py build /root/anaconda3/lib/python3.8/site-packages/setuptools/config/setupcfg.py:508: SetuptoolsDeprecationWarning: The license_file parameter is deprecated, use license_files instead. warnings.warn(msg, warning_class) running build running build_py running build_ext extension: <setuptools.extension.Extension('psycopg2._psycopg') at 0x7fee247ca970> building 'psycopg2._psycopg' extension aarch64-kedacom-linux-gnu-gcc -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC "-DPSYCOPG_VERSION=2.9 (dt dec pq3 ext)" -DPSYCOPG_DEBUG=1 -DPG_VERSION_NUM=90204 -DPSYCOPG_DEBUG=1 -I/root/anaconda3/include/python3.8 -I. -I/usr/include -I/usr/include/pgsql/server -I/usr/include/libxml2 -c psycopg/adapter_asis.c -o build/temp.linux-x86_64-cpython-38/psycopg/adapter_asis.o -Wdeclaration-after-statement aarch64-kedacom-linux-gnu-gcc: WARNING: unsafe header/library path used in cross-compilation: '-I/usr/include' aarch64-kedacom-linux-gnu-gcc: WARNING: unsafe header/library path used in cross-compilation: '-I/usr/include/pgsql/server' aarch64-kedacom-linux-gnu-gcc: WARNING: unsafe header/library path used in cross-compilation: '-I/usr/include/libxml2' In file included from /usr/include/limits.h:124, from /root/anaconda3/include/python3.8/Python.h:11, from ./psycopg/psycopg.h:35, from psycopg/adapter_asis.c:28: /opt/aarch64-kedacom-linux/aarch64-kedacom-linux-gnu/sysroot/usr/include/limits.h:145:17: error: missing binary operator before token "(" #if __GLIBC_USE (IEC_60559_BFP_EXT) ^ In file included from /usr/include/inttypes.h:27, from /root/anaconda3/include/python3.8/pyport.h:6, from /root/anaconda3/include/python3.8/Python.h:63, from ./psycopg/psycopg.h:35, from psycopg/adapter_asis.c:28: /usr/include/stdint.h:148: warning: "__INT64_C" redefined # define __INT64_C(c) c ## LL
<built-in>: note: this is the location of the previous definition In file included from /usr/include/inttypes.h:27, from /root/anaconda3/include/python3.8/pyport.h:6, from /root/anaconda3/include/python3.8/Python.h:63, from ./psycopg/psycopg.h:35, from psycopg/adapter_asis.c:28: /usr/include/stdint.h:149: warning: "__UINT64_C" redefined # define __UINT64_C(c) c ## ULL
<built-in>: note: this is the location of the previous definition In file included from /root/anaconda3/include/python3.8/pythread.h:120, from /root/anaconda3/include/python3.8/pystate.h:10, from /root/anaconda3/include/python3.8/genobject.h:11, from /root/anaconda3/include/python3.8/Python.h:121, from ./psycopg/psycopg.h:35, from psycopg/adapter_asis.c:28: /usr/include/pthread.h:675:6: warning: ‘regparm’ attribute directive ignored [-Wattributes] __cleanup_fct_attribute; ^~~~~~~~~~~~~~~~~~~~~~~ /usr/include/pthread.h:687:3: warning: ‘regparm’ attribute directive ignored [-Wattributes] __cleanup_fct_attribute; ^~~~~~~~~~~~~~~~~~~~~~~ /usr/include/pthread.h:710:6: warning: ‘regparm’ attribute directive ignored [-Wattributes] __cleanup_fct_attribute; ^~~~~~~~~~~~~~~~~~~~~~~ /usr/include/pthread.h:723:3: warning: ‘regparm’ attribute directive ignored [-Wattributes] __cleanup_fct_attribute; ^~~~~~~~~~~~~~~~~~~~~~~ /usr/include/pthread.h:732:6: warning: ‘regparm’ attribute directive ignored [-Wattributes] ; ^ In file included from ./psycopg/psycopg.h:38, from psycopg/adapter_asis.c:28: psycopg/adapter_asis.c: In function ‘asis_setup’: ./psycopg/config.h:58:25: warning: format ‘%zd’ expects argument of type ‘signed size_t’, but argument 5 has type ‘Py_ssize_t’ {aka ‘int’} [-Wformat=] fprintf(stderr, "[%d] " fmt "\n", (int) getpid() , ## args) ^~~~~~~ psycopg/adapter_asis.c:104:5: note: in expansion of macro ‘Dprintf’ Dprintf("asis_setup: init asis object at %p, refcnt = " ^~~~~~~ In file included from ./psycopg/psycopg.h:39, from psycopg/adapter_asis.c:28: ./psycopg/python.h:45:54: note: format string is defined here #define FORMAT_CODE_PY_SSIZE_T "%" PY_FORMAT_SIZE_T "d" ~~~~~~~~~~~~~~~~~~~~~^ In file included from ./psycopg/psycopg.h:38, from psycopg/adapter_asis.c:28: ./psycopg/config.h:58:25: warning: format ‘%zd’ expects argument of type ‘signed size_t’, but argument 5 has type ‘Py_ssize_t’ {aka ‘int’} [-Wformat=] fprintf(stderr, "[%d] " fmt "\n", (int) getpid() , ## args) ^~~~~~~ psycopg/adapter_asis.c:112:5: note: in expansion of macro ‘Dprintf’ Dprintf("asis_setup: good asis object at %p, refcnt = " ^~~~~~~ In file included from ./psycopg/psycopg.h:39, from psycopg/adapter_asis.c:28: ./psycopg/python.h:45:54: note: format string is defined here #define FORMAT_CODE_PY_SSIZE_T "%" PY_FORMAT_SIZE_T "d" ~~~~~~~~~~~~~~~~~~~~~^ In file included from ./psycopg/psycopg.h:38, from psycopg/adapter_asis.c:28: psycopg/adapter_asis.c: In function ‘asis_dealloc’: ./psycopg/config.h:58:25: warning: format ‘%zd’ expects argument of type ‘signed size_t’, but argument 5 has type ‘Py_ssize_t’ {aka ‘int’} [-Wformat=] fprintf(stderr, "[%d] " fmt "\n", (int) getpid() , ## args) ^~~~~~~ psycopg/adapter_asis.c:126:5: note: in expansion of macro ‘Dprintf’ Dprintf("asis_dealloc: deleted asis object at %p, refcnt = " ^~~~~~~ In file included from ./psycopg/psycopg.h:39, from psycopg/adapter_asis.c:28: ./psycopg/python.h:45:54: note: format string is defined here #define FORMAT_CODE_PY_SSIZE_T "%" PY_FORMAT_SIZE_T "d" ~~~~~~~~~~~~~~~~~~~~~^
It appears you are missing some prerequisite to build the package from source.
You may install a binary package by installing 'psycopg2-binary' from PyPI. If you want to install psycopg2 from source, please install the packages required for the build and try again.
For further information please check the 'doc/src/install.rst' file (also at https://www.psycopg.org/docs/install.html).
error: command '/opt/aarch64-kedacom-linux/bin/aarch64-kedacom-linux-gnu-gcc' failed with exit code 1
看起来是还需要编译源码:psycopg(https://github.com/psycopg/psycopg.git%EF%BC%89 ?
chendan@kedacom.com