swoole / ext-postgresql

🐘 Coroutine-based client for PostgreSQL
64 stars 21 forks source link

新版swoole下这个编译不通过 #34

Closed linjuchen closed 3 years ago

linjuchen commented 3 years ago

新版swoole下这个编译不通过,报了一堆错误

Yanghsuanming commented 3 years ago

無法編譯 環境: woole: 4.5.3 pgsql: 12.4

# 修改 vi swoole_postgresql_coro.h
#ifdef __linux__
#include "/usr/pgsql-12/include/libpq-fe.h"
#endif
/tmp/ext-postgresql-master/swoole_postgresql_coro.h:54:5: error: 'swTimer_node' does not name a type
     swTimer_node *timer;
     ^
/tmp/ext-postgresql-master/swoole_postgresql_coro.cc:72:5: error: 'php_coro_context' does not name a type
     php_coro_context context;
     ^
/tmp/ext-postgresql-master/swoole_postgresql_coro.cc:84:18: error: 'php_coro_context' does not name a type
 static sw_inline php_coro_context *php_swoole_postgresql_coro_get_context(zval *zobject) {
                  ^
/tmp/ext-postgresql-master/swoole_postgresql_coro.cc:142:57: error: 'swTimer_node' has not been declared
 static void swoole_pgsql_coro_onTimeout(swTimer *timer, swTimer_node *tnode);
                                                         ^
/tmp/ext-postgresql-master/swoole_postgresql_coro.cc: In function 'void zim_swoole_postgresql_coro_connect(zend_execute_data*, zval*)':
/tmp/ext-postgresql-master/swoole_postgresql_coro.cc:328:5: error: 'php_coro_context' was not declared in this scope
     php_coro_context *context = php_swoole_postgresql_coro_get_context(ZEND_THIS);
     ^
/tmp/ext-postgresql-master/swoole_postgresql_coro.cc:328:23: error: 'context' was not declared in this scope
     php_coro_context *context = php_swoole_postgresql_coro_get_context(ZEND_THIS);
codercms commented 3 years ago

@Xuan-Goldenf @linjuchen Please try to build this extension from master branch with Swoole v4.5.4

Yanghsuanming commented 3 years ago

無法編譯 Env: swoole: 4.5.4 pgsql: 12.4

make && make install
/bin/sh /tmp/ext-postgresql-master/libtool --mode=link g++ -DPHP_ATOM_INC -I/tmp/ext-postgresql-master/include -I/tmp/ext-postgresql-master/main -I/tmp/ext-postgresql-master -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/tmp/ext-postgresql-master -I/tmp/ext-postgresql-master/include -I/usr/include/php/ext/swoole -I/usr/include/php/ext/swoole/include  -DHAVE_CONFIG_H  -Wall -pthread -g -O2  -lpthread  -o swoole_postgresql.la -export-dynamic -avoid-version -prefer-pic -module -rpath /tmp/ext-postgresql-master/modules  swoole_postgresql_coro.lo -lpq
libtool: link: g++  -fPIC -DPIC -shared -nostdlib /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/crti.o /usr/lib/gcc/x86_64-redhat-linux/4.8.5/crtbeginS.o  .libs/swoole_postgresql_coro.o   -lpthread -lpq -L/usr/lib/gcc/x86_64-redhat-linux/4.8.5 -L/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../.. -lstdc++ -lm -lc -lgcc_s /usr/lib/gcc/x86_64-redhat-linux/4.8.5/crtendS.o /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/crtn.o  -pthread -O2   -pthread -Wl,-soname -Wl,swoole_postgresql.so -o .libs/swoole_postgresql.so
/usr/bin/ld: cannot find -lpq
collect2: error: ld returned 1 exit status
make: *** [swoole_postgresql.la] Error 1
Yanghsuanming commented 3 years ago

安裝libpq 已經成功編譯了

codercms commented 3 years ago

@Xuan-Goldenf good to know you have successfully compiled this extension