Skip to contentSkip to conversation

replace mysql with mariadb 10.0

RFC PATCH Superseded Ryan Coe 5 participants 15 messages Sep 12, 2016 – Sep 23, 2016

lore
Share & tools
lore

Ryan Coe

author
#0 lore raw

cover replace mysql with mariadb 10.0

This patch represents my attempt to replace the aging mysql 5.1 that is currently shipped with Buildroot. I am replacing mysql altogether with mariadb version 10.0. I have been able to test this with both an arm and a x86_64 build. I have not tested it with systemd. This patch is based on the work done by Sylvain Raybaud.

Ryan Coe (1):
mysql: replace mysql with mariadb 10.0

 package/Config.in                                  |    2 +-
 package/mysql/0000-ac_cache_check.patch            |  156 -
 package/mysql/0001-configure-ps-cache-check.patch  |   39 -
 package/mysql/0001-fix_xtradb_cmakelist.patch      |   38 +
 package/mysql/0002-use-new-readline-iface.patch    |   21 -
 .../mysql/0003-ac_stack_direction-is-unset.patch   |   15 -
 .../mysql/0004-Fix-gen_lex_hash-execution.patch    |   32 -
 .../0005-bison_3_breaks_mysql_server_build.patch   | 3310 --------------------
 package/mysql/0006-no-force-static-build.patch     |   18 -
 .../0007-dont-install-in-mysql-directory.patch     |  182 --
 package/mysql/Config.in                            |   17 +-
 package/mysql/S97mysqld                            |  102 +-
 package/mysql/my.cnf                               |  179 ++
 package/mysql/mysql.hash                           |    4 +-
 package/mysql/mysql.mk                             |  183 +-
 package/mysql/mysqld.service                       |    4 +-
 16 files changed, 392 insertions(+), 3910 deletions(-)
 delete mode 100644 package/mysql/0000-ac_cache_check.patch
 delete mode 100644 package/mysql/0001-configure-ps-cache-check.patch
 create mode 100644 package/mysql/0001-fix_xtradb_cmakelist.patch
 delete mode 100644 package/mysql/0002-use-new-readline-iface.patch
 delete mode 100644 package/mysql/0003-ac_stack_direction-is-unset.patch
 delete mode 100644 package/mysql/0004-Fix-gen_lex_hash-execution.patch
 delete mode 100644 package/mysql/0005-bison_3_breaks_mysql_server_build.patch
 delete mode 100644 package/mysql/0006-no-force-static-build.patch
 delete mode 100644 package/mysql/0007-dont-install-in-mysql-directory.patch
 create mode 100644 package/mysql/my.cnf
Signature · 1 line
2.9.3
author
#1 lore raw

RFC PATCH 1/1 mysql: replace mysql with mariadb 10.0

Replaces the old mysql 5.1 with mariadb 10.0. The package was not renamed as mariadb is a drop-in replacement for mysql.

Based on the work by Sylvain Raybaud <[email protected]>

https://patchwork.ozlabs.org/patch/538045/

---
 package/Config.in                                  |    2 +-
 package/mysql/0000-ac_cache_check.patch            |  156 -
 package/mysql/0001-configure-ps-cache-check.patch  |   39 -
 package/mysql/0001-fix_xtradb_cmakelist.patch      |   38 +
 package/mysql/0002-use-new-readline-iface.patch    |   21 -
 .../mysql/0003-ac_stack_direction-is-unset.patch   |   15 -
 .../mysql/0004-Fix-gen_lex_hash-execution.patch    |   32 -
 .../0005-bison_3_breaks_mysql_server_build.patch   | 3310 --------------------
 package/mysql/0006-no-force-static-build.patch     |   18 -
 .../0007-dont-install-in-mysql-directory.patch     |  182 --
 package/mysql/Config.in                            |   17 +-
 package/mysql/S97mysqld                            |  102 +-
 package/mysql/my.cnf                               |  179 ++
 package/mysql/mysql.hash                           |    4 +-
 package/mysql/mysql.mk                             |  183 +-
 package/mysql/mysqld.service                       |    4 +-
 16 files changed, 392 insertions(+), 3910 deletions(-)
 delete mode 100644 package/mysql/0000-ac_cache_check.patch
 delete mode 100644 package/mysql/0001-configure-ps-cache-check.patch
 create mode 100644 package/mysql/0001-fix_xtradb_cmakelist.patch
 delete mode 100644 package/mysql/0002-use-new-readline-iface.patch
 delete mode 100644 package/mysql/0003-ac_stack_direction-is-unset.patch
 delete mode 100644 package/mysql/0004-Fix-gen_lex_hash-execution.patch
 delete mode 100644 package/mysql/0005-bison_3_breaks_mysql_server_build.patch
 delete mode 100644 package/mysql/0006-no-force-static-build.patch
 delete mode 100644 package/mysql/0007-dont-install-in-mysql-directory.patch
 create mode 100644 package/mysql/my.cnf
package/Config.in +1 -1
index 332f05d..9fca1f6 100644
@@ -902,8 +902,8 @@ menu "Database"
 	source "package/kompexsqlite/Config.in"
 	source "package/leveldb/Config.in"
 	source "package/libpqxx/Config.in"
-	source "package/mongodb/Config.in"
 	source "package/mysql/Config.in"
+	source "package/mongodb/Config.in"
 	source "package/postgresql/Config.in"
 	source "package/redis/Config.in"
 	source "package/sqlcipher/Config.in"
package/mysql/0000-ac_cache_check.patch deleted +0 -156

156 lines not on this page · raw message

package/mysql/0001-configure-ps-cache-check.patch deleted +0 -39
deleted file mode 100644
index 336e80e..0000000
@@ -1,39 +0,0 @@
-Patch borrowed from
-http://cgit.openembedded.org/cgit.cgi/openembedded/tree/recipes/mysql/files/configure-ps-cache-check.patch
-
-It allows to specify through ac_cv_FIND_PROC how ps should be used on
-the target to find the PID of a program.
-
-Signed-off-by: Thomas Petazzoni <[email protected]>
-
----
- configure.in |    9 +++++----
- 1 file changed, 5 insertions(+), 4 deletions(-)
-
-Index: mysql-5.1.53/configure.in
-===================================================================
---- mysql-5.1.53.orig/configure.in
-+++ mysql-5.1.53/configure.in
-@@ -462,8 +462,8 @@
- # then Make, then shell.  The autoconf substitution uses single quotes, so 
- # no unprotected single quotes should appear in the expression.
- AC_PATH_PROG(PS, ps, ps)
--AC_MSG_CHECKING("how to check if pid exists")
--PS=$ac_cv_path_PS
-+AC_CACHE_CHECK([how to check if pid exists], [ac_cv_FIND_PROC],
-+[
- # Linux style
- if $PS wwwp $$ 2> /dev/null | grep -- "$0" > /dev/null
- then
-@@ -502,8 +502,9 @@
-       AC_MSG_ERROR([Could not find the right ps and/or grep switches. Which OS is this?  See the Installation chapter in the Reference Manual.])
-   esac
- fi
--AC_SUBST(FIND_PROC)
--AC_MSG_RESULT("$FIND_PROC")
-+ac_cv_FIND_PROC="$FIND_PROC"
-+])
-+AC_SUBST([FIND_PROC], [$ac_cv_FIND_PROC])
- 
- # Check if a pid is valid
- AC_PATH_PROG(KILL, kill, kill)
package/mysql/0001-fix_xtradb_cmakelist.patch new file +38 -0
new file mode 100644
index 0000000..cc76729
@@ -0,0 +1,38 @@
+From 165a75988181c92499df74d94250a89331c24654 Mon Sep 17 00:00:00 2001
+From: Ryan Coe <[email protected]>
+Date: Fri, 5 Aug 2016 20:49:38 -0700
+Subject: [PATCH 1/1] fix xtradb cmakelist.patch
+
+Signed-off-by: Ryan Coe <[email protected]>
+---
+ storage/xtradb/CMakeLists.txt | 16 +++++++++-------
+ 1 file changed, 9 insertions(+), 7 deletions(-)
+
+diff --git a/storage/xtradb/CMakeLists.txt b/storage/xtradb/CMakeLists.txt
+index 0c28775..9b453f3 100644
+--- a/storage/xtradb/CMakeLists.txt
++++ b/storage/xtradb/CMakeLists.txt
+@@ -484,12 +484,14 @@ IF(WITH_INNODB)
+   SET(WITH_INNOBASE_STORAGE_ENGINE TRUE)
+ ENDIF()
+
+-MYSQL_ADD_PLUGIN(xtradb ${INNOBASE_SOURCES} STORAGE_ENGINE
+-  DEFAULT
+-  RECOMPILE_FOR_EMBEDDED
+-  LINK_LIBRARIES ${ZLIB_LIBRARY} ${LINKER_SCRIPT})
+-
+-IF(TARGET xtradb AND NOT XTRADB_OK)
+-  MESSAGE(FATAL_ERROR "Percona XtraDB is not supported on this platform")
++IF(NOT WITHOUT_XTRADB)
++  MYSQL_ADD_PLUGIN(xtradb ${INNOBASE_SOURCES} STORAGE_ENGINE
++    DEFAULT
++    RECOMPILE_FOR_EMBEDDED
++    LINK_LIBRARIES ${ZLIB_LIBRARY} ${LINKER_SCRIPT})
++
++  IF(TARGET xtradb AND NOT XTRADB_OK)
++    MESSAGE(FATAL_ERROR "Percona XtraDB is not supported on this platform")
++  ENDIF()
+ ENDIF()
+
+--
+2.9.2
package/mysql/0002-use-new-readline-iface.patch deleted +0 -21
deleted file mode 100644
index c590656..0000000
@@ -1,21 +0,0 @@
-Tell MySQL to use the new readline interface even when an external
-readline is being used.
-
-Signed-off-by: Thomas Petazzoni <[email protected]>
-
----
- configure.in |    1 +
- 1 file changed, 1 insertion(+)
-
-Index: mysql-5.1.53/configure.in
-===================================================================
---- mysql-5.1.53.orig/configure.in
-+++ mysql-5.1.53/configure.in
-@@ -2689,6 +2689,7 @@
- 	    # this way we avoid linking commercial source with GPL readline
- 	    readline_link="-lreadline"
- 	    want_to_use_readline="yes"
-+	    AC_DEFINE_UNQUOTED(USE_NEW_READLINE_INTERFACE, 1)
- 	elif [test "$mysql_cv_libedit_interface" = "yes"]
- 	then
- 	    # Use libedit
package/mysql/0003-ac_stack_direction-is-unset.patch deleted +0 -15
deleted file mode 100644
index 6fef0a9..0000000
@@ -1,15 +0,0 @@
-misc.m4: ac_cv_c_stack_direction is unset.
-
-Signed-off-by: Marcelo Gutierrez (UTN/FRH) <[email protected]>
-
---- mysql-5.1.70.orig/config/ac-macros/misc.m4
-+++ mysql-5.1.70/config/ac-macros/misc.m4
-@@ -477,7 +477,7 @@
-     exit(ptr_f(&a) < 0);
-   }
-   ], ac_cv_c_stack_direction=1, ac_cv_c_stack_direction=-1,
--   ac_cv_c_stack_direction=)])
-+   ac_cv_c_stack_direction=0)])
-  AC_DEFINE_UNQUOTED(STACK_DIRECTION, $ac_cv_c_stack_direction)
- ])dnl
- 
package/mysql/0004-Fix-gen_lex_hash-execution.patch deleted +0 -32
deleted file mode 100644
index b91ed4f..0000000
@@ -1,32 +0,0 @@
-Makefile: fix cross-compiling the server
-
-MySQL Makefile believes it can run code it just compiled, to
-generate a header. This does not work for cross-compilation.
-
-Instead, use a pre-installed host-version of the required tool.
-
-Signed-off-by: Marcelo Gutierrez (UTN/FRH) <[email protected]>
-
---- mysql-5.1.70/sql/Makefile.am
-+++ mysql-5.1.70.patch/sql/Makefile.am
-@@ -177,7 +177,7 @@
- # this avoid the rebuild of the built files in a source dist
- lex_hash.h:	gen_lex_hash.cc lex.h
- 		$(MAKE) $(AM_MAKEFLAGS) gen_lex_hash$(EXEEXT)
--		./gen_lex_hash$(EXEEXT) > $@-t
-+		gen_lex_hash$(EXEEXT) > $@-t
- 		$(MV) $@-t $@
- 
- # For testing of udf_example.so
-
---- mysql-5.1.70/sql/Makefile.in
-+++ mysql-5.1.70.patch/sql/Makefile.in
-@@ -1310,7 +1310,7 @@
- # this avoid the rebuild of the built files in a source dist
- lex_hash.h:	gen_lex_hash.cc lex.h
- 		$(MAKE) $(AM_MAKEFLAGS) gen_lex_hash$(EXEEXT)
--		./gen_lex_hash$(EXEEXT) > $@-t
-+		gen_lex_hash$(EXEEXT) > $@-t
- 		$(MV) $@-t $@
- 
- # We might have some stuff not built in this build, but that we want to install
package/mysql/0005-bison_3_breaks_mysql_server_build.patch deleted +0 -3310

