环境ubuntu18.04,使用交叉编译工具链aarch64-linux-gnu。
主要参考以下两篇博客:
精简可以参考这篇博客:
以下主要讲不同以及注意事项:
1、需要手动编译OPENSSL,版本openssl-1.1.1g,编译后路径为openssl-arm-install;
2、cmake 中指定参数 -DOPENSSL_ROOT_DIR=/home/zfadmin/mysqlCompile/openssl-arm-install
3、不需要编译boost,只需要指定mysql中自带的boost路径即可;
4、make install 的时候指定目录: make install DESTDIR=/opt/mysql_arm_install/
5、移植过后需要手动添加my.cnf
1、compile-arm设置如下:
#! /bin/sh
path='dirname $0'
cmake .. -DWITH_DEBUG=0 -DSTACK_DIRECTION=1 -DENABLE_DOWNLOADS=1 -DOPENSSL_ROOT_DIR=/home/zfadmin/mysqlCompile/openssl-arm-install -DDOWNLOAD_BOOST=1 -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATIOIN=utf8_general_ci -DEXTRA_CHARSETS=all -DENABLED_LOCAL_INFILE=1 -DWITH_BOOST=../boost -DCMAKE_CXX_COMPILER=aarch64-linux-gnu-g++ -DCMAKE_C_COMPILER=aarch64-linux-gnu-gcc -DCURSES_INCLUDE_PATH=/home/zfadmin/mysqlCompile/ncurses-6.1-arm/include -DCURSES_LIBRARY=/home/zfadmin/mysqlCompile/ncurses-6.1-arm/lib/libncurses.a
2、手动添加my.cnf文件,其中包含了字符支持
[mysqld]
datadir=/usr/local/mysql/data
socket=/tmp/mysql.sock
user=root
#Default to using old password format for compatibility with mysql 3.x
#clients (those using the mysqlclient10 compatibility package).
#old_passwords=0
group_concat_max_len=4294967295
skip-name-resolve
lower_case_table_names=1
interactive_timeout=28800000
wait_timeout=28800000
#innodb_flush_log_at_trx_commit=2
sync_binlog=1
bind-address = 0.0.0.0
port=13306
character-set-server=utf8
collation-server=utf8_general_ci
3、设置mysqld开机自启
5、提示找不到/home/zfadmin/mysql-5.7.28/BUILD_ARM/scripts/comp_sql: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory
使用find能找到/usr/aarch64-linux-gnu/lib/libc.so.6,添加libc路径到命令行中
export LD_LIBRARY_PATH=/usr/aarch64-linux-gnu/lib:$LD_LIBRARY_PATH