Skip to content

Conversation

franciscojr-dev
Copy link

@nikic
Copy link
Member

nikic commented Oct 12, 2020

Looks reasonable, but as usual we don't have testing for this. Out of interest, why are you building against the client library rather than using mysqlnd?

@franciscojr-dev
Copy link
Author

I made the pull request based on the path added to the bug. Didn't really have the test. I am looking to learn how to contribute to php-src. I hope to soon be able to meet all the criteria.

@cmb69 cmb69 added the Bug label Oct 27, 2020
@grooverdan
Copy link
Contributor

mysql.h includes mariadb_version.h which defines a lot of things defined by mysql_version.h.

I'd recheck the validity of the bug.

what I've done:

~/repos/mariadb-connector-c 3.2
$ cd -
/home/dan/repos/build-mariadb-connector-c

~/repos/build-mariadb-connector-c 
$ cmake -DCMAKE_INSTALL_PREFIX=/tmp/cc .
-- Configuring done
-- Generating done
-- Build files have been written to: /home/dan/repos/build-mariadb-connector-c

~/repos/build-mariadb-connector-c 
$ cmake --build .
[88/88] Linking C executable unittest/libmariadb/ps_bugs

~/repos/build-mariadb-connector-c 
$ cmake --install .
-- Install configuration: "RelWithDebInfo"
-- Installing: /tmp/cc/lib/mariadb/plugin/dialog.so
-- Installing: /tmp/cc/lib/mariadb/plugin/client_ed25519.so
-- Installing: /tmp/cc/lib/mariadb/plugin/caching_sha2_password.so
-- Installing: /tmp/cc/lib/mariadb/plugin/sha256_password.so
-- Installing: /tmp/cc/lib/mariadb/plugin/auth_gssapi_client.so
-- Installing: /tmp/cc/lib/mariadb/plugin/mysql_clear_password.so
-- Installing: /tmp/cc/lib/mariadb/plugin/remote_io.so
-- Installing: /tmp/cc/include/mariadb/mariadb_com.h
-- Installing: /tmp/cc/include/mariadb/mysql.h
-- Installing: /tmp/cc/include/mariadb/mariadb_stmt.h
-- Installing: /tmp/cc/include/mariadb/ma_pvio.h
-- Installing: /tmp/cc/include/mariadb/ma_tls.h
-- Installing: /tmp/cc/include/mariadb/mariadb_version.h
-- Installing: /tmp/cc/include/mariadb/ma_list.h
-- Installing: /tmp/cc/include/mariadb/errmsg.h
-- Installing: /tmp/cc/include/mariadb/mariadb_dyncol.h
-- Installing: /tmp/cc/include/mariadb/mariadb_ctype.h
-- Installing: /tmp/cc/include/mariadb/mariadb_rpl.h
-- Installing: /tmp/cc/include/mariadb/mysqld_error.h
-- Installing: /tmp/cc/include/mariadb/mysql/client_plugin.h
-- Installing: /tmp/cc/include/mariadb/mysql/plugin_auth_common.h
-- Installing: /tmp/cc/include/mariadb/mysql/plugin_auth.h
-- Installing: /tmp/cc/include/mariadb/mariadb/ma_io.h
-- Installing: /tmp/cc/lib/mariadb/libmariadbclient.a
-- Installing: /tmp/cc/lib/mariadb/libmariadb.so.3
-- Installing: /tmp/cc/lib/mariadb/libmariadb.so
-- Installing: /tmp/cc/bin/mariadb_config
-- Installing: /tmp/cc/lib/pkgconfig/libmariadb.pc