2,690 lines not on this page · raw message

package/mysql/0006-no-force-static-build.patch deleted +0 -18
deleted file mode 100644
index 8172a98..0000000

Lines of this file are not shown. View the raw message.

package/mysql/0007-dont-install-in-mysql-directory.patch deleted +0 -182

182 lines not on this page · raw message

package/mysql/Config.in +11 -6
index 7133892..d168de2 100644

Lines of this file are not shown. View the raw message.

package/mysql/S97mysqld +73 -29

102 lines not on this page · raw message

package/mysql/my.cnf new file +179 -0

179 lines not on this page · raw message

package/mysql/mysql.hash +2 -2
index 84f3361..1619193 100644

Lines of this file are not shown. View the raw message.

package/mysql/mysql.mk +86 -97

183 lines not on this page · raw message

package/mysql/mysqld.service +2 -2
index 2ded9c2..2fdbc7d 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.9.3

Part of the diff is not shown here. View the raw message.

#2 lore raw

RFC 1/1 mysql: replace mysql with mariadb 10.0

Hi,

Quoted 2 lines · Ryan Coe

Replaces the old mysql 5.1 with mariadb 10.0. The package was not renamed as mariadb is a drop-in replacement for mysql.

Give your patch a try

- openssl is mentioned in the dependencies but not selected in Config.in

- fails to compile for me when using uclibc as C library:

==
[ 82%] Building CXX object sql/CMakeFiles/sql.dir/signal_handler.cc.o /mnt/nfs/mdbtest/buildroot/output/build/mysql-10.0.27/sql/signal_handler.cc:
In function ?void handle_fatal_signal(int)?:
/mnt/nfs/mdbtest/buildroot/output/build/mysql-10.0.27/sql/signal_handler.cc:274:21:
error: ?thd? was not declared in this scope

       my_write_stderr(thd->query(), MY_MIN(65536U, thd->query_length()));
                       ^

/mnt/nfs/mdbtest/buildroot/output/build/mysql-10.0.27/sql/signal_handler.cc:
In function ?void handle_fatal_signal(int)?:
/mnt/nfs/mdbtest/buildroot/output/build/mysql-10.0.27/sql/signal_handler.cc:274:21:
error: ?thd? was not declared in this scope

       my_write_stderr(thd->query(), MY_MIN(65536U, thd->query_length()));
                       ^

libmysqld/CMakeFiles/sql_embedded.dir/build.make:590: recipe for target 'libmysqld/CMakeFiles/sql_embedded.dir/__/sql/signal_handler.cc.o' failed make[4]: *** [libmysqld/CMakeFiles/sql_embedded.dir/__/sql/signal_handler.cc.o] Error 1 make[4]: *** Waiting for unfinished jobs....
==

- is the custom my.cnf necessary?

- any specific reason to choose the older MariaDB 10.0.x branch over the current stable 10.1.x?
(believe the newer version also comes with systemd support, which may save you from having to create your own unit files)

Quoted 5 lines
package/Config.in +0 -0
index 332f05d..9fca1f6 100644

package/Config.in menu "Database" · line 909

Quoted 9 lines
package/Config.in +1 -1
@@ -902,8 +902,8 @@ menu "Database"
  	source "package/kompexsqlite/Config.in"
  	source "package/leveldb/Config.in"
  	source "package/libpqxx/Config.in"
-	source "package/mongodb/Config.in"
  	source "package/mysql/Config.in"
+	source "package/mongodb/Config.in"
  	source "package/postgresql/Config.in"
  	source "package/redis/Config.in"
  	source "package/sqlcipher/Config.in"

Why move it?

Yours sincerely,

Floris Bos

author
#3 lore raw

RFC 1/1 mysql: replace mysql with mariadb 10.0

Floris, All,

Quoted 10 lines · Floris Bos

Hi,

Quoted 3 lines · Ryan Coe

Replaces the old mysql 5.1 with mariadb 10.0. The package was not renamed
as mariadb is a drop-in replacement for mysql.

Give your patch a try

- openssl is mentioned in the dependencies but not selected in Config.in

That was a mistake on my end. It will be added for the second version.

Quoted 17 lines

- fails to compile for me when using uclibc as C library:

==
[ 82%] Building CXX object sql/CMakeFiles/sql.dir/signal_handler.cc.o /mnt/nfs/mdbtest/buildroot/output/build/mysql-10.0.27/sql/signal_handler.cc:
In function ?void handle_fatal_signal(int)?:
/mnt/nfs/mdbtest/buildroot/output/build/mysql-10.0.27/sql/signal_handler.cc:274:21:
error: ?thd? was not declared in this scope

      my_write_stderr(thd->query(), MY_MIN(65536U, thd->query_length()));
                      ^

/mnt/nfs/mdbtest/buildroot/output/build/mysql-10.0.27/sql/signal_handler.cc:
In function ?void handle_fatal_signal(int)?:
/mnt/nfs/mdbtest/buildroot/output/build/mysql-10.0.27/sql/signal_handler.cc:274:21:
error: ?thd? was not declared in this scope

      my_write_stderr(thd->query(), MY_MIN(65536U, thd->query_length()));
                      ^
Quoted 8 lines

libmysqld/CMakeFiles/sql_embedded.dir/build.make:590: recipe for target 'libmysqld/CMakeFiles/sql_embedded.dir/__/sql/signal_handler.cc.o' failed make[4]: *** [libmysqld/CMakeFiles/sql_embedded.dir/__/sql/signal_handler.cc.o] Error 1
make[4]: *** Waiting for unfinished jobs....
==

I will look into this. I am using glibc for my project.

Quoted 2 lines

- is the custom my.cnf necessary?

I'm not entirely sure about this. By default, it does not install a configuration file. There are several sample ones installed to /usr/share/mysql. We could use my-small.cnf as it would probably be best suited to embedded systems. The only thing I saw was all of the innodb stuff was commented out. I'm using that for my project. Feedback from others would be welcome here.

Quoted 5 lines

- any specific reason to choose the older MariaDB 10.0.x branch over the current stable 10.1.x?
(believe the newer version also comes with systemd support, which may save you from having to create your own unit files)

No, I updated the version to the latest 10.1.17. That will be part of my v2 patch.

Quoted 17 lines
Quoted 6 lines
package/Config.in +0 -0
index 332f05d..9fca1f6 100644

package/Config.in menu "Database" · line 909

Quoted 9 lines
package/Config.in +1 -1
@@ -902,8 +902,8 @@ menu "Database"
      source "package/kompexsqlite/Config.in"
      source "package/leveldb/Config.in"
      source "package/libpqxx/Config.in"
-    source "package/mongodb/Config.in"
      source "package/mysql/Config.in"
+    source "package/mongodb/Config.in"
      source "package/postgresql/Config.in"
      source "package/redis/Config.in"
      source "package/sqlcipher/Config.in"

Why move it?

I moved it to keep alphabetical order since I changed the name from mysql to mariadb in the Config.in file.

Quoted 10 lines

Yours sincerely,

Floris Bos
_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

Thanks,
Ryan Coe

author
#4 lore raw

