swoole / ext-postgresql

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

Make issue. Please help! #67

Closed volodymyr-hordiienko closed 2 years ago

volodymyr-hordiienko commented 2 years ago

php 8.0.11 MacOS Swoole 4.6.1

Try to install ext-postgresql v4.6.1

vladimirgordienko@MBP-Vladimir ext-postgresql-4.6.1 % make
/bin/sh /Users/vladimirgordienko/Desktop/ext-postgresql-4.6.1/libtool --mode=compile g++ -I. -I/Users/vladimirgordienko/Desktop/ext-postgresql-4.6.1 -I/Users/vladimirgordienko/Desktop/ext-postgresql-4.6.1/include -I/Users/vladimirgordienko/Desktop/ext-postgresql-4.6.1/main -I/Users/vladimirgordienko/Desktop/ext-postgresql-4.6.1 -I/usr/local/Cellar/php/8.0.11/include/php -I/usr/local/Cellar/php/8.0.11/include/php/main -I/usr/local/Cellar/php/8.0.11/include/php/TSRM -I/usr/local/Cellar/php/8.0.11/include/php/Zend -I/usr/local/Cellar/php/8.0.11/include/php/ext -I/usr/local/Cellar/php/8.0.11/include/php/ext/date/lib -I/Users/vladimirgordienko/Desktop/ext-postgresql-4.6.1 -I/Users/vladimirgordienko/Desktop/ext-postgresql-4.6.1/include -I/usr/local/Cellar/php/8.0.11/include/php/ext/swoole -I/usr/local/Cellar/php/8.0.11/include/php/ext/swoole/include -I/usr/local/opt/postgresql@13/include -I/usr/local/opt/openssl@3/include -DHAVE_CONFIG_H -g -O2 -Wall -Wno-unused-function -Wno-deprecated -Wno-deprecated-declarations -std=c++11 -c /Users/vladimirgordienko/Desktop/ext-postgresql-4.6.1/swoole_postgresql_coro.cc -o swoole_postgresql_coro.lo mkdir .libs g++ -I. -I/Users/vladimirgordienko/Desktop/ext-postgresql-4.6.1 -I/Users/vladimirgordienko/Desktop/ext-postgresql-4.6.1/include -I/Users/vladimirgordienko/Desktop/ext-postgresql-4.6.1/main -I/Users/vladimirgordienko/Desktop/ext-postgresql-4.6.1 -I/usr/local/Cellar/php/8.0.11/include/php -I/usr/local/Cellar/php/8.0.11/include/php/main -I/usr/local/Cellar/php/8.0.11/include/php/TSRM -I/usr/local/Cellar/php/8.0.11/include/php/Zend -I/usr/local/Cellar/php/8.0.11/include/php/ext -I/usr/local/Cellar/php/8.0.11/include/php/ext/date/lib -I/Users/vladimirgordienko/Desktop/ext-postgresql-4.6.1 -I/Users/vladimirgordienko/Desktop/ext-postgresql-4.6.1/include -I/usr/local/Cellar/php/8.0.11/include/php/ext/swoole -I/usr/local/Cellar/php/8.0.11/include/php/ext/swoole/include -I/usr/local/opt/postgresql@13/include -I/usr/local/opt/openssl@3/include -DHAVE_CONFIG_H -g -O2 -Wall -Wno-unused-function -Wno-deprecated -Wno-deprecated-declarations -std=c++11 -c /Users/vladimirgordienko/Desktop/ext-postgresql-4.6.1/swoole_postgresql_coro.cc -fno-common -DPIC -o .libs/swoole_postgresql_coro.o In file included from /Users/vladimirgordienko/Desktop/ext-postgresql-4.6.1/swoole_postgresql_coro.cc:17: In file included from ./swoole_postgresql_coro.h:20: In file included from /usr/local/Cellar/php/8.0.11/include/php/ext/swoole/ext-src/php_swoole_cxx.h:19: /usr/local/Cellar/php/8.0.11/include/php/ext/swoole/ext-src/php_swoole_private.h:25:10: fatal error: 'php_swoole.h' file not found

