Ubunt16.04下交叉编译mysql-5.7.30源码具体过程的简单随笔-----仅供参考------------

----主要参考文章----
1.Ubuntu16.04进行交叉编译MYSQL5.7.18的具体步骤----https://blog.csdn.net/fhyocean/article/details/74960005
2.Ubuntu 16.04交叉编译mysql 5.7.25并移植到ARM aarch64----https://blog.csdn.net/FF_lz/article/details/102676341?utm_medium=distribute. pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-12.nonecase&depth_1
-utm_source=distribute.pc_relevant.none-task-blog- BlogCommendFromMachineLearnPai2-12.nonecase


----交叉编译器-----------------

/opt/gcc-linaro-arm-linux-gnueabihf-4.9-2014.07_linux/bin
/opt/gcc-linaro-arm-linux-gnueabihf-4.9-2014.07_linux/bin/arm-linux-gnueabihf-gcc
/opt/gcc-linaro-arm-linux-gnueabihf-4.9-2014.07_linux/bin/arm-linux-gnueabihf-g++


-----使用的原材料----------------------

gcc-linaro-arm-linux-gnueabihf-4.9-2014.07_linux.tar.xz
mysql-5.7.30.tar.gz
boost_1_59_0.tar.gz
ncurses-6.1.tar.gz-------------这个没去交叉编译也可以编译成功
openssl-1.1.1g.tar.gz


-----cmake版本----------------------
root@xqhrs232-virtual-machine:/home/xqhrs232# apt-get install cmake 正在读取软件包列表... 完成 正在分析软件包的依赖关系树 正在读取状态信息... 完成 cmake 已经是最新版 (3.5.1-1ubuntu3)。 cmake 已设置为手动安装。 升级了 0 个软件包,新安装了 0 个软件包,要卸载 0 个软件包,有 440 个软件包未被升级。


1、交叉编译ncurse
----
./configure --prefix=/opt/ncurses_arm --host=arm-linux-gnueabihf CC=/opt/gcc-linaro-arm-linux-gnueabihf-4.9/bin/arm-linux-gnueabihf-gcc CXX=/opt/gcc-linaro-arm-linux-gnueabihf-4.9/bin/arm-linux-gnueabihf-g++ --without-progs
./configure --prefix=/opt/ncurses_arm --host=arm-linux-gnueabihf CC=/opt/gcc-linaro-arm-linux-gnueabihf-4.9-2014.07_linux/bin/arm-linux-gnueabihf-gcc CXX=/opt/gcc-linaro-arm-linux-gnueabihf-4.9-2014.07_linux/bin/arm-linux-gnueabihf-g++ --without-progs
   make
   make install


2、交叉编译openssl
----openssl的编译与交叉编译----https://blog.csdn.net/xqhrs232/article/details/106140163
./config no-asm -shared --prefix=/opt/openssl_arm
make
make install


3.pc版本的cmake选项
//------------------------------------使用下面的cmake配置选项-------------------------------------------------------------------
//####----下面的配置可以产生Makefile文件 //####----也可以编译成功----
cmake -DCMAKE_INSTALL_PREFIX=/home/mysql_pc -DMYSQL_DATADIR=/home/mysql_pc/data -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DMYSQL_TCP_PORT=3306 -DMYSQL_USER=mysql -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_ARCHIVE_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DWITH_MEMPRY_STORAGE_ENGINE=1 -DDOWNLOAD_BOOST=1 -DWITH_BOOST=/opt/boost_1_59_0
  remove CMakeCache.txt and rerun cmake.On Debian/Ubuntu, package name is libncurses5-dev, on Redhat and derivates it is ncurses-devel.
Call Stack (most recent call first): cmake/readline.cmake:100 (FIND_CURSES)
  cmake/readline.cmake:193 (MYSQL_USE_BUNDLED_EDITLINE)
  CMakeLists.txt:581 (MYSQL_CHECK_EDITLINE)
---- apt-get install libncurses5-dev
root@xqhrs232-virtual-machine:/home/xqhrs232/mysql-5.7.30# apt-get install libncurses5-dev
E: 无法获得锁 /var/lib/dpkg/lock-frontend - open (11: 资源暂时不可用) E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), is another process using it?
----sudo rm /var/lib/dpkg/lock-frontend
//#----很耗内存------make 就好,开8个线程很容易把编译过程搞挂!!! make  -j8
make install

 