[Buildroot] [RFC v2] mysql: replace mysql with mariadb 10.1

In reply to Ryan Coe

This patch represents my attempt to replace the aging mysql 5.1 that is currently shipped with Buildroot. I am replacing mysql altogether with mariadb version 10.1. I have been able to test this with both an arm and a x86_64 build, and it has also been tested with glibc and uclibc. I have not tested it with systemd.

This patch is based on the work done by Sylvain Raybaud.

Ryan Coe (1):
mysql: replace mysql with mariadb 10.1

 package/Config.in                                  |    2 +-
 package/mysql/0000-ac_cache_check.patch            |  156 -
 package/mysql/0001-add-extra-check-for-librt.patch |   26 +
 package/mysql/0001-configure-ps-cache-check.patch  |   39 -
 package/mysql/0002-use-new-readline-iface.patch    |   21 -
 .../mysql/0003-ac_stack_direction-is-unset.patch   |   15 -
 .../mysql/0004-Fix-gen_lex_hash-execution.patch    |   32 -
 .../0005-bison_3_breaks_mysql_server_build.patch   | 3310 --------------------
 package/mysql/0006-no-force-static-build.patch     |   18 -
 .../0007-dont-install-in-mysql-directory.patch     |  182 --
 package/mysql/Config.in                            |   18 +-
 package/mysql/S97mysqld                            |  103 +-
 package/mysql/mysql.hash                           |    4 +-
 package/mysql/mysql.mk                             |  187 +-
 package/mysql/mysqld.service                       |    2 +-
 15 files changed, 204 insertions(+), 3911 deletions(-)
 delete mode 100644 package/mysql/0000-ac_cache_check.patch
 create mode 100644 package/mysql/0001-add-extra-check-for-librt.patch
 delete mode 100644 package/mysql/0001-configure-ps-cache-check.patch
 delete mode 100644 package/mysql/0002-use-new-readline-iface.patch
 delete mode 100644 package/mysql/0003-ac_stack_direction-is-unset.patch
 delete mode 100644 package/mysql/0004-Fix-gen_lex_hash-execution.patch
 delete mode 100644 package/mysql/0005-bison_3_breaks_mysql_server_build.patch
 delete mode 100644 package/mysql/0006-no-force-static-build.patch
 delete mode 100644 package/mysql/0007-dont-install-in-mysql-directory.patch
Signature · 1 line
2.9.3
author
#5 lore raw

RFC v2 1/1 mysql: replace mysql with mariadb 10.1

Replaces the old mysql 5.1 with mariadb 10.1. The package was not renamed as mariadb is a drop-in replacement for mysql.

Based on the work by:
Sylvain Raybaud <[email protected]>
https://patchwork.ozlabs.org/patch/538045/

---
Changes v1 -> v2
- rebased to master
- added openssl as dependency (suggested by Floris Bos)
- bumped to mariadb version 10.1 (suggested by Floris Bos)
- replaced custom my.cnf with my-small.cnf provided in the target (suggested by Floris Bos)

---
 package/Config.in                                  |    2 +-
 package/mysql/0000-ac_cache_check.patch            |  156 -
 package/mysql/0001-add-extra-check-for-librt.patch |   26 +
 package/mysql/0001-configure-ps-cache-check.patch  |   39 -
 package/mysql/0002-use-new-readline-iface.patch    |   21 -
 .../mysql/0003-ac_stack_direction-is-unset.patch   |   15 -
 .../mysql/0004-Fix-gen_lex_hash-execution.patch    |   32 -
 .../0005-bison_3_breaks_mysql_server_build.patch   | 3310 --------------------
 package/mysql/0006-no-force-static-build.patch     |   18 -
 .../0007-dont-install-in-mysql-directory.patch     |  182 --
 package/mysql/Config.in                            |   18 +-
 package/mysql/S97mysqld                            |  103 +-
 package/mysql/mysql.hash                           |    4 +-
 package/mysql/mysql.mk                             |  187 +-
 package/mysql/mysqld.service                       |    2 +-
 15 files changed, 204 insertions(+), 3911 deletions(-)
 delete mode 100644 package/mysql/0000-ac_cache_check.patch
 create mode 100644 package/mysql/0001-add-extra-check-for-librt.patch
 delete mode 100644 package/mysql/0001-configure-ps-cache-check.patch
 delete mode 100644 package/mysql/0002-use-new-readline-iface.patch
 delete mode 100644 package/mysql/0003-ac_stack_direction-is-unset.patch
 delete mode 100644 package/mysql/0004-Fix-gen_lex_hash-execution.patch
 delete mode 100644 package/mysql/0005-bison_3_breaks_mysql_server_build.patch
 delete mode 100644 package/mysql/0006-no-force-static-build.patch
 delete mode 100644 package/mysql/0007-dont-install-in-mysql-directory.patch
package/Config.in +1 -1
index e30ce22..71bf91f 100644
@@ -903,8 +903,8 @@ menu "Database"
 	source "package/kompexsqlite/Config.in"
 	source "package/leveldb/Config.in"
 	source "package/libpqxx/Config.in"
-	source "package/mongodb/Config.in"
 	source "package/mysql/Config.in"
+	source "package/mongodb/Config.in"
 	source "package/postgresql/Config.in"
 	source "package/redis/Config.in"
 	source "package/sqlcipher/Config.in"
package/mysql/0000-ac_cache_check.patch deleted +0 -156

156 lines not on this page · raw message

package/mysql/0001-add-extra-check-for-librt.patch new file +26 -0
new file mode 100644
index 0000000..aea7064
@@ -0,0 +1,26 @@
+From 31094bd1fcccba2fb8b234735bb9bf60ba4afa28 Mon Sep 17 00:00:00 2001
+From: Ryan Coe <[email protected]>
+Date: Sun, 18 Sep 2016 16:35:59 -0700
+Subject: [PATCH 1/1] add extra check for librt
+
+Signed-off-by: Ryan Coe <[email protected]>
+---
+ configure.cmake | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/configure.cmake b/configure.cmake
+index 896226de954f4642a238ca6a72e0930590dc1681..77ca485fb05e6b63bb69f9561b4eabfaa208a419 100644
+--- a/configure.cmake
++++ b/configure.cmake
+@@ -126,6 +126,9 @@ IF(UNIX)
+   IF(NOT LIBRT)
+     MY_SEARCH_LIBS(clock_gettime rt LIBRT)
+   ENDIF()
++  IF(NOT LIBRT)
++    MY_SEARCH_LIBS(posix_spawn_file_actions_addclose rt LIBRT)
++  ENDIF()
+   FIND_PACKAGE(Threads)
+
+   SET(CMAKE_REQUIRED_LIBRARIES
+--
+2.9.3
package/mysql/0001-configure-ps-cache-check.patch deleted +0 -39
deleted file mode 100644
index 336e80e..0000000
@@ -1,39 +0,0 @@
-Patch borrowed from
-http://cgit.openembedded.org/cgit.cgi/openembedded/tree/recipes/mysql/files/configure-ps-cache-check.patch
-
-It allows to specify through ac_cv_FIND_PROC how ps should be used on
-the target to find the PID of a program.
-
-Signed-off-by: Thomas Petazzoni <[email protected]>
-
----
- configure.in |    9 +++++----
- 1 file changed, 5 insertions(+), 4 deletions(-)
-
-Index: mysql-5.1.53/configure.in
-===================================================================
---- mysql-5.1.53.orig/configure.in
-+++ mysql-5.1.53/configure.in
-@@ -462,8 +462,8 @@
- # then Make, then shell.  The autoconf substitution uses single quotes, so 
- # no unprotected single quotes should appear in the expression.
- AC_PATH_PROG(PS, ps, ps)
--AC_MSG_CHECKING("how to check if pid exists")
--PS=$ac_cv_path_PS
-+AC_CACHE_CHECK([how to check if pid exists], [ac_cv_FIND_PROC],
-+[
- # Linux style
- if $PS wwwp $$ 2> /dev/null | grep -- "$0" > /dev/null
- then
-@@ -502,8 +502,9 @@
-       AC_MSG_ERROR([Could not find the right ps and/or grep switches. Which OS is this?  See the Installation chapter in the Reference Manual.])
-   esac
- fi
--AC_SUBST(FIND_PROC)
--AC_MSG_RESULT("$FIND_PROC")
-+ac_cv_FIND_PROC="$FIND_PROC"
-+])
-+AC_SUBST([FIND_PROC], [$ac_cv_FIND_PROC])
- 
- # Check if a pid is valid
- AC_PATH_PROG(KILL, kill, kill)
package/mysql/0002-use-new-readline-iface.patch deleted +0 -21
deleted file mode 100644
index c590656..0000000
@@ -1,21 +0,0 @@
-Tell MySQL to use the new readline interface even when an external
-readline is being used.
-
-Signed-off-by: Thomas Petazzoni <[email protected]>
-
----
- configure.in |    1 +
- 1 file changed, 1 insertion(+)
-
-Index: mysql-5.1.53/configure.in
-===================================================================
---- mysql-5.1.53.orig/configure.in
-+++ mysql-5.1.53/configure.in
-@@ -2689,6 +2689,7 @@
- 	    # this way we avoid linking commercial source with GPL readline
- 	    readline_link="-lreadline"
- 	    want_to_use_readline="yes"
-+	    AC_DEFINE_UNQUOTED(USE_NEW_READLINE_INTERFACE, 1)
- 	elif [test "$mysql_cv_libedit_interface" = "yes"]
- 	then
- 	    # Use libedit
package/mysql/0003-ac_stack_direction-is-unset.patch deleted +0 -15
deleted file mode 100644
index 6fef0a9..0000000
@@ -1,15 +0,0 @@
-misc.m4: ac_cv_c_stack_direction is unset.
-
-Signed-off-by: Marcelo Gutierrez (UTN/FRH) <[email protected]>
-
---- mysql-5.1.70.orig/config/ac-macros/misc.m4
-+++ mysql-5.1.70/config/ac-macros/misc.m4
-@@ -477,7 +477,7 @@
-     exit(ptr_f(&a) < 0);
-   }
-   ], ac_cv_c_stack_direction=1, ac_cv_c_stack_direction=-1,
--   ac_cv_c_stack_direction=)])
-+   ac_cv_c_stack_direction=0)])
-  AC_DEFINE_UNQUOTED(STACK_DIRECTION, $ac_cv_c_stack_direction)
- ])dnl
- 
package/mysql/0004-Fix-gen_lex_hash-execution.patch deleted +0 -32
deleted file mode 100644
index b91ed4f..0000000
@@ -1,32 +0,0 @@
-Makefile: fix cross-compiling the server
-
-MySQL Makefile believes it can run code it just compiled, to
-generate a header. This does not work for cross-compilation.
-
-Instead, use a pre-installed host-version of the required tool.
-
-Signed-off-by: Marcelo Gutierrez (UTN/FRH) <[email protected]>
-
---- mysql-5.1.70/sql/Makefile.am
-+++ mysql-5.1.70.patch/sql/Makefile.am
-@@ -177,7 +177,7 @@
- # this avoid the rebuild of the built files in a source dist
- lex_hash.h:	gen_lex_hash.cc lex.h
- 		$(MAKE) $(AM_MAKEFLAGS) gen_lex_hash$(EXEEXT)
--		./gen_lex_hash$(EXEEXT) > $@-t
-+		gen_lex_hash$(EXEEXT) > $@-t
- 		$(MV) $@-t $@
- 
- # For testing of udf_example.so
-
---- mysql-5.1.70/sql/Makefile.in
-+++ mysql-5.1.70.patch/sql/Makefile.in
-@@ -1310,7 +1310,7 @@
- # this avoid the rebuild of the built files in a source dist
- lex_hash.h:	gen_lex_hash.cc lex.h
- 		$(MAKE) $(AM_MAKEFLAGS) gen_lex_hash$(EXEEXT)
--		./gen_lex_hash$(EXEEXT) > $@-t
-+		gen_lex_hash$(EXEEXT) > $@-t
- 		$(MV) $@-t $@
- 
- # We might have some stuff not built in this build, but that we want to install
package/mysql/0005-bison_3_breaks_mysql_server_build.patch deleted +0 -3310