include "php_swoole.h"

     ^~~~~~~~~~~~~~

1 error generated. make: *** [swoole_postgresql_coro.lo] Error 1

sy-records commented 2 years ago

Use v4.7.0+ version

volodymyr-hordiienko commented 2 years ago

I have tried swoole 4.7.0 and ext-postgresql 4.7.0 and got:

vladimirgordienko@MBP-Vladimir ext-postgresql-4.7.0 % make
/bin/sh /Users/vladimirgordienko/Desktop/ext-postgresql-4.7.0/libtool --mode=compile g++ -I. -I/Users/vladimirgordienko/Desktop/ext-postgresql-4.7.0 -I/Users/vladimirgordienko/Desktop/ext-postgresql-4.7.0/include -I/Users/vladimirgordienko/Desktop/ext-postgresql-4.7.0/main -I/Users/vladimirgordienko/Desktop/ext-postgresql-4.7.0 -I/usr/local/Cellar/php/8.0.11/include/php -I/usr/local/Cellar/php/8.0.11/include/php/main -I/usr/local/Cellar/php/8.0.11/include/php/TSRM -I/usr/local/Cellar/php/8.0.11/include/php/Zend -I/usr/local/Cellar/php/8.0.11/include/php/ext -I/usr/local/Cellar/php/8.0.11/include/php/ext/date/lib -I/Users/vladimirgordienko/Desktop/ext-postgresql-4.7.0 -I/Users/vladimirgordienko/Desktop/ext-postgresql-4.7.0/include -I/usr/local/Cellar/php/8.0.11/include/php/ext/swoole -I/usr/local/Cellar/php/8.0.11/include/php/ext/swoole/include -I/usr/local/opt/postgresql@13/include -I/usr/local/opt/openssl@3/include -DHAVE_CONFIG_H -g -O2 -Wall -Wno-unused-function -Wno-deprecated -Wno-deprecated-declarations -std=c++11 -c /Users/vladimirgordienko/Desktop/ext-postgresql-4.7.0/swoole_postgresql_coro.cc -o swoole_postgresql_coro.lo mkdir .libs g++ -I. -I/Users/vladimirgordienko/Desktop/ext-postgresql-4.7.0 -I/Users/vladimirgordienko/Desktop/ext-postgresql-4.7.0/include -I/Users/vladimirgordienko/Desktop/ext-postgresql-4.7.0/main -I/Users/vladimirgordienko/Desktop/ext-postgresql-4.7.0 -I/usr/local/Cellar/php/8.0.11/include/php -I/usr/local/Cellar/php/8.0.11/include/php/main -I/usr/local/Cellar/php/8.0.11/include/php/TSRM -I/usr/local/Cellar/php/8.0.11/include/php/Zend -I/usr/local/Cellar/php/8.0.11/include/php/ext -I/usr/local/Cellar/php/8.0.11/include/php/ext/date/lib -I/Users/vladimirgordienko/Desktop/ext-postgresql-4.7.0 -I/Users/vladimirgordienko/Desktop/ext-postgresql-4.7.0/include -I/usr/local/Cellar/php/8.0.11/include/php/ext/swoole -I/usr/local/Cellar/php/8.0.11/include/php/ext/swoole/include -I/usr/local/opt/postgresql@13/include -I/usr/local/opt/openssl@3/include -DHAVE_CONFIG_H -g -O2 -Wall -Wno-unused-function -Wno-deprecated -Wno-deprecated-declarations -std=c++11 -c /Users/vladimirgordienko/Desktop/ext-postgresql-4.7.0/swoole_postgresql_coro.cc -fno-common -DPIC -o .libs/swoole_postgresql_coro.o /bin/sh /Users/vladimirgordienko/Desktop/ext-postgresql-4.7.0/libtool --mode=link g++ -shared -I/Users/vladimirgordienko/Desktop/ext-postgresql-4.7.0/include -I/Users/vladimirgordienko/Desktop/ext-postgresql-4.7.0/main -I/Users/vladimirgordienko/Desktop/ext-postgresql-4.7.0 -I/usr/local/Cellar/php/8.0.11/include/php -I/usr/local/Cellar/php/8.0.11/include/php/main -I/usr/local/Cellar/php/8.0.11/include/php/TSRM -I/usr/local/Cellar/php/8.0.11/include/php/Zend -I/usr/local/Cellar/php/8.0.11/include/php/ext -I/usr/local/Cellar/php/8.0.11/include/php/ext/date/lib -I/Users/vladimirgordienko/Desktop/ext-postgresql-4.7.0 -I/Users/vladimirgordienko/Desktop/ext-postgresql-4.7.0/include -I/usr/local/Cellar/php/8.0.11/include/php/ext/swoole -I/usr/local/Cellar/php/8.0.11/include/php/ext/swoole/include -I/usr/local/opt/postgresql@13/include -I/usr/local/opt/openssl@3/include -DHAVE_CONFIG_H -Wall -pthread -g -O2 -std=gnu89 -L/usr/local/opt/postgresql@13/lib -L/usr/local/opt/openssl@3/lib -lpthread -o swoole_postgresql.la -export-dynamic -avoid-version -prefer-pic -module -rpath /Users/vladimirgordienko/Desktop/ext-postgresql-4.7.0/modules swoole_postgresql_coro.lo -lpq -lpthread g++ ${wl}-flat_namespace ${wl}-undefined ${wl}suppress -o .libs/swoole_postgresql.so -bundle .libs/swoole_postgresql_coro.o -L/usr/local/opt/postgresql@13/lib -L/usr/local/opt/openssl@3/lib -lpq -lpthread -pthread ld: illegal thread local variable reference to regular symbol _SwooleTG for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) make: *** [swoole_postgresql.la] Error 1

