目前我使用的Mysql的版本为mysql-5.1.72.tar.gz,可在网上下载对应版本的mysql的压缩包。由于移植mysql库需要用到libncurses.a静态库,所以在移植mysql之前,我们需要先移植ncurses,目前我使用的ncurses库版本为ncurses-5.9.tar.gz,以下是移植ncusrse库的步骤:
(1)解压库文件:
tar zxvf ncurses-5.9.tar.gz -C /opt/mysql/ncurses(2)进入库文件路径,配置环境变量:
CC=arm-linux-gnueabihf-gcc ./configure –host=arm-linux-gnueabihf -prefix=/opt/mysql/ncurse –enable-static
(3)编译、安装:
make
make install
安装ncurses库时出现问题:arm-linux-ranlib command not found
解决办法: 先用下sudo -i命令取得root权限。然后再执行make install。
由于移植mysql需要用到一个本地编译的文件gen_lex_hash,所以需要先本地编译mysql,操作如下:
在./configure前需要屏蔽部分代码,否则配置环境变量会出错,无法配置,
vi ./configure,该文件应该有这样的代码“ if test "$cross_compiling" = yes; then { { $as_echo "$as_me:$LINENO: error: in `$ac_pwd':" >&5 $as_echo "$as_me: error: in `$ac_pwd':" >&2;}
{ { $as_echo "$as_me:$LINENO: error: cannot run test program while cross
compiling See `config.log' for more details." >&5 $as_echo "$as_me: error: cannot run test program while cross compiling See `config.log' for more details." >&2;}
{ (exit 1); exit 1; }; }; }
Else
”
将此代码改为“将这些代码改为:
if test "$cross_compiling" = yes; then
echo “skip …..!”
#{ { $as_echo "$as_me:$LINENO: error: in `$ac_pwd':" >&5 #$as_echo "$as_me: error: in `$ac_pwd':" >&2;}
#{ { $as_echo "$as_me:$LINENO: error: cannot run test program while cross compiling See `config.log' for more details." >&5
#$as_echo "$as_me: error: cannot run test program while cross compiling See `config.log' for more details." >&2;}
#{ (exit 1); exit 1; }; }; }
Else
”
这样的代码总共有四处,都要屏蔽掉,分别在26302,48120,48226,48439行。