2,702 lines not on this page · raw message

package/mysql/0006-no-force-static-build.patch deleted +0 -18
deleted file mode 100644
index 8172a98..0000000

Lines of this file are not shown. View the raw message.

package/mysql/0007-dont-install-in-mysql-directory.patch deleted +0 -182

182 lines not on this page · raw message

package/mysql/Config.in +12 -6
index 7133892..f1b70db 100644

Lines of this file are not shown. View the raw message.

package/mysql/S97mysqld +74 -29

103 lines not on this page · raw message

package/mysql/mysql.hash +2 -2
index 84f3361..f55ff6f 100644

Lines of this file are not shown. View the raw message.

package/mysql/mysql.mk +88 -99

187 lines not on this page · raw message

package/mysql/mysqld.service +1 -1
index c9e5e42..db93ba2 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.9.3

Part of the diff is not shown here. View the raw message.

#6 lore raw

[Buildroot] [RFC v2] mysql: replace mysql with mariadb 10.1

Hello,

Quoted 8 lines · Ryan Coe

Replaces the old mysql 5.1 with mariadb 10.1. The package was not renamed as mariadb is a drop-in replacement for mysql.

Based on the work by:
Sylvain Raybaud <[email protected]>
https://patchwork.ozlabs.org/patch/538045/

I don't know if I like the fact that we're hi-jacking the mysql package here. Maybe this should be added as a separate package/mariadb/ package, and then the mysql package changed to a virtual package afterwards, in a second patch?

This would also have the benefit of making this patch easier to review.

Quoted 17 lines
package/mysql/0001-add-extra-check-for-librt.patch new file +11 -0
new file mode 100644
index 0000000..aea7064
@@ -0,0 +1,26 @@
+From 31094bd1fcccba2fb8b234735bb9bf60ba4afa28 Mon Sep 17 00:00:00 2001
+From: Ryan Coe <[email protected]>
+Date: Sun, 18 Sep 2016 16:35:59 -0700
+Subject: [PATCH 1/1] add extra check for librt
+
+Signed-off-by: Ryan Coe <[email protected]>
+---
+ configure.cmake | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/configure.cmake b/configure.cmake

package/mysql/0001-add-extra-check-for-librt.patch line 21

Quoted 10 lines
package/mysql/0001-add-extra-check-for-librt.patch new file +10 -0
+index 896226de954f4642a238ca6a72e0930590dc1681..77ca485fb05e6b63bb69f9561b4eabfaa208a419 100644
+--- a/configure.cmake
++++ b/configure.cmake
+@@ -126,6 +126,9 @@ IF(UNIX)
+   IF(NOT LIBRT)
+     MY_SEARCH_LIBS(clock_gettime rt LIBRT)
+   ENDIF()
++  IF(NOT LIBRT)
++    MY_SEARCH_LIBS(posix_spawn_file_actions_addclose rt LIBRT)
++  ENDIF()

Please remember to send this patch to the upstream MariaDB project.

package/mysql/Config.in line 6

Quoted 12 lines
package/mysql/Config.in +2 -1
index 7133892..f1b70db 100644
@@ -1,24 +1,30 @@
 config BR2_PACKAGE_MYSQL
-	bool "MySQL"
+	bool "mariadb"
 	depends on BR2_INSTALL_LIBSTDCPP
 	depends on BR2_USE_MMU # fork()
 	depends on BR2_TOOLCHAIN_HAS_THREADS
+	select BR2_PACKAGE_LIBAIO

Then you need to:

depends on BR2_PACKAGE_LIBAIO_ARCH_SUPPORTS

package/mysql/Config.in line 7

Quoted 1 line
package/mysql/Config.in +1 -0
+	select BR2_PACKAGE_LIBTOOL

Are you sure you need libtool on the target? This seems odd.

package/mysql/Config.in line 29

Quoted 3 lines
package/mysql/Config.in +1 -1
-comment "MySQL needs a toolchain w/ C++, threads"
+comment "mariadb needs a toolchain w/ C++, threads"
 	depends on BR2_USE_MMU

depends on BR2_PACKAGE_LIBAIO_ARCH_SUPPORTS

Quoted 10 lines
package/mysql/Config.in +8 -0
 	depends on !BR2_INSTALL_LIBSTDCPP || !BR2_TOOLCHAIN_HAS_THREADS
 
+MYSQL_LIB="/var/lib/mysql"
+MYSQL_RUN="/run/mysqld"
+MYSQL_PID="$MYSQL_RUN/mysqld.pid"
+
+wait_for_pid() {
+	WAIT_DELAY=10
+	if [ ! -e $MYSQL_PID ]; then
+		while [ $WAIT_DELAY -gt 0 ]; do

package/mysql/Config.in line 29

Quoted 10 lines
package/mysql/Config.in +10 -0
+			if [ -e $MYSQL_PID ]; then
+				return 0
+			fi
+			sleep 1
+			: $((WAIT_DELAY -= 1))
+		done
+		return 1
+	fi
+	return 0
+}

Do we really need something like this?

Quoted 13 lines
package/mysql/mysql.mk +1 -2
index 7af4711..0c05162 100644
@@ -1,110 +1,98 @@
 ################################################################################
 #
-# mysql
+# mariadb
 #
 ################################################################################
 
-MYSQL_VERSION_MAJOR = 5.1

package/mysql/mysql.mk line 10

Quoted 10 lines
package/mysql/mysql.mk +3 -6
-MYSQL_VERSION = $(MYSQL_VERSION_MAJOR).73
-MYSQL_SOURCE = mysql-$(MYSQL_VERSION).tar.gz
-MYSQL_SITE = http://downloads.skysql.com/archives/mysql-$(MYSQL_VERSION_MAJOR)
-MYSQL_INSTALL_STAGING = YES
-MYSQL_DEPENDENCIES = readline ncurses
-MYSQL_AUTORECONF = YES
+MYSQL_VERSION = 10.1.17
+MYSQL_SOURCE = mariadb-$(MYSQL_VERSION).tar.gz
+MYSQL_SITE = https://downloads.mariadb.org/interstitial/mariadb-$(MYSQL_VERSION)/source
 MYSQL_LICENSE = GPLv2

Are you sure this license is correct? I believe mariadb is partly under LGPLv2, no?

package/mysql/mysql.mk line 32

Quoted 4 lines
package/mysql/mysql.mk +4 -0
+# Jemalloc was added for TokuDB. Since its configure script seems somewhat broken
+# when it comes to cross-compilation we shall disable it and also disable TokuDB.
+MYSQL_OPTS += -DWITH_JEMALLOC=no
+MYSQL_OPTS += -DWITHOUT_TOKUDB=1

One line is probably enough for both.

package/mysql/mysql.mk line 46

Quoted 1 line
package/mysql/mysql.mk +1 -0
+MYSQL_OPTS += -DCMAKE_BUILD_TYPE=Release

Not needed, already passed by Buildroot in pkg-cmake.mk.

package/mysql/mysql.mk line 47

Quoted 1 line
package/mysql/mysql.mk +1 -0
+MYSQL_OPTS += -DCMAKE_INSTALL_PREFIX=/usr

Not needed, already passed by Builroot in pkg-cmake.mk.

package/mysql/mysql.mk line 57

Quoted 10 lines
package/mysql/mysql.mk +10 -0
+MYSQL_OPTS += -DINSTALL_DOCDIR=share/doc/mariadb-$(MYSQL_VERSION)
+MYSQL_OPTS += -DINSTALL_DOCREADMEDIR=share/doc/mariadb-$(MYSQL_VERSION)
+MYSQL_OPTS += -DINSTALL_MANDIR=share/man
+MYSQL_OPTS += -DINSTALL_MYSQLSHAREDIR=share/mysql
+MYSQL_OPTS += -DINSTALL_MYSQLTESTDIR=share/mysql/test
+MYSQL_OPTS += -DINSTALL_PLUGINDIR=lib/mysql/plugin
+MYSQL_OPTS += -DINSTALL_SBINDIR=sbin
+MYSQL_OPTS += -DINSTALL_SCRIPTDIR=bin
+MYSQL_OPTS += -DINSTALL_SQLBENCHDIR=share/mysql/bench
+MYSQL_OPTS += -DINSTALL_SUPPORTFILESDIR=share/mysql