Actually i have tried many different combinations and different errors appears. related to missed types or missed libraries. I will appreciate any help

volodymyr-hordiienko commented 2 years ago

Any advice? :)

deminy commented 2 years ago

There was a new version of this project (4.8.0) tagged few hours ago. It works with Swoole 4.8.0.

Here is the Dockerfile I used to test the new release:

FROM phpswoole/swoole:4.8-php7.4

RUN \
    apt-get update && \
    apt-get install -y libpq-dev && \
    curl -sfL https://github.com/swoole/ext-postgresql/archive/refs/tags/v4.8.0.tar.gz -o swoole_postgresql.tar.gz && \
    mkdir swoole_postgresql && \
    tar xfz swoole_postgresql.tar.gz --strip-components=1 -C swoole_postgresql && \
    cd swoole_postgresql && \
    phpize && \
    ./configure && \
    make -j$(nproc) && \
    make install && \
    make clean && \
    cd .. && \
    rm -rf swoole_postgresql swoole_postgresql.tar.gz && \
    echo "extension=swoole_postgresql.so" > /usr/local/etc/php/conf.d/swoole_postgresql.ini && \
    rm -r /var/lib/apt/lists/*

To build a Docker image and check the swoole_postgresql extension:

docker build -t swoole_postgresql .
docker run --rm -ti swoole_postgresql php --ri swoole_postgresql

And here is the output:

swoole_postgresql

Swoole PostgreSQL => enabled
Author => Swoole Team <team@swoole.com>
Version => 4.8.0
Built => Oct 15 2021 16:36:09
trace_log => enabled

Regards.

volodymyr-hordiienko commented 2 years ago

A lot of thanks for you, good man! I will try solution as soon as i will be with my laptop. Cant wait to use swoole on my project with postgres :)