最新MySQL8.0.35交叉编译ARM32在RV1126上运行:
想要编译个ARM32位的MYSQL,找遍全网没找到满意答案,搞定后写个文章方便后面参考
0 编译环境说明
系统环境与关键位置信息
# 编译使用Ubuntu20.04
Linux ubuntu20 5.15.0-102-generic #112~20.04.1-Ubuntu SMP Thu Mar 14 14:28:24 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
# 编译器根目录
/home/pi/atk/rv1126/sdk/atk-rv1126/prebuilts/gcc/linux-x86/arm/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/bin
# 文件系统根目录
/home/pi/atk/rv1126/sdk/atk-rv1126/buildroot/output/alientek_rv1126/host/arm-buildroot-linux-gnueabihf/sysroot/lib
# MySQL根目录
/home/pi/atk/rv1126/app/mysql-8.0.35
1 下载boost(解压缩可用,无需编译)
下载地址: https://boostorg.jfrog.io/artifactory/main/release/1.77.0/source/boost_1_77_0.tar.bz2
cp boost_1_77_0.tar.bz2 /home/pi/atk/rv1126/app/
cd /home/pi/atk/rv1126/app/
tar jxvf boost_1_77_0.tar.bz2 # 解压缩即可,无需编译
2 下载openssl源码编译(首先编译 X86-64位版本,第二次再编译arm版本)
提示:版本和目标系统版本一致,这里使用1.1.1f
下载地址: https://www.openssl.org/source/old/1.1.1/index.html
cp openssl-1.1.1f.tar.gz /home/pi/atk/rv1126/app/
cd /home/pi/atk/rv1126/app/
tar zxvf openssl-1.1.1f.tar.gz
cd openssl-1.1.1f
./config no-asm shared --prefix=$PWD/__install # 编译x86版本
make # 等待编译完成
make install # 安装
3 下载ncurses源码编译(首先编译 X86-64位版本,第二次再编译arm版本)
提示:这里使用ncurses-6.4
下载地址: http://ftp.gnu.org/gnu/ncurses/ncurses-6.4.tar.gz
cp ncurses-6.4.tar.gz /home/pi/atk/rv1126/app/
cd /home/pi/atk/rv1126/app/
tar zxvf ncurses-6.4.tar.gz
cd ncurses-6.4
./configure --prefix=`pwd`/__install -with-yielding-select=no # 编译x86版本
make -j32 # 编译,根据电脑性能选择线程数量
make install # 安装
4 下载mysql8.0源码编译(第一次编译X86-64位版本)
提示:这里使用版本mysql-8.0.35
https://downloads.mysql.com/archives/community/
cp mysql-8.0.35.tar.gz /home/pi/atk/rv1126/app/
cd /home/pi/atk/rv1126/app/
tar zxvf mysql-8.0.35.tar.gz
cd mysql-8.0.35
mkdir build
cd build
# 配置编译选项,首先编译一遍X86版本(确保x86版本没问题,重点:备份一些x86的文件)
cmake .. \
-DCMAKE_BUILD_TYPE:STRING=Release \
-DCMAKE_INSTALL_PREFIX=/home/pi/atk/rv1126/app/mysql-8.0.35/build/__install \
-DMYSQL_DATADIR=/home/pi/atk/rv1126/app/mysql-8.0.35/build/__install/data \
-DENABLED_LOCAL_INFILE=1 \
-DENABLE_DTRACE=0 \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_EMBEDDED_SERVER=0 \
-DMYSQL_MAINTAINER_MODE=0 \
-DDOWNLOAD_BOOST:BOOL=1 \
-DWITH_BOOST=/home/pi/atk/rv1126/app/boost_1_77_0 \
-DWITH_SSL=system \
-DOPENSSL_ROOT_DIR=/home/pi/atk/rv1126/app/openssl-1.1.1f/__install \
-DCURSES_INCLUDE_PATH=/home/pi/atk/rv1126/app/ncurses-6.4/__install/include \
-DCURSES_LIBRARY=/home/pi/atk/rv1126/app/ncurses-6.4/__install/lib/libncurses.a \
-DWITH_LIBEVENT=bundled \
-DRESOLV_LIBRARY=/snap/gnome-3-38-2004/140/usr/lib/x86_64-linux-gnu/libresolv.so \
-DWITH_TEST_TRACE_PLUGIN=0 \
-DIGNORE_AIO_CHECK=1 \
-DBUILD_CONFIG=mysql_release \
-DWITH_UNIT_TESTS=0
make -j24 # 编译x86版本
make install # 安装
cd..
mv build ../build # 移动到上级目录,备份x86版本
cd /home/pi/atk/rv1126/app/ # 返回
5 备份openssl和的ncurses的x86版本
提示:mv 移动并修改名称来备份
mv openssl-1.1.1f openssl-1.1.1f-x86 # 备份
mv ncurses-6.4 ncurses-6.4-x86
6 编译openssl的ARM32版本
提示:还是之前的源码
tar zxvf openssl-1.1.1f.tar.gz
cd openssl-1.1.1f
./config no-asm shared --prefix=$PWD/__install --cross-compile-prefix=/home/pi/atk/rv1126/sdk/atk-rv1126/prebuilts/gcc/linux-x86/arm/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/bin/arm-linux-gnueabihf- # 编译器要设置正确
make # 会报错
vim Makefile # 搜索-m64 将其删除 移动有两处见下图
make
make install
vim Makefile # 搜索-m64 将其删除
7 编译ncurses的ARM32版本
提示:还是之前的源码
tar zxvf ncurses-6.4.tar.gz
cd ncurses-6.4
export PATH="/home/pi/atk/rv1126/sdk/atk-rv1126/prebuilts/gcc/linux-x86/arm/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/bin/:$PATH" # 加个临时的环境变量来指定编译器
./configure --prefix=`pwd`/__install -with-yielding-select=no CC=arm-linux-gnueabihf-gcc --host=arm-linux-gnueabihf # 指定为ARM版本
make -j32
make install
8 准备工作OK开始编译ARM版本的MySQL
提示:还是之前的源码,初一cmake参数,多了交叉编译选项
下面几项是和X86不同的内容:
-DRESOLV_LIBRARY=/home/pi/atk/rv1126/sdk/atk-rv1126/buildroot/output/alientek_rv1126/host/arm-buildroot-linux-gnueabihf/sysroot/usr/lib/libresolv.so
-DCMAKE_CXX_COMPILER=/home/pi/atk/rv1126/sdk/atk-rv1126/prebuilts/gcc/linux-x86/arm/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/bin/arm-linux-gnueabihf-g++
-DCMAKE_C_COMPILER=/home/pi/atk/rv1126/sdk/atk-rv1126/prebuilts/gcc/linux-x86/arm/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/bin/arm-linux-gnueabihf-gcc
-DCMAKE_SYSTEM_PROCESSOR=arm
cd /home/pi/atk/rv1126/app
mkdir build-arm # 创建个文件夹,保存ARM程序,非常重要
cd mysql-8.0.35
mkdir build # X86移动走后需要重新创建build文件夹
cd build
cmake .. \
-DCMAKE_BUILD_TYPE:STRING=Release \
-DCMAKE_INSTALL_PREFIX=/home/pi/atk/rv1126/app/mysql-8.0.35/build/__install \
-DMYSQL_DATADIR=/home/pi/atk/rv1126/app/mysql-8.0.35/build/__install/data \
-DENABLED_LOCAL_INFILE=1 \
-DENABLE_DTRACE=0 \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_EMBEDDED_SERVER=0 \
-DMYSQL_MAINTAINER_MODE=0 \
-DDOWNLOAD_BOOST=1 \
-DWITH_BOOST=/home/pi/atk/rv1126/app/boost_1_77_0 \
-DWITH_SSL=system \
-DOPENSSL_ROOT_DIR=/home/pi/atk/rv1126/app/openssl-1.1.1f/__install \
-DCURSES_INCLUDE_PATH=/home/pi/atk/rv1126/app/ncurses-6.4/__install/include \
-DCURSES_LIBRARY=/home/pi/atk/rv1126/app/ncurses-6.4/__install/lib/libncurses.a \
-DWITH_LIBEVENT=bundled \
-DRESOLV_LIBRARY=/home/pi/atk/rv1126/sdk/atk-rv1126/buildroot/output/alientek_rv1126/host/arm-buildroot-linux-gnueabihf/sysroot/usr/lib/libresolv.so \
-DWITH_TEST_TRACE_PLUGIN=0 \
-DIGNORE_AIO_CHECK=1 \
-DBUILD_CONFIG=mysql_release \
-DWITH_UNIT_TESTS=0 \
-DCMAKE_CXX_COMPILER=/home/pi/atk/rv1126/sdk/atk-rv1126/prebuilts/gcc/linux-x86/arm/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/bin/arm-linux-gnueabihf-g++ \
-DCMAKE_C_COMPILER=/home/pi/atk/rv1126/sdk/atk-rv1126/prebuilts/gcc/linux-x86/arm/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/bin/arm-linux-gnueabihf-gcc \
-DCMAKE_SYSTEM_PROCESSOR=arm
# 中途会遇到很多问题,考验耐心的时刻到了
问题1 cmake 配置libevent报错处理
错误:
LIBEVENT version must be at least 2.1, found /.修改/home/pi/atk/rv1126/app/mysql-8.0.35/cmake/libevent.cmake 来跳过检测
vim /home/pi/atk/rv1126/app/mysql-8.0.35/cmake/libevent.cmake
++++++++++++++++++++++++++++++++++++++++++++++++++++++
FUNCTION(FIND_LIBEVENT_VERSION LIBEVENT_INCLUDE_DIRS)
SET(TEST_SRC
"#include <event.h>
#include <stdio.h>
int main()
{
fprintf(stdout, \"%s\", LIBEVENT_VERSION);
}
"
)
FILE(WRITE
"${CMAKE_BINARY_DIR}/find_libevent_version.c"
"${TEST_SRC}"
)
TRY_RUN(TEST_RUN_RESULT COMPILE_TEST_RESULT
${CMAKE_BINARY_DIR}
"${CMAKE_BINARY_DIR}/find_libevent_version.c"
CMAKE_FLAGS "-DINCLUDE_DIRECTORIES=${LIBEVENT_INCLUDE_DIRS}"
COMPILE_OUTPUT_VARIABLE OUTPUT
RUN_OUTPUT_VARIABLE RUN_OUTPUT
)
SET(LIBEVENT_VERSION "2.1.11-stable") #zcy 添加内容
SET(COMPILE_TEST_RESULT TRUE) #zcy 添加内容
SET(RUN_OUTPUT "2.1.11-stable") #zcy 添加内容
# MESSAGE(STATUS "TRY_EVENT TEST_RUN_RESULT is ${TEST_RUN_RESULT}")
# MESSAGE(STATUS "TRY_EVENT COMPILE_TEST_RESULT is ${COMPILE_TEST_RESULT}")
# MESSAGE(STATUS "TRY_EVENT COMPILE_OUTPUT_VARIABLE is ${OUTPUT}")
# MESSAGE(STATUS "TRY_EVENT RUN_OUTPUT_VARIABLE is ${RUN_OUTPUT}")
IF(COMPILE_TEST_RESULT)
SET(LIBEVENT_VERSION_STRING "${RUN_OUTPUT}")
STRING(REGEX REPLACE
"([.-0-9]+).*" "\\1" LIBEVENT_VERSION "${LIBEVENT_VERSION_STRING}")
MESSAGE(STATUS "LIBEVENT_VERSION_STRING ${LIBEVENT_VERSION_STRING}") #zcy 添加内容
MESSAGE(STATUS "LIBEVENT_VERSION (${WITH_LIBEVENT}) ${LIBEVENT_VERSION}") #zcy 添加内容
SET(LIBEVENT_VERSION ${LIBEVENT_VERSION} CACHE INTERNAL "" FORCE)
ELSE()
MESSAGE(WARNING "Could not determine LIBEVENT_VERSION")
ENDIF()
MESSAGE(STATUS "LIBEVENT_VERSION (${WITH_LIBEVENT}) ${LIBEVENT_VERSION}")
MESSAGE(STATUS "LIBEVENT_INCLUDE_DIRS ${LIBEVENT_INCLUDE_DIRS}")
MESSAGE(STATUS "LIBEVENT_LIBRARIES ${LIBEVENT_LIBRARIES}")
ENDFUNCTION(FIND_LIBEVENT_VERSION)
++++++++++++++++++++++++++++++++++++++++++++++++++++++
/home/pi/atk/rv1126/app/mysql-8.0.35/cmake/libevent.cmake
添加以下内容,下面图片方便看
再次cmake 配置
提示: 再次执行下面命令
注意以下3项参数是否正确:
-DCURSES_LIBRARY=/home/pi/atk/rv1126/app/ncurses-6.4/__install/lib/libncurses.a
-DWITH_LIBEVENT=bundled
-DRESOLV_LIBRARY=/home/pi/atk/rv1126/sdk/atk-rv1126/buildroot/output/alientek_rv1126/host/arm-buildroot-linux-gnueabihf/sysroot/usr/lib/libresolv.so \
cd /home/pi/atk/rv1126/app/mysql-8.0.35/build
cmake .. \
-DCMAKE_BUILD_TYPE:STRING=Release \
-DCMAKE_INSTALL_PREFIX=/home/pi/atk/rv1126/app/mysql-8.0.35/build/__install \
-DMYSQL_DATADIR=/home/pi/atk/rv1126/app/mysql-8.0.35/build/__install/data \
-DENABLED_LOCAL_INFILE=1 \
-DENABLE_DTRACE=0 \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_EMBEDDED_SERVER=0 \
-DMYSQL_MAINTAINER_MODE=0 \
-DDOWNLOAD_BOOST=1 \
-DWITH_BOOST=/home/pi/atk/rv1126/app/boost_1_77_0 \
-DWITH_SSL=system \
-DOPENSSL_ROOT_DIR=/home/pi/atk/rv1126/app/openssl-1.1.1f/__install \
-DCURSES_INCLUDE_PATH=/home/pi/atk/rv1126/app/ncurses-6.4/__install/include \
-DCURSES_LIBRARY=/home/pi/atk/rv1126/app/ncurses-6.4/__install/lib/libncurses.a \
-DWITH_LIBEVENT=bundled \
-DRESOLV_LIBRARY=/home/pi/atk/rv1126/sdk/atk-rv1126/buildroot/output/alientek_rv1126/host/arm-buildroot-linux-gnueabihf/sysroot/usr/lib/libresolv.so \
-DWITH_TEST_TRACE_PLUGIN=0 \
-DIGNORE_AIO_CHECK=1 \
-DBUILD_CONFIG=mysql_release \
-DWITH_UNIT_TESTS=0 \
-DCMAKE_CXX_COMPILER=/home/pi/atk/rv1126/sdk/atk-rv1126/prebuilts/gcc/linux-x86/arm/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/bin/arm-linux-gnueabihf-g++ \
-DCMAKE_C_COMPILER=/home/pi/atk/rv1126/sdk/atk-rv1126/prebuilts/gcc/linux-x86/arm/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/bin/arm-linux-gnueabihf-gcc \
-DCMAKE_SYSTEM_PROCESSOR=arm
# 执行成功了,可以开始编译了
make # 注意这里一定要单线程编译,中途会遇到各种问题,会让人崩溃
问题2 protoc: Exec format error
提示:编译到6%出现问题
/bin/sh: 1: …/…/runtime_output_directory/protoc: Exec format error
这种错误是说生成的protoc是ARM架构,无法执行
简单粗暴,用之前备份的x86版本替换重点1,替换前要先把ARM版本的备份出来,这个就是我们未来的ARM版程序
重点2,添加x86的程序运行时库
# 创建备份目录文件夹
mkdir ../../build-arm/runtime_output_directory # 创建备份目录
mkdir ../../build-arm/library_output_directory # 创建备份目录
mkdir ../../build-arm/json_schema_embedder # 创建备份目录
export LD_LIBRARY_PATH=/home/pi/atk/rv1126/app/build/library_output_directory/:$LD_LIBRARY_PATH # 指定运行时库(非常重要,要不还原的x86程序会报错无法运行)
# 核心工作,备份ARM版本
cp runtime_output_directory/protoc ../../build-arm/runtime_output_directory/protoc # 备份ARM版本
cp runtime_output_directory/protoc-3.19.4 ../../build-arm/runtime_output_directory/protoc-3.19.4 # 备份ARM版本
# 然后用X86版本覆盖
cp ../../build/runtime_output_directory/protoc-3.19.4 runtime_output_directory/. # x86版本覆盖
make # 继续编译
问题3 uca9dump: Exec format error
提示:编译到25%出现问题
/bin/sh: 1: …/runtime_output_directory/uca9dump: Exec format error
问题和处理方法同上
cp runtime_output_directory/uca9dump ../../build-arm/runtime_output_directory/uca9dump # 备份ARM版本
cp ../../build/runtime_output_directory/uca9dump runtime_output_directory/. # X86版本覆盖ARM版本
make # 继续编译
问题4 comp_err: Exec format error
提示:编译到26%出现问题
/bin/sh: 1: …/runtime_output_directory/comp_err: Exec format error
问题和处理方法同上
cp runtime_output_directory/comp_err ../../build-arm/runtime_output_directory/comp_err # 备份ARM版本
cp ../../build/runtime_output_directory/comp_err runtime_output_directory/. # X86版本覆盖ARM版本
make # 继续编译
问题5 comp_sql: Exec format error
提示:编译到28%出现问题
/home/pi/atk/rv1126/app/mysql-8.0.35/build/runtime_output_directory/comp_sql: Exec format error
问题和处理方法同上
cp runtime_output_directory/comp_sql ../../build-arm/runtime_output_directory/comp_sql # 备份ARM版本
cp ../../build/runtime_output_directory/comp_sql runtime_output_directory/. # X86版本覆盖ARM版本
make # 继续编译
问题6 xprotocol_plugin: program not found or is not executable
提示:编译到38%出现问题
/home/pi/atk/rv1126/app/mysql-8.0.35/build/runtime_output_directory/xprotocol_plugin: program not found or is not executable
问题和处理方法同上
cp runtime_output_directory/xprotocol_plugin ../../build-arm/runtime_output_directory/xprotocol_plugin # 备份ARM版本
cp ../../build/runtime_output_directory/xprotocol_plugin runtime_output_directory/. # X86版本覆盖ARM版本
make # 继续编译
问题7 gen_lex_hash: Exec format error
提示:编译到42%出现问题
/bin/sh: 1: …/runtime_output_directory/gen_lex_hash: Exec format error
问题和处理方法同上
cp runtime_output_directory/gen_lex_hash ../../build-arm/runtime_output_directory/gen_lex_hash # 备份ARM版本
cp ../../build/runtime_output_directory/gen_lex_hash runtime_output_directory/.
make # 继续编译
问题8 gen_keyword_list: Exec format error
提示:编译到42%出现问题
/bin/sh: 1: …/runtime_output_directory/gen_keyword_list: Exec format error
问题和处理方法同上
cp runtime_output_directory/gen_keyword_list ../../build-arm/runtime_output_directory/gen_keyword_list # 备份ARM版本
cp ../../build/runtime_output_directory/gen_keyword_list runtime_output_directory/
make # 继续编译
问题9 gen_lex_token: Exec format error
提示:编译到42%出现问题
/bin/sh: 1: …/runtime_output_directory/gen_lex_token: Exec format error
问题和处理方法同上
cp runtime_output_directory/gen_lex_token ../../build-arm/runtime_output_directory/gen_lex_token # 备份ARM版本
cp ../../build/runtime_output_directory/gen_lex_token runtime_output_directory/.
make # 继续编译
问题10 mysqld --no-defaults --help failed:
提示:编译到67%出现问题
mysqld --no-defaults --help failed:
/home/pi/atk/rv1126/app/mysql-8.0.35/build/runtime_output_directory/mysqld:
1: Syntax error: word unexpected (expecting “)”)
问题和处理方法同上,这就是ARM版本的核心程序,一定要备份好这就是ARM版本的核心程序,一定要备份好
cp runtime_output_directory/mysqld ../../build-arm/runtime_output_directory/mysqld # 备份ARM版本
cp ../../build/runtime_output_directory/mysqld runtime_output_directory/.
make # 继续编译
问题11 build_id_test: Exec format error
提示:编译到70%出现问题
/bin/sh: 1: ./build_id_test: Exec format error
*** 正在删除文件“runtime_output_directory/build_id_test”
因为自动删除了,无法备份不备份,直接覆盖
cp ../../build/runtime_output_directory/build_id_test runtime_output_directory/.
make # 继续编译
问题12 library_output_directory/libmysqlclient.so.21.2.35
提示:编译到71%出现问题
注意,处理方式不一样(最最最重要的一步)
/home/pi/atk/rv1126/sdk/atk-rv1126/prebuilts/gcc/linux-x86/arm/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/bin/…/lib/gcc/arm-linux-gnueabihf/8.3.0/…/…/…/…/arm-linux-gnueabihf/bin/ld: warning: libssl.so.1.1, needed by …/library_output_directory/libmysqlclient.so.21.2.35, not found (try using -rpath or -rpath-link)
/home/pi/atk/rv1126/sdk/atk-rv1126/prebuilts/gcc/linux-x86/arm/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/bin/…/lib/gcc/arm-linux-gnueabihf/8.3.0/…/…/…/…/arm-linux-gnueabihf/bin/ld: warning: libcrypto.so.1.1, needed by …/library_output_directory/libmysqlclient.so.21.2.35, not found (try using -rpath or -rpath-link)
/home/pi/atk/rv1126/sdk/atk-rv1126/prebuilts/gcc/linux-x86/arm/gcc-arm-8.3-2019.03-x86_64-arm-linux-
。。。中间内容省略
make[2]: *** [libmysql/CMakeFiles/libmysql_api_test.dir/build.make:85:runtime_output_directory/libmysql_api_test] 错误 1这个问题要注意,问题出在 library_output_directory/libmysqlclient.so.21.2.35
cp library_output_directory/libmysqlclient.so.21.2.35 ../../build-arm/library_output_directory/libmysqlclient.so.21.2.35 # 备份ARM,注意和之前不一样
cp ../../build/library_output_directory/libmysqlclient.so.21.2.35 library_output_directory/ # x86版本覆盖
make # 之后继续报错 libmysql_api_test
cp ../../build/runtime_output_directory/libmysql_api_test runtime_output_directory/. # x86版本覆盖,无法备份,直接覆盖
make # 继续make
问题13 comp_client_err: Exec format error
提示:编译到81%出现问题
/bin/sh: 1: …/runtime_output_directory/comp_client_err: Exec format error
问题和处理方法同上
cp runtime_output_directory/comp_client_err ../../build-arm/runtime_output_directory/comp_client_err # 备份ARM版本
cp ../../build/runtime_output_directory/comp_client_err runtime_output_directory/.
make # 继续编译
问题14 json_schema_embedder: Exec format error
提示:编译到92%出现问题
/bin/sh: 1: /home/pi/atk/rv1126/app/mysql-8.0.35/build/router/src/json_schema_embedder/json_schema_embedder: Exec format error
问题和处理方法同上
cp router/src/json_schema_embedder/json_schema_embedder ../../build-arm/json_schema_embedder/json_schema_embedder # 备份ARM版本
cp ../../build/router/src/json_schema_embedder/json_schema_embedder router/src/json_schema_embedder/.
make # 继续编译,后续没有错误,直到编译完成
make install # 安装编译,遇到错误
编译完成的图片
问题15 安装编译遇到错误,手动凑齐二进制文件
提示:编译完成后,安装编译遇到问题
CMake Error at libmysql/cmake_install.cmake:66 (file):
file RPATH_CHANGE could not write new RPATH:无法使用make install 此时只能手动来凑文件,目前没找到解决方法,有办法的大神麻烦教教小弟
手动凑文件的笨方法如下:
mkdir mysql8.0.35_arm # 创建目标文件夹
cp -r runtime_output_directory mysql8.0.35_arm/bin # 执行文件
cp -r library_output_directory mysql8.0.35_arm/lib # 库文件
cp -r include mysql8.0.35_arm/ # 头文件
cp -r packaging mysql8.0.35_arm # 配置文件
cd mysql8.0.35_arm/bin/ # 进入bin目录
file * # 有9个文件是x86的,见后面图片,刚好对应备份的9个文件
cp ../../../../build-arm/runtime_output_directory/* . ###*/# 直接从备份的arm文件拷贝回来(重点)
cd ../lib # 进入lib目录
file * # 有1个文件是x86的,同样拷贝回来
cp ../../../../build-arm/library_output_directory/libmysqlclient.so.21.2.35 . # 拷贝回来
file * # 再次查看,已经全部是ARM了
# 至此,编译工作全部完成,拷贝到开发板测试
cd /atk/rv1126/app/mysql-8.0.35/build
scp -r mysql8.0.35_arm root@192.168.50.15:/demo/ # 拷贝到RV1126开发板测试
9个x86文件,这些就是编译过程中备份的文,拷贝回来覆盖就完美了✌️✌️✌️
9 开发板测试
下面的操作都在RV1126开发板完成
cd /demo/mysql8.0.35_arm # 进入拷贝好的文件目录
mkdir data # 创建个data目录
cd bin/
export LD_LIBRARY_PATH=/demo/mysql8.0.35_arm/lib:$LD_LIBRARY_PATH # 指定运行时库
./mysqld --initialize --user=mysql --basedir=/demo/mysql8.0.35_arm --datadir=/demo/mysql8.0.35_arm/data # 随机密码初始化库 随机密码xWtf49Ip!7.%
# 小错误 mysqld: Can't open shared library
chmod 666 /demo/mysql8.0.35_arm/lib/plugin/component_reference_cache.so # 给它权限解决
./mysqld --daemonize --pid-file=/demo/mysql8.0.35_arm/data/mysqld.pid --user=mysql # 启动数据库,启动成功
./mysql -uroot -p -S /tmp/mysql.sock # 密码前面初始化的时候能看到,测试连接可以成功
./mysql -uroot -p -h 127.0.0.1 -P 3306 # 测试IP连接,也OK
ALTER USER 'root'@'localhost' IDENTIFIED BY 'Abc#123'; # 修改登录密码
flush privileges; # 刷新
use mysql; # 切换到用户数据库
select host,user from user; # 查询用户权限
update user set host='%' where user='root'; # 添加远程访问权限
select host,user from user; # 再次查看确认添加成功
flush privileges; # 刷新下
# 然后尝试 Navicat 登录
Navicat登录成功,至此全部完成
文章来源:https://www.toymoban.com/news/detail-856912.html
参考连接
https://blog.csdn.net/goulibo7573/article/details/122438882
https://blog.csdn.net/SWX230162/article/details/110533527文章来源地址https://www.toymoban.com/news/detail-856912.html
到了这里,关于MySQL交叉编译ARM32位版本在RV1126上运行的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!