Are these all needed?

Also, we prefer:

MYSQL_OPTS += \
	-DFOO=baz \
	-DBAR=foo \
	-Dthis=that

when there are multiple options to assign.

package/mysql/mysql.mk line 68

Quoted 8 lines
package/mysql/mysql.mk +8 -0
+MYSQL_DEPENDENCIES = \
+	host-mysql \
+	ncurses \
+	openssl \
+	zlib \
+	libaio \
+	libxml2 \
+	libtool \

You really need libtool?

package/mysql/mysql.mk line 71

Quoted 3 lines
package/mysql/mysql.mk +3 -0
+	readline
+
+HOST_MYSQL_DEPENDENCIES =

Not needed.

package/mysql/mysql.mk line 80

Quoted 8 lines
package/mysql/mysql.mk +8 -0
+# Some helpers must be compiled for host in order to crosscompile mariadb for
+# the target. They are then included by import_executables.cmake which is
+# generated during the build of the host helpers. It is not necessary to build
+# the whole host package, only the "import_executables" target.
+# -DIMPORT_EXECUTABLES=$(BUILD_DIR)/host-mariadb-galera/import_executables.cmake
+# must then be passed to cmake during target build.
+HOST_MYSQL_MAKE_OPTS = import_executables
+MYSQL_IMPORT_EXECUTABLES += -DIMPORT_EXECUTABLES=$(HOST_MYSQL_BUILDDIR)/import_executables.cmake

I'm not sure why this import_executables.cmake file contains, but we generally don't like accessing stuff from a build directory during the build of another package. The host-mysql package is supposed to install things in $(HOST_DIR), and the target mysql package to use them from $(HOST_DIR).

package/mysql/mysql.mk line 47

Quoted 2 lines
package/mysql/mysql.mk +2 -0
+
+HOST_MYSQL_CONF_OPTS = $(MYSQL_OPTS)

This seems very wrong, a MYSQL_OPTS is for the target. As an example, the host should be configured with CMAKE_INSTALL_PREFIX=$(HOST_DIR)/usr. Please use an explicit value for HOST_MYSQL_CONF_OPTS, with only the necessary options.

package/mysql/mysql.mk line 83

Quoted 1 line
package/mysql/mysql.mk +1 -0
+HOST_MYSQL_CONF_OPTS += $(MYSQL_HOST_OPTS)

Why do we have an intermediate MYSQL_HOST_OPTS variable then, rather than using HOST_MYSQL_CONF_OPTS directly?

package/mysql/mysql.mk line 50

Quoted 2 lines
package/mysql/mysql.mk +2 -0
+
+MYSQL_CONF_OPTS = $(MYSQL_OPTS)

Why do we have an intermediate MYSQL_OPTS variable? Just use MYSQL_CONF_OPTS directly.

package/mysql/mysql.mk line 86

Quoted 1 line
package/mysql/mysql.mk +1 -0
+MYSQL_CONF_OPTS += $(MYSQL_IMPORT_EXECUTABLES)

Intermediate variable not needed.

package/mysql/mysql.mk line 90

Quoted 4 lines
package/mysql/mysql.mk +4 -0
+
+# Don't install host-mysql. We just need to build import_executable
+# Therefore only run 'true' and do nothing, not even the default action.
+HOST_MYSQL_INSTALL_CMDS = true

This would be the place where you could install the host-mysql stuff in $(HOST_DIR).

package/mysql/mysql.mk line 57

Quoted 3 lines
package/mysql/mysql.mk +1 -1
 [Service]
-ExecStartPre=/bin/sh -c 'test -d /var/mysql/mysql || mysql_install_db --user=mysql --ldata=/var/mysql'
+ExecStartPre=/bin/sh -c '[ "`ls -1 /var/lib/mysql | wc -l`" = "0" ] && mysql_install_db --basedir=/usr --datadir=/var/lib/mysql'

Why is the test on /var/mysql/mysql existence no longer good enough? It was much nicer than the test of the number of files in this directory.

Thanks for this effort, it is much appreciated that someone takes care of updating this complicated package.

Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
#7 lore raw

[Buildroot] [RFC v2] mysql: replace mysql with mariadb 10.1

Quoted 10 lines · Thomas Petazzoni

Hello,

Quoted 7 lines · Ryan Coe

Replaces the old mysql 5.1 with mariadb 10.1. The package was not renamed as mariadb is a drop-in replacement for mysql.

Based on the work by:
Sylvain Raybaud <[email protected]>
https://patchwork.ozlabs.org/patch/538045/

Quoted 6 lines
Quoted 1 line

I don't know if I like the fact that we're hi-jacking the mysql package here. Maybe this should be added as a separate package/mariadb/ package, and then the mysql package changed to a virtual package afterwards, in a second patch?

*Someone* wrote in
http://lists.buildroot.org/pipermail/buildroot/2016-September/172401.html :

TP> As Floris said, our mysql package is deprecated, so I'm all for TP> replacing it with an up-to-date mariadb package. If later on, someone TP> else really needs MySQL, we can re-add it, and add the necessary TP> virtual package to allow selecting between mysql and mariadb. But until TP> there's a decent mysql package available, I believe replacing it TP> completely with an up-to-date mariadb package is better.

Quoted 1 line

This would also have the benefit of making this patch easier to review.

That is true.

[snip]

Quoted 12 lines
Quoted 12 lines
package/mysql/S97mysqld +12 -0
+MYSQL_LIB="/var/lib/mysql"
+MYSQL_RUN="/run/mysqld"
+MYSQL_PID="$MYSQL_RUN/mysqld.pid"
+
+wait_for_pid() {
+	WAIT_DELAY=10
+	if [ ! -e $MYSQL_PID ]; then
+		while [ $WAIT_DELAY -gt 0 ]; do
+			if [ -e $MYSQL_PID ]; then
+				return 0
+			fi
+			sleep 1
Quoted 8 lines

package/mysql/S97mysqld line 23

Quoted 6 lines
package/mysql/S97mysqld +6 -0
+			: $((WAIT_DELAY -= 1))
+		done
+		return 1
+	fi
+	return 0
+}

Do we really need something like this?

Well, we need to wait until mysqld really has started before continuing,
because later init scripts may depend on it. However, I think it's better to use --no-auto-restart to mysqld_safe, which kind of implies the wait. AFAIK there are no other daemons that autorestart.

Quoted 10 lines

package/mysql/mysql.mk line 3

Quoted 10 lines
package/mysql/mysql.mk +1 -1
index 7af4711..0c05162 100644
@@ -1,110 +1,98 @@
 ################################################################################
 #
-# mysql
+# mariadb

This should remain mysql, because the package is still called mysql. Oh well,
this entire header is silly, but it is what it is :-)

Quoted 17 lines
Quoted 4 lines
package/mysql/mysql.mk +0 -1
 #
 ################################################################################
 
-MYSQL_VERSION_MAJOR = 5.1

package/mysql/mysql.mk line 10

Quoted 10 lines
package/mysql/mysql.mk +3 -6
-MYSQL_VERSION = $(MYSQL_VERSION_MAJOR).73
-MYSQL_SOURCE = mysql-$(MYSQL_VERSION).tar.gz
-MYSQL_SITE = http://downloads.skysql.com/archives/mysql-$(MYSQL_VERSION_MAJOR)
-MYSQL_INSTALL_STAGING = YES
-MYSQL_DEPENDENCIES = readline ncurses
-MYSQL_AUTORECONF = YES
+MYSQL_VERSION = 10.1.17
+MYSQL_SOURCE = mariadb-$(MYSQL_VERSION).tar.gz
+MYSQL_SITE = https://downloads.mariadb.org/interstitial/mariadb-$(MYSQL_VERSION)/source
 MYSQL_LICENSE = GPLv2

Are you sure this license is correct? I believe mariadb is partly under LGPLv2, no?

It's a bit complicated because there is the old mysql client library that is
GPLv2 with FLOSS exception, and the new mariadb client library that is LGPLv2. I'm not entirely sure if this new mariadb client library is the one that is actually used by applications that link with libmysql_client. If not, or if the old mysql client library is still installed to target, then we have to add the three licenses.

See https://mariadb.com/kb/en/mariadb/mariadb-license/ for more details.

Quoted 7 lines

package/mysql/mysql.mk line 32

Quoted 5 lines
package/mysql/mysql.mk +4 -0
+# Jemalloc was added for TokuDB. Since its configure script seems somewhat broken
+# when it comes to cross-compilation we shall disable it and also disable TokuDB.
+MYSQL_OPTS += -DWITH_JEMALLOC=no
+MYSQL_OPTS += -DWITHOUT_TOKUDB=1

One line is probably enough for both.

Well, since there are a lot more += -D options, I kind of like it like this.
Principle of least surprise.

Quoted 22 lines

package/mysql/mysql.mk line 46

Quoted 2 lines
package/mysql/mysql.mk +1 -0
+MYSQL_OPTS += -DCMAKE_BUILD_TYPE=Release

Not needed, already passed by Buildroot in pkg-cmake.mk.

package/mysql/mysql.mk line 47

Quoted 1 line
package/mysql/mysql.mk +1 -0
+MYSQL_OPTS += -DCMAKE_INSTALL_PREFIX=/usr

Not needed, already passed by Builroot in pkg-cmake.mk.

package/mysql/mysql.mk line 57

Quoted 10 lines
package/mysql/mysql.mk +10 -0
+MYSQL_OPTS += -DINSTALL_DOCDIR=share/doc/mariadb-$(MYSQL_VERSION)
+MYSQL_OPTS += -DINSTALL_DOCREADMEDIR=share/doc/mariadb-$(MYSQL_VERSION)
+MYSQL_OPTS += -DINSTALL_MANDIR=share/man
+MYSQL_OPTS += -DINSTALL_MYSQLSHAREDIR=share/mysql
+MYSQL_OPTS += -DINSTALL_MYSQLTESTDIR=share/mysql/test
+MYSQL_OPTS += -DINSTALL_PLUGINDIR=lib/mysql/plugin
+MYSQL_OPTS += -DINSTALL_SBINDIR=sbin
+MYSQL_OPTS += -DINSTALL_SCRIPTDIR=bin
+MYSQL_OPTS += -DINSTALL_SQLBENCHDIR=share/mysql/bench
+MYSQL_OPTS += -DINSTALL_SUPPORTFILESDIR=share/mysql

