本帖最后由 myzr_soft 于 2019-11-5 09:16 编辑
主机平台: UBUNTU14.04
硬件平台:明远智睿MY-IMX6-EK200-6Q-1G
内核版本 :linux-4.1.15
交叉编译链:arm-poky-linux-gnueabi
文件系统:L4115-fsl-image-qt5-myimx6a9.tar.bz2
下载:
ncurses:
mysql-5.1.72:
解压: $ cd $ mkdir ncurses $ tar xzvf ncurses-6.1.tar.gz $ tar xzvf mysql-5.1.72.tar.gz
编译pc版本mysql备用: $ cd mysql-5.1.72/ $ sudo apt-get install libncurses5-dev $ ./configure -prefix=/usr/local/mysql $ make $ cd .. $ mv mysql-5.1.72 mysql-5.1.72-pc
配置交叉工具链: $ su # source /home/myzr/my-work/03_toolchain/fsl-imx-fb-glibc-x86_64-meta-toolchain-qt5-cortexa9hf-neon-toolchain-4.1.15-2.1.0/environment-setup-cortexa9hf-neon-poky-linux-gnueabi
交叉编译ncurses: # cd ncurses-6.1/ ./configure --prefix=/home/myzr/ncurses/ --host=arm-poky-linux-gnueabi --without-cxx --without-cxx-binding --without-ada --without-manpages --without-progs --without-tests --with-shared --enable-static # make -j4 # make install
交叉编译mysql: # cd .. # tar xzvf mysql-5.1.72.tar.gz # cd mysql-5.1.72 # gedit configure 将四处: if test "$cross_compiling" = yes; then { { $as_echo "$as_meLINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { { $as_echo "$as_meLINENO: 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"skipcorss_compiping test"; # { { $as_echo "$as_meLINENO: error: in \`$ac_pwd':" >&5 #$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} #{ { $as_echo "$as_meLINENO: 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
# mkdir /usr/local/mysql # ./configure --host=arm-poky-linux-gnueabi --enable-static --with-named-curses-libs=/home/myzr/ncurses/lib/libncurses.a --prefix=/usr/local/mysql --without-debug --without-docs --without-man --without-bench --with-charset=gb2312 --with-extra-charsets=ascii,latin1,utf8
# vi storage/innobase/include/univ.i 将227行的:#error "Error: InnoDB's ulint must be of the same size as void*" 修改为://#error "Error: InnoDB's ulint must be of the same size as void*" # vi storage/innodb_plugin/include/univ.i 将358行的:#error "Error: InnoDB's ulint must be of the same size as void*" 修改为://#error "Error: InnoDB's ulint must be of the same size as void*" # make
出现错误: ./gen_lex_hash > lex_hash.h-t /bin/sh: ./gen_lex_hash: cannot execute binary file # cp ../mysql-5.1.72-pc/sql/gen_lex_hash sql/ # touch -m sql/gen_lex_hash # make
出现错误: sql_parse.cc:5741:21: error: operator '<' has no left operand # vi sql/sql_parse.cc 加入:#define STACK_DIRECTION 1 # make
拷贝pc的/usr/local/mysql到开发板的相同目录 在开发板上执行: 设置环境变量或将/usr/local/mysql/bin 下面的可执行文件复制到/usr/sbin 目录下 # export PATH="$PATH:/usr/local/mysql/bin"
添加/etc/my.conf 配置文件 # vi /etc/my.conf
内容如下: datadir=/var/lib/mysql 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=1 [mysqld_safe] log-error=/var/log/mysqld.log pid-file=/var/run/mysqld/mysqld.pid
因为在/var/run目录下没有mysqld/mysqld.pid,手工建立: # mkdir /var/run/mysqld # touch /var/run/mysqld/mysqld.pid
安装数据库: #mysql_install_db -u root
启动mysql服务: # mysqld_safe --user=root --skip-grant-tables --skip-networking & # mysql
|