4.arm版本的cmake选项
//#----很耗内存------make 就好,开8个线程很容易把编译过程搞挂!!! make  -j8
make install
//------------------------------------使用下面的cmake配置选项-------------------------------------------------------------------
cmake . -LH -DCMAKE_INSTALL_PREFIX=/opt/mysql_arm -DMYSQL_DATADIR=/opt/ mysql_arm/data -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci - DEXTRA_CHARSETS=all -DENABLED_LOCAL_INFILE=1 -DCMAKE_CXX_COMPILER=/opt/gcc- linaro-arm-linux-gnueabihf-4.9-2014.07_linux/bin/arm-linux-gnueabihf-g++ - DCMAKE_C_COMPILER=/opt/gcc-linaro-arm-linux-gnueabihf-4.9-2014.07_linux/bin/ arm-linux-gnueabihf-gcc -DWITH_BOOST=/opt/boost_1_59_0 -DWITH_SSL=/opt/ openssl_arm -DCURSES_INCLUDE_PATH=/opt/ncurses_arm/include -DCURSES_LIBRARY=/ opt/ncurses_arm/lib/libncurses.a
//-----------------------------------------------编译报错的编译百分比12%-------------------------------------------------------
rm -rf    /opt/mysql-5.7.30/extra/comp_err
cp   /home/xqhrs232/mysql-5.7.30/extra/comp_err      /opt/mysql-5.7.30/extra/
touch   /opt/mysql-5.7.30/extra/comp_err
make   //make again!!!
//----------------------------------------------编译报错的编译百分比13%------------------------------------------------------
rm -rf  /opt/mysql-5.7.30/libmysql/libmysql_api_test
cp   /home/xqhrs232/mysql-5.7.30/libmysql/libmysql_api_test   /opt/mysql-5.7.30/libmysql/
touch   /opt/mysql-5.7.30/libmysql/libmysql_api_test
make   //make again!!!

//----------------------------------------------编译报错的编译百分比14%---------------------------------------------
/opt/mysql-5.7.30/storage/innobase/include/os0atomic.ic
/opt/mysql-5.7.30/storage/innobase/include/os0atomic.h
cp /home/xqhrs232/os0atomic.ic        /opt/mysql-5.7.30/storage/innobase/include/
cp /home/xqhrs232/os0atomic.h         /opt/mysql-5.7.30/storage/innobase/include/
ls -l  /opt/mysql-5.7.30/storage/innobase/include/
rm -rf   /opt/mysql-5.7.30/storage/innobase/include/os0atomic.ic
rm -rf   /opt/mysql-5.7.30/storage/innobase/include/os0atomic.h
make   //make again!!!
//----------------------------------------------编译报错的编译百分比31%---------------------------------------------------
rm -rf   /opt/mysql-5.7.30/sql/gen_lex_hash
cp        /home/xqhrs232/mysql-5.7.30/sql/gen_lex_hash        /opt/mysql-5.7.30/sql/
touch    /opt/mysql-5.7.30/sql/gen_lex_hash
make   //make again!!!
//----------------------------------------------编译报错的编译百分比39%--------------------------------------------------------
rm -rf   /opt/mysql-5.7.30/scripts/comp_sql
cp        /home/xqhrs232/mysql-5.7.30/scripts/comp_sql        /opt/mysql-5.7.30/scripts/
touch    /opt/mysql-5.7.30/scripts/comp_sql
make   //make again!!!
//----------------------------------------------编译报错的编译百分比39%--------------------------------------------------------
rm -rf   /opt/mysql-5.7.30/sql/gen_lex_token
cp        /home/xqhrs232/mysql-5.7.30/sql/gen_lex_token        /opt/mysql-5.7.30/sql/
touch    /opt/mysql-5.7.30/sql/gen_lex_token
make   //make again!!!
//----------------------------------------------编译报错的编译百分比67%--------------------------------------------------------
rm -rf  /opt/mysql-5.7.30/extra/protobuf/protoc
cp   /home/xqhrs232/mysql-5.7.30/extra/protobuf/protoc     /opt/mysql-5.7.30/extra/protobuf/
touch  /opt/mysql-5.7.30/extra/protobuf/protoc
make   //make again!!!
//----------------------------------------------编译完成--------------------------------------------------------
make install
在/opt//opt/mysql_arm/lib可见
root@xqhrs232-virtual-machine:/home/xqhrs232# ls -l /opt/mysql_arm/lib 总用量 324828
-rw-r--r-- 1 root root  13965696 5月  16 23:39 libmysqlclient.a lrwxrwxrwx 1 root root        20 5月  17 01:30 libmysqlclient.so -> libmysqlclient.so.20
lrwxrwxrwx 1 root root        25 5月  17 01:30 libmysqlclient.so.20 -> libmysqlclient.so.20.3.17
-rw-r--r-- 1 root root   8014245 5月  16 23:39 libmysqlclient.so.20.3.17
-rw-r--r-- 1 root root 310592042 5月  17 01:28 libmysqld.a
-rw-r--r-- 1 root root     34006 5月  17 00:45 libmysqlservices.a drwxr-xr-x 2 root root      4096 5月  17 01:30 pkgconfig drwxr-xr-x 3 root root      4096 5月  17 01:30 plugin

xqhrs232@xqhrs232-virtual-machine:/opt/mysql_arm/lib$ file libmysqlclient.so.20.3.17 
libmysqlclient.so.20.3.17: ELF 32-bit LSB shared object, ARM, EABI5 version 1 (SYSV), dynamically linked, BuildID[sha1]=407a14d4cde304ade96cfe6f449b3d8fc7ff727a, not stripped 


 

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值