Are these all needed?

Quoted 8 lines

Also, we prefer:

MYSQL_OPTS += \
	-DFOO=baz \
	-DBAR=foo \
	-Dthis=that

when there are multiple options to assign.

Ah, do we? :-)

[snip]

Quoted 6 lines
Quoted 6 lines
package/mysql/mysql.mk +6 -0
+# Some helpers must be compiled for host in order to crosscompile mariadb for
+# the target. They are then included by import_executables.cmake which is
+# generated during the build of the host helpers. It is not necessary to build
+# the whole host package, only the "import_executables" target.
+# -DIMPORT_EXECUTABLES=$(BUILD_DIR)/host-mariadb-galera/import_executables.cmake
+# must then be passed to cmake during target build.
Quoted 8 lines

package/mysql/mysql.mk line 80

Quoted 2 lines
package/mysql/mysql.mk +2 -0
+HOST_MYSQL_MAKE_OPTS = import_executables
+MYSQL_IMPORT_EXECUTABLES += -DIMPORT_EXECUTABLES=$(HOST_MYSQL_BUILDDIR)/import_executables.cmake

I'm not sure why this import_executables.cmake file contains, but we generally don't like accessing stuff from a build directory during the build of another package. The host-mysql package is supposed to install things in $(HOST_DIR), and the target mysql package to use them from $(HOST_DIR).

As I understand it from
https://mariadb.com/kb/en/mariadb/cross-compiling-mariadb/
you basically need a configure-hostbuild-configure-build chain for cross-compiling. The binaries generated during the hostbuild are not meant to be used outside of the mariadb build process itself, so it really makes no sense to make it a host package IMHO. I think it's better to do the hostbuild in a pre-configure hook.

Problem with that is that
* the pre-configure hook will also build stuff;
* the cmake call in the pre-configure hook will also have to pass some/most/all of the -D arguments we pass in a host-cmake package's _CONFIGURE_CMDS. The first point is not so important IMHO. For the second one, it would be convenient if we would define a HOST/TARGET_CMAKE_CONF_OPTS variable that contains all these common options.

Quoted 8 lines

package/mysql/mysql.mk line 36

Quoted 3 lines
package/mysql/mysql.mk +2 -0
+
+HOST_MYSQL_CONF_OPTS = $(MYSQL_OPTS)

This seems very wrong, a MYSQL_OPTS is for the target. As an example, the host should be configured with CMAKE_INSTALL_PREFIX=$(HOST_DIR)/usr. Please use an explicit value for HOST_MYSQL_CONF_OPTS, with only the necessary options.

Indeed, I expect most of them are not needed for the hostbuild.

Quoted 24 lines

package/mysql/mysql.mk line 83

Quoted 2 lines
package/mysql/mysql.mk +1 -0
+HOST_MYSQL_CONF_OPTS += $(MYSQL_HOST_OPTS)

Why do we have an intermediate MYSQL_HOST_OPTS variable then, rather than using HOST_MYSQL_CONF_OPTS directly?

package/mysql/mysql.mk line 39

Quoted 2 lines
package/mysql/mysql.mk +2 -0
+
+MYSQL_CONF_OPTS = $(MYSQL_OPTS)

Why do we have an intermediate MYSQL_OPTS variable? Just use MYSQL_CONF_OPTS directly.

package/mysql/mysql.mk line 86

Quoted 1 line
package/mysql/mysql.mk +1 -0
+MYSQL_CONF_OPTS += $(MYSQL_IMPORT_EXECUTABLES)

Intermediate variable not needed.

package/mysql/mysql.mk line 90

Quoted 4 lines
package/mysql/mysql.mk +4 -0
+
+# Don't install host-mysql. We just need to build import_executable
+# Therefore only run 'true' and do nothing, not even the default action.
+HOST_MYSQL_INSTALL_CMDS = true

This would be the place where you could install the host-mysql stuff in $(HOST_DIR).

Quoted 6 lines

package/mysql/mysql.mk line 46

Quoted 3 lines
package/mysql/mysql.mk +1 -1
 [Service]
-ExecStartPre=/bin/sh -c 'test -d /var/mysql/mysql || mysql_install_db --user=mysql --ldata=/var/mysql'
+ExecStartPre=/bin/sh -c '[ "`ls -1 /var/lib/mysql | wc -l`" = "0" ] && mysql_install_db --basedir=/usr --datadir=/var/lib/mysql'

Why is the test on /var/mysql/mysql existence no longer good enough? It was much nicer than the test of the number of files in this directory.

I agree with that. Same goes for the init script by the way.

However, is there a reason why the systemd unit file bundled with mariadb
doesn't work? Or is it too complicated?

By the way, there is also the option of generating the system database at build
time. It would be kind of nice if we had a convention in buildroot to install defaults somewhere and then copy the defaults to their final location on a writable partition at boot time when they don't exist yet. Like the /usr/share/factory/ default of systemd-tmpfiles...

Regards,
Arnout

Quoted 8 lines

Thanks for this effort, it is much appreciated that someone takes care of updating this complicated package.

Thanks!

Thomas

Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
#8 lore raw

[Buildroot] [RFC v2] mysql: replace mysql with mariadb 10.1

Hello,

Quoted 8 lines · Arnout Vandecappelle
Quoted 4 lines

I don't know if I like the fact that we're hi-jacking the mysql package here. Maybe this should be added as a separate package/mariadb/ package, and then the mysql package changed to a virtual package afterwards, in a second patch?

*Someone* wrote in
http://lists.buildroot.org/pipermail/buildroot/2016-September/172401.html :

Quoted 6 lines

TP> As Floris said, our mysql package is deprecated, so I'm all for TP> replacing it with an up-to-date mariadb package. If later on, someone TP> else really needs MySQL, we can re-add it, and add the necessary TP> virtual package to allow selecting between mysql and mariadb. But until TP> there's a decent mysql package available, I believe replacing it TP> completely with an up-to-date mariadb package is better.

Yes, I know. In French we say "only stupid people don't change their mind" :-)

Quoted 17 lines
Quoted 8 lines
Quoted 8 lines
package/mysql/S97mysqld +8 -0
+wait_for_pid() {
+	WAIT_DELAY=10
+	if [ ! -e $MYSQL_PID ]; then
+		while [ $WAIT_DELAY -gt 0 ]; do
+			if [ -e $MYSQL_PID ]; then
+				return 0
+			fi
+			sleep 1
Quoted 8 lines

package/mysql/S97mysqld line 23

Quoted 6 lines
package/mysql/S97mysqld +6 -0
+			: $((WAIT_DELAY -= 1))
+		done
+		return 1
+	fi
+	return 0
+}  

Do we really need something like this?

Quoted 4 lines

Well, we need to wait until mysqld really has started before continuing,
because later init scripts may depend on it. However, I think it's better to use --no-auto-restart to mysqld_safe, which kind of implies the wait. AFAIK there are no other daemons that autorestart.

I don't think we're doing this kind of wait for any other service in Buildroot, so it would be good if MariaDB could daemonize only once it is ready to listen to connections.

Quoted 7 lines
Quoted 4 lines

package/mysql/mysql.mk line 3

Quoted 4 lines

################################################################################
#

package/mysql/mysql.mk +1 -1
-# mysql
+# mariadb  

This should remain mysql, because the package is still called mysql. Oh well,
this entire header is silly, but it is what it is :-)

Except if we ask to have this new package in package/mariadb/, and mysql be turned into a virtual package (with for now a single provider).

Also, I think mysql should be a virtual package like jpeg, i.e a virtual package on which "select" can be used.

Quoted 7 lines
Quoted 6 lines

package/mysql/mysql.mk line 10

Quoted 3 lines
package/mysql/mysql.mk +2 -0
+MYSQL_SOURCE = mariadb-$(MYSQL_VERSION).tar.gz
+MYSQL_SITE = https://downloads.mariadb.org/interstitial/mariadb-$(MYSQL_VERSION)/source
 MYSQL_LICENSE = GPLv2  

Are you sure this license is correct? I believe mariadb is partly under LGPLv2, no?

Quoted 6 lines

It's a bit complicated because there is the old mysql client library that is
GPLv2 with FLOSS exception, and the new mariadb client library that is LGPLv2. I'm not entirely sure if this new mariadb client library is the one that is actually used by applications that link with libmysql_client. If not, or if the old mysql client library is still installed to target, then we have to add the three licenses.

Isn't part of the original idea of MariaDB to avoid the GPL-licensed client library so that proprietary applications can link with the client library without having to purchase a MySQL license?

Quoted 1 line

See https://mariadb.com/kb/en/mariadb/mariadb-license/ for more details.

Reading this, I think we should use:

MARIADB_LICENSE = GPLv2 (server), GPLv2 with FLOSS exception (GPL client library), LGPLv2 (LGPL client library)

Quoted 9 lines
Quoted 6 lines

package/mysql/mysql.mk line 32

Quoted 4 lines
package/mysql/mysql.mk +4 -0
+# Jemalloc was added for TokuDB. Since its configure script seems somewhat broken
+# when it comes to cross-compilation we shall disable it and also disable TokuDB.
+MYSQL_OPTS += -DWITH_JEMALLOC=no
+MYSQL_OPTS += -DWITHOUT_TOKUDB=1  

One line is probably enough for both.

Well, since there are a lot more += -D options, I kind of like it like this.
Principle of least surprise.

I really prefer:

MYSQL_OPTS += \
	-DWITH_JEMALLOC=no \
	-DWITHOUT_TOKUDB=1

or:

MYSQL_OPTS += -DWITH_JEMALLOC=no -DWITHOUT_TOKUDB=1

Quoted 4 lines
Quoted 4 lines

Are these all needed?

Also, we prefer:

Quoted 8 lines
Quoted 6 lines
MYSQL_OPTS += \
	-DFOO=baz \
	-DBAR=foo \
	-Dthis=that