~/repos/build-mariadb-connector-c 
$ /tmp/cc/bin/mariadb_config --help
Copyright 2011-2020 MariaDB Corporation AB
Get compiler flags for using the MariaDB Connector/C.
Usage: mariadb_config [OPTIONS]
Compiler: Clang 10.0.1
  --cflags        [-I/tmp/cc/include/mariadb -I/tmp/cc/include/mariadb/mysql]
  --include       [-I/tmp/cc/include/mariadb -I/tmp/cc/include/mariadb/mysql]
  --libs          [-L/tmp/cc/lib/mariadb/ -lmariadb]
  --libs_r        [-L/tmp/cc/lib/mariadb/ -lmariadb]
  --libs_sys      [-ldl -lm -lpthread -lssl -lcrypto]
  --version       [10.5.5]
  --cc_version    [3.2.0]
  --socket        [/tmp/mysql.sock]
  --port          [3306]
  --plugindir     [/tmp/cc/lib/mariadb/plugin]
  --tlsinfo       [OpenSSL 1.1.1g]
  --variable=VAR  VAR is one of:
      pkgincludedir  [/tmp/cc/include/mariadb]
      pkglibdir      [/tmp/cc/lib/mariadb]
      pkgplugindir   [/tmp/cc/lib/mariadb/plugin]

In php (master branch) - configure patch:

diff --git a/ext/mysqli/config.m4 b/ext/mysqli/config.m4
index b57ce197a9..0243b1a343 100644
--- a/ext/mysqli/config.m4
+++ b/ext/mysqli/config.m4
@@ -47,7 +47,7 @@ if test "$PHP_MYSQLI" = "yes" || test "$PHP_MYSQLI" = "mysqlnd"; then
 elif test "$PHP_MYSQLI" != "no"; then
 
   MYSQL_CONFIG=$PHP_MYSQLI
-  MYSQL_LIB_NAME='mysqlclient'
+  MYSQL_LIB_NAME='mariadbclient'
   MYSQL_LIB_CFG='--libs'
 
   if test -x "$MYSQL_CONFIG" && $MYSQL_CONFIG $MYSQL_LIB_CFG > /dev/null 2>&1; then
diff --git a/ext/pdo_mysql/config.m4 b/ext/pdo_mysql/config.m4
index d8b9487723..dceb6504b3 100644
--- a/ext/pdo_mysql/config.m4
+++ b/ext/pdo_mysql/config.m4
@@ -58,7 +58,7 @@ if test "$PHP_PDO_MYSQL" != "no"; then
       if test "x$SED" = "x"; then
         AC_PATH_PROG(SED, sed)
       fi
-      PDO_MYSQL_LIBNAME=mysqlclient
+      PDO_MYSQL_LIBNAME=libmariadbclient
       PDO_MYSQL_LIBS=`$PDO_MYSQL_CONFIG --libs | $SED -e "s/'//g"`
       PDO_MYSQL_INCLUDE=`$PDO_MYSQL_CONFIG --cflags | $SED -e "s/'//g"`
     elif test -n "$PDO_MYSQL_DIR"; then
@@ -102,14 +102,6 @@ if test "$PHP_PDO_MYSQL" != "no"; then
           -L$PHP_ZLIB_DIR/$PHP_LIBDIR -L$PDO_MYSQL_LIB_DIR
         ])
         PDO_MYSQL_LIBS="$PDO_MYSQL_LIBS -L$PHP_ZLIB_DIR/$PHP_LIBDIR -lz"
-      else
-        PHP_ADD_LIBRARY(z,, PDO_MYSQL_SHARED_LIBADD)
-        PHP_CHECK_LIBRARY($PDO_MYSQL_LIBNAME, mysql_query, [], [
-          AC_MSG_ERROR([Try adding --with-zlib-dir=. Please check config.log for more information.])
-        ], [
-          -L$PDO_MYSQL_LIB_DIR
-        ])
-        PDO_MYSQL_LIBS="$PDO_MYSQL_LIBS -lz"
       fi
 
       PHP_EVAL_INCLINE($PDO_MYSQL_INCLUDE)

$ ./buildconf 

$ ./configure  --with-pdo-mysql=/tmp/cc --with-mysqli=/tmp/cc/bin/mariadb_config 
$ make -j 8

(completed compile for me)

So the configure needs as updating, to PKG_CONFIG would be my recommendation. But I think the old bug is no longer valid.

@cmb69
Copy link
Member

cmb69 commented Jan 7, 2021

What is the status here? PHP-7.3 is in security mode, and according to @grooverdan this is more a configuration issue.

@franciscojr-dev
Copy link
Author

Everything seems to have been solved in previous versions. I'll be closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants