Closed kocoten1992 closed 1 year ago
I'm not sure if swoole/ext-postgresql will work because it's archived. But for pgsql, it needs patches before ./configure
. And you also set "arg-type": "custom"
, then you need to create a class in src/SPC/builder/extension/
, with Attribute #[CustomExt('swoole_postgresql')]
. You can refer to the code of pgsql extension:
To put it simply, if all libraries that have been successfully compiled cannot be found in the PHP configure stage, most of them can be solved by replacing the parameters with files.
I dig deeper and I found this https://github.com/swoole/swoole-src/blob/b43bff854d00e77d25e4c5052ec27e3f8dda6fdd/.github/workflows/framework.yml#L34
I try to add --enable-swoole-pgsql
directly inside https://github.com/crazywhalecc/static-php-cli/blob/main/src/SPC/builder/extension/swoole.php, it seem to work, what is your thought about add that functionality --enable-swoole-pgsql
.
If you agree I'll craft a PR adding --enable-swoole-pgsql
, or let me know if you have a better way.
@kocoten1992 reference
https://wiki.swoole.com/#/coroutine_client/postgresql
https://github.com/crazywhalecc/static-php-cli/issues/86
https://github.com/crazywhalecc/static-php-cli/issues/86#issuecomment-1637335319
CPPFLAGS=$(pkg-config --cflags-only-I --static libpq)
LDFLAGS=$(pkg-config --libs-only-L --static libpq)
LIBS=$(pkg-config --libs-only-l --static libpq)
Just feel free to create PR, and I will check it locally and run some integration tests.
need add pkg-config
export_variables() {
# -all-static | -static | -static-libtool-libs
CPPFLAGS=""
CFLAGS=""
LDFLAGS="-static"
LDFLAGS=""
LIBS=""
CPPFLAGS="$CPPFLAGS -I/usr/local/swoole-cli/libiconv/include"
LDFLAGS="$LDFLAGS -L/usr/local/swoole-cli/libiconv/lib"
LIBS="$LIBS -liconv"
CPPFLAGS="$CPPFLAGS -I/usr/local/swoole-cli/bzip2/include"
LDFLAGS="$LDFLAGS -L/usr/local/swoole-cli/bzip2/lib"
LIBS="$LIBS -lbz2"
PACKAGES="libcrypto libssl openssl zlib libxml-2.0 libssh2 libpq icu-i18n icu-io icu-uc readline ncursesw libexslt libxslt libzstd liblz4 liblz4 liblzma"
CPPFLAGS="$CPPFLAGS $(pkg-config --cflags-only-I --static $PACKAGES ) "
LDFLAGS="$LDFLAGS $(pkg-config --libs-only-L --static $PACKAGES ) "
LIBS="$LIBS $(pkg-config --libs-only-l --static $PACKAGES ) -lstdc++"
export LIBPQ_CFLAGS="$(pkg-config --cflags --static libpq)"
export LIBPQ_LIBS="$(pkg-config --libs --static libpq)"
export CPPFLAGS="$CPPFLAGS"
export LDFLAGS="$LDFLAGS"
export LIBS="$LIBS"
}
or
Hi @crazywhalecc , I'm trying to install https://github.com/swoole/ext-postgresql, but I cannot pass this check:
I was trying to use Docker (alpine linux) to build static cli with
swoole_postgresql
extension:I already did this:
But cannot pass
libpq
check (I already install package as suggestion - but it does not work), do you have any idea?