when there are multiple options to assign.

Ah, do we? :-)

Yes, that's what we're doing everywhere in Buildroot.

Quoted 23 lines
Quoted 6 lines
Quoted 6 lines
package/mysql/mysql.mk +6 -0
+# Some helpers must be compiled for host in order to crosscompile mariadb for
+# the target. They are then included by import_executables.cmake which is
+# generated during the build of the host helpers. It is not necessary to build
+# the whole host package, only the "import_executables" target.
+# -DIMPORT_EXECUTABLES=$(BUILD_DIR)/host-mariadb-galera/import_executables.cmake
+# must then be passed to cmake during target build.
Quoted 8 lines

package/mysql/mysql.mk line 80

Quoted 2 lines
package/mysql/mysql.mk +2 -0
+HOST_MYSQL_MAKE_OPTS = import_executables
+MYSQL_IMPORT_EXECUTABLES += -DIMPORT_EXECUTABLES=$(HOST_MYSQL_BUILDDIR)/import_executables.cmake  

I'm not sure why this import_executables.cmake file contains, but we generally don't like accessing stuff from a build directory during the build of another package. The host-mysql package is supposed to install things in $(HOST_DIR), and the target mysql package to use them from $(HOST_DIR).

As I understand it from
https://mariadb.com/kb/en/mariadb/cross-compiling-mariadb/
you basically need a configure-hostbuild-configure-build chain for cross-compiling. The binaries generated during the hostbuild are not meant to be used outside of the mariadb build process itself, so it really makes no sense to make it a host package IMHO. I think it's better to do the hostbuild in a pre-configure hook.

Quoted 7 lines

Problem with that is that
* the pre-configure hook will also build stuff;
* the cmake call in the pre-configure hook will also have to pass some/most/all of the -D arguments we pass in a host-cmake package's _CONFIGURE_CMDS. The first point is not so important IMHO. For the second one, it would be convenient if we would define a HOST/TARGET_CMAKE_CONF_OPTS variable that contains all these common options.

Well, so in the end, a host package is better :-)

I'm fine with the approach of the host package, I just dislike that the target package re-uses stuff directly from the host package source directory.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
#9 lore raw

[Buildroot] [RFC v2] mysql: replace mysql with mariadb 10.1

Hi,

Quoted 4 lines · Thomas Petazzoni

Isn't part of the original idea of MariaDB to avoid the GPL-licensed client library so that proprietary applications can link with the client library without having to purchase a MySQL license?

The server distribution still uses the old GPL one for now.

There is a separate download called MariaDB connector/C that is a LGPL libmysqlclient replacement.
However that one wasn't really source code compatible with existing programs last time I tried to compile a couple buildroot packages against it.

Upstream bug: https://jira.mariadb.org/projects/CONC/issues/CONC-200

Yours sincerely,

Floris Bos

author
#10 lore raw

[Buildroot] [RFC v2] mysql: replace mysql with mariadb 10.1

In reply to Thomas Petazzoni

Thomas, All,

Quoted 10 lines · Thomas Petazzoni

Hello,

Quoted 7 lines · Ryan Coe

Replaces the old mysql 5.1 with mariadb 10.1. The package was not renamed as mariadb is a drop-in replacement for mysql.

Based on the work by:
Sylvain Raybaud <[email protected]>
https://patchwork.ozlabs.org/patch/538045/

Quoted 7 lines
Quoted 1 line

I don't know if I like the fact that we're hi-jacking the mysql package here. Maybe this should be added as a separate package/mariadb/ package, and then the mysql package changed to a virtual package afterwards, in a second patch?

This would also have the benefit of making this patch easier to review.

Will do. I will make mariadb a separate package and create a virtual package for mysql.

Quoted 21 lines
Quoted 21 lines
package/mysql/0001-add-extra-check-for-librt.patch new file +14 -0
new file mode 100644
index 0000000..aea7064
@@ -0,0 +1,26 @@
+From 31094bd1fcccba2fb8b234735bb9bf60ba4afa28 Mon Sep 17 00:00:00 2001
+From: Ryan Coe <[email protected]>
+Date: Sun, 18 Sep 2016 16:35:59 -0700
+Subject: [PATCH 1/1] add extra check for librt
+
+Signed-off-by: Ryan Coe <[email protected]>
+---
+ configure.cmake | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/configure.cmake b/configure.cmake
+index 896226de954f4642a238ca6a72e0930590dc1681..77ca485fb05e6b63bb69f9561b4eabfaa208a419 100644
+--- a/configure.cmake
++++ b/configure.cmake
Quoted 8 lines

package/mysql/0001-add-extra-check-for-librt.patch line 21

Quoted 7 lines
package/mysql/0001-add-extra-check-for-librt.patch new file +7 -0
+@@ -126,6 +126,9 @@ IF(UNIX)
+   IF(NOT LIBRT)
+     MY_SEARCH_LIBS(clock_gettime rt LIBRT)
+   ENDIF()
++  IF(NOT LIBRT)
++    MY_SEARCH_LIBS(posix_spawn_file_actions_addclose rt LIBRT)
++  ENDIF()

Please remember to send this patch to the upstream MariaDB project.

Sent upstream: https://jira.mariadb.org/browse/MDEV-10841

Quoted 15 lines

package/mysql/Config.in line 6

Quoted 13 lines
package/mysql/Config.in +2 -1
index 7133892..f1b70db 100644
@@ -1,24 +1,30 @@
  config BR2_PACKAGE_MYSQL
-	bool "MySQL"
+	bool "mariadb"
  	depends on BR2_INSTALL_LIBSTDCPP
  	depends on BR2_USE_MMU # fork()
  	depends on BR2_TOOLCHAIN_HAS_THREADS
+	select BR2_PACKAGE_LIBAIO

Then you need to:

Quoted 1 line

depends on BR2_PACKAGE_LIBAIO_ARCH_SUPPORTS

Added.

Quoted 3 lines

package/mysql/Config.in line 7

Quoted 2 lines
package/mysql/Config.in +1 -0
+	select BR2_PACKAGE_LIBTOOL

Are you sure you need libtool on the target? This seems odd.

Removed.

Quoted 5 lines

package/mysql/Config.in line 29

Quoted 4 lines
package/mysql/Config.in +1 -1
-comment "MySQL needs a toolchain w/ C++, threads"
+comment "mariadb needs a toolchain w/ C++, threads"
  	depends on BR2_USE_MMU

depends on BR2_PACKAGE_LIBAIO_ARCH_SUPPORTS

Added.

Quoted 13 lines
Quoted 13 lines
package/mysql/Config.in +11 -0
  	depends on !BR2_INSTALL_LIBSTDCPP || !BR2_TOOLCHAIN_HAS_THREADS
+MYSQL_LIB="/var/lib/mysql"
+MYSQL_RUN="/run/mysqld"
+MYSQL_PID="$MYSQL_RUN/mysqld.pid"
+
+wait_for_pid() {
+	WAIT_DELAY=10
+	if [ ! -e $MYSQL_PID ]; then
+		while [ $WAIT_DELAY -gt 0 ]; do
+			if [ -e $MYSQL_PID ]; then
+				return 0
+			fi
Quoted 8 lines

package/mysql/Config.in line 28

Quoted 7 lines
package/mysql/Config.in +7 -0
+			sleep 1
+			: $((WAIT_DELAY -= 1))
+		done
+		return 1
+	fi
+	return 0
+}

Do we really need something like this?

I will rework this per the other conservations on this.

Quoted 13 lines
Quoted 13 lines
package/mysql/mysql.mk +1 -1
index 7af4711..0c05162 100644
@@ -1,110 +1,98 @@
  ################################################################################
  #
-# mysql
+# mariadb
  #
  ################################################################################
 
Quoted 13 lines

package/mysql/mysql.mk line 10

Quoted 11 lines
package/mysql/mysql.mk +3 -7
-MYSQL_VERSION_MAJOR = 5.1
-MYSQL_VERSION = $(MYSQL_VERSION_MAJOR).73
-MYSQL_SOURCE = mysql-$(MYSQL_VERSION).tar.gz
-MYSQL_SITE = http://downloads.skysql.com/archives/mysql-$(MYSQL_VERSION_MAJOR)
-MYSQL_INSTALL_STAGING = YES
-MYSQL_DEPENDENCIES = readline ncurses
-MYSQL_AUTORECONF = YES
+MYSQL_VERSION = 10.1.17
+MYSQL_SOURCE = mariadb-$(MYSQL_VERSION).tar.gz
+MYSQL_SITE = https://downloads.mariadb.org/interstitial/mariadb-$(MYSQL_VERSION)/source
  MYSQL_LICENSE = GPLv2

Are you sure this license is correct? I believe mariadb is partly under LGPLv2, no?

Updated per other conservations.

Quoted 6 lines

package/mysql/mysql.mk line 32

Quoted 5 lines
package/mysql/mysql.mk +4 -0
+# Jemalloc was added for TokuDB. Since its configure script seems somewhat broken
+# when it comes to cross-compilation we shall disable it and also disable TokuDB.
+MYSQL_OPTS += -DWITH_JEMALLOC=no
+MYSQL_OPTS += -DWITHOUT_TOKUDB=1

One line is probably enough for both.

Fixed.

Quoted 3 lines

package/mysql/mysql.mk line 46

Quoted 2 lines
package/mysql/mysql.mk +1 -0
+MYSQL_OPTS += -DCMAKE_BUILD_TYPE=Release

Not needed, already passed by Buildroot in pkg-cmake.mk.

Removed.

Quoted 3 lines

package/mysql/mysql.mk line 47

Quoted 2 lines
package/mysql/mysql.mk +1 -0
+MYSQL_OPTS += -DCMAKE_INSTALL_PREFIX=/usr

Not needed, already passed by Builroot in pkg-cmake.mk.

Removed.

Quoted 13 lines

package/mysql/mysql.mk line 57

