MySQL在ARM平台上的编译错误一例
由于ARM平台开发板CPU本身处理能力有限,这样在MySQL编译的时候过程非常漫长,更可恶的还出现了错误,如下:
1 2 3 4 5 6 7 8 9 10 | [ 68%] Building C object libmysql/CMakeFiles/clientlib.dir/__/sql-common/client_plugin.c.o /root/lnmp1.0-full/mysql-5.5.28/sql-common/client_plugin.c: In function ‘mysql_client_plugin_init’: /root/lnmp1.0-full/mysql-5.5.28/sql-common/client_plugin.c:252:5: error: incompatible type for argument 5 of ‘add_plugin’ /root/lnmp1.0-full/mysql-5.5.28/sql-common/client_plugin.c:120:1: note: expected ‘va_list’ but argument is of type ‘int’ /root/lnmp1.0-full/mysql-5.5.28/sql-common/client_plugin.c: In function ‘mysql_client_register_plugin’: /root/lnmp1.0-full/mysql-5.5.28/sql-common/client_plugin.c:310:5: error: incompatible type for argument 5 of ‘add_plugin’ /root/lnmp1.0-full/mysql-5.5.28/sql-common/client_plugin.c:120:1: note: expected ‘va_list’ but argument is of type ‘int’ make[2]: *** [libmysql/CMakeFiles/clientlib.dir/__/sql-common/client_plugin.c.o] Error 1 make[1]: *** [libmysql/CMakeFiles/clientlib.dir/all] Error 2 make: *** [all] Error 2 |
处理方法如下应用下面Patch,文件名arm_fix_client_plugin.patch,内容:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | --- mysql-5.5.28.orig/sql-common/client_plugin.c +++ mysql-5.5.28/sql-common/client_plugin.c @@ -233,6 +233,7 @@ int mysql_client_plugin_init() { MYSQL mysql; struct st_mysql_client_plugin **builtin; + va_list dummy; if (initialized) return 0; @@ -249,7 +250,7 @@ int mysql_client_plugin_init() pthread_mutex_lock(&LOCK_load_client_plugin); for (builtin= mysql_client_builtins; *builtin; builtin++) - add_plugin(&mysql, *builtin, 0, 0, 0); + add_plugin(&mysql, *builtin, 0, 0, dummy); pthread_mutex_unlock(&LOCK_load_client_plugin); @@ -293,6 +294,7 @@ struct st_mysql_client_plugin * mysql_client_register_plugin(MYSQL *mysql, struct st_mysql_client_plugin *plugin) { + va_list dummy; if (is_not_initialized(mysql, plugin->name)) return NULL; @@ -307,7 +309,7 @@ mysql_client_register_plugin(MYSQL *mysq plugin= NULL; } else - plugin= add_plugin(mysql, plugin, 0, 0, 0); + plugin= add_plugin(mysql, plugin, 0, 0, dummy); pthread_mutex_unlock(&LOCK_load_client_plugin); return plugin; |
应用补丁方法:
1 | patch -p0 < arm_fix_client_plugin.patch mysql-5.5.28/sql-common/client_plugin.c |