Quoted 11 lines
package/mysql/mysql.mk +10 -0
+MYSQL_OPTS += -DINSTALL_DOCDIR=share/doc/mariadb-$(MYSQL_VERSION)
+MYSQL_OPTS += -DINSTALL_DOCREADMEDIR=share/doc/mariadb-$(MYSQL_VERSION)
+MYSQL_OPTS += -DINSTALL_MANDIR=share/man
+MYSQL_OPTS += -DINSTALL_MYSQLSHAREDIR=share/mysql
+MYSQL_OPTS += -DINSTALL_MYSQLTESTDIR=share/mysql/test
+MYSQL_OPTS += -DINSTALL_PLUGINDIR=lib/mysql/plugin
+MYSQL_OPTS += -DINSTALL_SBINDIR=sbin
+MYSQL_OPTS += -DINSTALL_SCRIPTDIR=bin
+MYSQL_OPTS += -DINSTALL_SQLBENCHDIR=share/mysql/bench
+MYSQL_OPTS += -DINSTALL_SUPPORTFILESDIR=share/mysql

Are these all needed?

Quoted 8 lines

Also, we prefer:

MYSQL_OPTS += \
	-DFOO=baz \
	-DBAR=foo \
	-Dthis=that

when there are multiple options to assign.

Updated.

Quoted 10 lines

package/mysql/mysql.mk line 68

Quoted 9 lines
package/mysql/mysql.mk +8 -0
+MYSQL_DEPENDENCIES = \
+	host-mysql \
+	ncurses \
+	openssl \
+	zlib \
+	libaio \
+	libxml2 \
+	libtool \

You really need libtool?

Removed.

Quoted 5 lines

package/mysql/mysql.mk line 71

Quoted 4 lines
package/mysql/mysql.mk +3 -0
+	readline
+
+HOST_MYSQL_DEPENDENCIES =

Not needed.

Removed.

Quoted 14 lines

package/mysql/mysql.mk line 80

Quoted 9 lines
package/mysql/mysql.mk +8 -0
+# Some helpers must be compiled for host in order to crosscompile mariadb for
+# the target. They are then included by import_executables.cmake which is
+# generated during the build of the host helpers. It is not necessary to build
+# the whole host package, only the "import_executables" target.
+# -DIMPORT_EXECUTABLES=$(BUILD_DIR)/host-mariadb-galera/import_executables.cmake
+# must then be passed to cmake during target build.
+HOST_MYSQL_MAKE_OPTS = import_executables
+MYSQL_IMPORT_EXECUTABLES += -DIMPORT_EXECUTABLES=$(HOST_MYSQL_BUILDDIR)/import_executables.cmake

I'm not sure why this import_executables.cmake file contains, but we generally don't like accessing stuff from a build directory during the build of another package. The host-mysql package is supposed to install things in $(HOST_DIR), and the target mysql package to use them from $(HOST_DIR).

See https://mariadb.com/kb/en/mariadb/cross-compiling-mariadb/
This has also been discussed in the other threads.

Quoted 11 lines

package/mysql/mysql.mk line 47

Quoted 2 lines
package/mysql/mysql.mk +2 -0
+
+HOST_MYSQL_CONF_OPTS = $(MYSQL_OPTS)

This seems very wrong, a MYSQL_OPTS is for the target. As an example, the host should be configured with CMAKE_INSTALL_PREFIX=$(HOST_DIR)/usr. Please use an explicit value for HOST_MYSQL_CONF_OPTS, with only the necessary options.

package/mysql/mysql.mk line 83

Quoted 1 line
package/mysql/mysql.mk +1 -0
+HOST_MYSQL_CONF_OPTS += $(MYSQL_HOST_OPTS)

Why do we have an intermediate MYSQL_HOST_OPTS variable then, rather than using HOST_MYSQL_CONF_OPTS directly?

Quoted 7 lines

package/mysql/mysql.mk line 50

Quoted 2 lines
package/mysql/mysql.mk +2 -0
+
+MYSQL_CONF_OPTS = $(MYSQL_OPTS)

Why do we have an intermediate MYSQL_OPTS variable? Just use MYSQL_CONF_OPTS directly.

package/mysql/mysql.mk line 86

Quoted 1 line
package/mysql/mysql.mk +1 -0
+MYSQL_CONF_OPTS += $(MYSQL_IMPORT_EXECUTABLES)

Intermediate variable not needed.

I will update.

Quoted 8 lines

package/mysql/mysql.mk line 90

Quoted 5 lines
package/mysql/mysql.mk +4 -0
+
+# Don't install host-mysql. We just need to build import_executable
+# Therefore only run 'true' and do nothing, not even the default action.
+HOST_MYSQL_INSTALL_CMDS = true

This would be the place where you could install the host-mysql stuff in $(HOST_DIR).

Quoted 5 lines

package/mysql/mysql.mk line 57

Quoted 3 lines
package/mysql/mysql.mk +1 -1
  [Service]
-ExecStartPre=/bin/sh -c 'test -d /var/mysql/mysql || mysql_install_db --user=mysql --ldata=/var/mysql'
+ExecStartPre=/bin/sh -c '[ "`ls -1 /var/lib/mysql | wc -l`" = "0" ] && mysql_install_db --basedir=/usr --datadir=/var/lib/mysql'

Why is the test on /var/mysql/mysql existence no longer good enough? It was much nicer than the test of the number of files in this directory.

I am using /var/lib/mysql as the data directory. This is the same directory as the home for the mysql user. The directory must be created or makedevs will fail. Therefore, the test on the directory will never allow mysql_install_db to run.

Quoted 7 lines

Thanks for this effort, it is much appreciated that someone takes care of updating this complicated package.

Thanks!

Thomas

Thanks to everyone for your reviews.

-Ryan

#11 lore raw

[Buildroot] [RFC v2] mysql: replace mysql with mariadb 10.1

In reply to Ryan Coe

Hi,

Quoted 5 lines · Ryan Coe

This patch represents my attempt to replace the aging mysql 5.1 that is currently shipped with Buildroot. I am replacing mysql altogether with mariadb version 10.1. I have been able to test this with both an arm and a x86_64 build, and it has also been tested with glibc and uclibc. I have not tested it with systemd.

Still broken on ARM uclibc

==
[ 61%] Building CXX object libmysqld/CMakeFiles/sql_embedded.dir/__/sql/item_row.cc.o /mnt/nfs/buildroot/buildroot/output/build/mysql-10.1.17/sql/signal_handler.cc:
In function ?void handle_fatal_signal(int)?:
/mnt/nfs/buildroot/buildroot/output/build/mysql-10.1.17/sql/signal_handler.cc:285:21:
error: ?thd? was not declared in this scope

      my_write_stderr(thd->query(), MY_MIN(65536U, thd->query_length()));
                      ^

==

Seems to be a bug where they declare thd within an #ifdef:

==
#ifdef HAVE_STACKTRACE
THD *thd;
#endif
==

But the code using thd is not within an #ifdef.

Quoted 6 lines

# Jemalloc was added for TokuDB. Since its configure script seems somewhat broken

# when it comes to cross-compilation we shall disable it and also 
disable TokuDB.
MYSQL_OPTS += -DWITH_JEMALLOC=no
MYSQL_OPTS += -DWITHOUT_TOKUDB=1

Is this still a problem with 10.1 ?
Recall it tries to use system jemalloc if present, instead of some bundled version now.

So could probably make it a soft depedency:

==
ifeq ($(BR2_PACKAGE_JEMALLOC),y)
MYSQL_DEPENDENCIES += jemalloc
endef
==

Quoted 6 lines

wait_for_pid() {
WAIT_DELAY=10
if [ ! -e $MYSQL_PID ]; then
while [ $WAIT_DELAY -gt 0 ]; do
if [ -e $MYSQL_PID ]; then
return 0

Quoted 8 lines

fi
sleep 1
: $((WAIT_DELAY -= 1))
done
return 1
fi
return 0
}

Is it certain that the server is ready to accept connections if there's a pid file?
The sample init file in support-files/mysql.server seems to use "mysqladmin ping" instead

==
wait_for_ready () {

i=0
while test $i -ne $service_startup_timeout ; do

if $bindir/mysqladmin ping >/dev/null 2>&1; then
log_success_msg
return 0
elif kill -0 $! 2>/dev/null ; then
: # mysqld_safe is still running
else
# mysqld_safe is no longer running, abort the wait loop break
fi

echo $echo_n ".$echo_c"
i=expr $i + 1
sleep 1

done

log_failure_msg
return 1
}
==

Yours sincerely,

Floris Bos

#12 lore raw

cover replace mysql with mariadb 10.0

In reply to Ryan Coe
Quoted 5 lines · Ryan Coe

This patch represents my attempt to replace the aging mysql 5.1 that is currently shipped with Buildroot. I am replacing mysql altogether with mariadb version 10.0. I have been able to test this with both an arm and a x86_64 build. I have not tested it with systemd. This patch is based on the work done by Sylvain Raybaud.

Would it be better to just add MariaDB rather than replace MySQL, there's reasons to use one over the other.

Signature · 2 lines
Stewart Smith
OPAL Architect, IBM.
#13 lore raw

cover replace mysql with mariadb 10.0

Quoted 9 lines · Stewart Smith
Quoted 5 lines · Ryan Coe

This patch represents my attempt to replace the aging mysql 5.1 that is currently shipped with Buildroot. I am replacing mysql altogether with mariadb version 10.0. I have been able to test this with both an arm and a x86_64 build. I have not tested it with systemd. This patch is based on the work done by Sylvain Raybaud.

Would it be better to just add MariaDB rather than replace MySQL, there's reasons to use one over the other.

I completely agree.

However, that's a bit more complicated, because we want mysql to become a
virtual package then, so any package that currently uses mysql can also use mariadb. And, since there are quite a few packages out there that select mysql, it would have to use an approach like libjpeg/jpeg-turbo to handle it.

The good news is: in a first step, you can add mariadb as a new package without
bothering with the virtual package.

Note that Sylvain Raybaud did that already, I'm not sure why his patches are no
longer on patchwork.

Regards,
Arnout

Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
#14 lore raw

cover replace mysql with mariadb 10.0

In reply to Stewart Smith

Hello,

Quoted 2 lines · Stewart Smith

Would it be better to just add MariaDB rather than replace MySQL, there's reasons to use one over the other.

In order to help in the debate, could you summarize some of those reasons ?

Thanks,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com