产品信息:AI计算盒SE5
GNU版本:GCC/G++编译器默认为9.3.0
linaro@bm1684:/data/mongo$ cat /etc/os-release NAME="Ubuntu" VERSION="20.04 LTS (Focal Fossa)" ID=ubuntu ID_LIKE=debian PRETTY_NAME="Ubuntu 20.04 LTS" VERSION_ID="20.04" HOME_URL="https://www.ubuntu.com/" SUPPORT_URL="https://help.ubuntu.com/" BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/" PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy" VERSION_CODENAME=focal UBUNTU_CODENAME=focal
linaro@bm1684:/data/mongo$ uname -a Linux bm1684 5.4.217-bm1684-gc696259809f0 #1 SMP Mon Mar 27 06:38:58 CST 2023 aarch64 aarch64 aarch64 GNU/Linux
linaro@bm1684:/data/mongo$ dpkg --print-architecture arm64
linaro@bm1684:/data/mongo$ arch aarch64
linaro@bm1684:/data/mongo$ cat /proc/cpuinfo processor : 0 BogoMIPS : 100.00 Features : fp asimd evtstrm aes pmull sha1 sha2 crc32 cpuid model name : bm1684 CPU implementer : 0x41 CPU architecture: 8 CPU variant : 0x0 CPU part : 0xd03 CPU revision : 4 processor : 1 BogoMIPS : 100.00 Features : fp asimd evtstrm aes pmull sha1 sha2 crc32 cpuid model name : bm1684 CPU implementer : 0x41 CPU architecture: 8 CPU variant : 0x0 CPU part : 0xd03 CPU revision : 4 processor : 2 BogoMIPS : 100.00 Features : fp asimd evtstrm aes pmull sha1 sha2 crc32 cpuid model name : bm1684 CPU implementer : 0x41 CPU architecture: 8 CPU variant : 0x0 CPU part : 0xd03 CPU revision : 4 processor : 3 BogoMIPS : 100.00 Features : fp asimd evtstrm aes pmull sha1 sha2 crc32 cpuid model name : bm1684 CPU implementer : 0x41 CPU architecture: 8 CPU variant : 0x0 CPU part : 0xd03 CPU revision : 4 processor : 4 BogoMIPS : 100.00 Features : fp asimd evtstrm aes pmull sha1 sha2 crc32 cpuid model name : bm1684 CPU implementer : 0x41 CPU architecture: 8 CPU variant : 0x0 CPU part : 0xd03 CPU revision : 4 processor : 5 BogoMIPS : 100.00 Features : fp asimd evtstrm aes pmull sha1 sha2 crc32 cpuid model name : bm1684 CPU implementer : 0x41 CPU architecture: 8 CPU variant : 0x0 CPU part : 0xd03 CPU revision : 4 processor : 6 BogoMIPS : 100.00 Features : fp asimd evtstrm aes pmull sha1 sha2 crc32 cpuid model name : bm1684 CPU implementer : 0x41 CPU architecture: 8 CPU variant : 0x0 CPU part : 0xd03 CPU revision : 4 processor : 7 BogoMIPS : 100.00 Features : fp asimd evtstrm aes pmull sha1 sha2 crc32 cpuid model name : bm1684 CPU implementer : 0x41 CPU architecture: 8 CPU variant : 0x0 CPU part : 0xd03 CPU revision : 4
linaro@bm1684:/data/mongo$ lscpu Architecture: aarch64 CPU op-mode(s): 32-bit, 64-bit Byte Order: Little Endian CPU(s): 8 On-line CPU(s) list: 0-7 Thread(s) per core: 1 Core(s) per socket: 4 Socket(s): 2 Vendor ID: ARM Model: 4 Model name: Cortex-A53 Stepping: r0p4 CPU max MHz: 2300.0000 CPU min MHz: 1150.0000 BogoMIPS: 100.00 Vulnerability Itlb multihit: Not affected Vulnerability L1tf: Not affected Vulnerability Mds: Not affected Vulnerability Meltdown: Not affected Vulnerability Mmio stale data: Not affected Vulnerability Retbleed: Not affected Vulnerability Spec store bypass: Not affected Vulnerability Spectre v1: Mitigation; __user pointer sanitization Vulnerability Spectre v2: Not affected Vulnerability Srbds: Not affected Vulnerability Tsx async abort: Not affected Flags: fp asimd evtstrm aes pmull sha1 sha2 crc32 cpuid
https://releases.linaro.org/components/toolchain/binaries/
博主选择的是6.3版本的交叉编译链
选择aarch64-linux-gun
选择gcc-linaro-6.3.1-2017.05-x86_64_aarch64-linux-gnu.tar.xz
https://developer.arm.com/downloads/-/gnu-a
https://docs.docker.com/engine/install/ubuntu/#install-using-the-repository
要安装Docker Engine,您需要以下Ubuntu版本之一的64位版本:
Ubuntu Mantic 23.10
Ubuntu Jammy 22.04 (LTS)
Ubuntu Focal 20.04 (LTS)
适用于Ubuntu的Docker Engine与x86_64(或amd64)、armhf、arm64、s390x和ppc64le(ppc64el)架构兼容。
for pkg in docker.io docker-doc docker-compose docker-compose-v2 podman-docker containerd runc; do sudo apt-get remove $pkg; done
# Add Docker's official GPG key: sudo apt-get update sudo apt-get install ca-certificates curl sudo install -m 0755 -d /etc/apt/keyrings sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc sudo chmod a+r /etc/apt/keyrings/docker.asc # Add the repository to Apt sources: echo \ "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \ $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \ sudo tee /etc/apt/sources.list.d/docker.list > /dev/null sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
sudo docker run hello-world
# 拉取docker Ubuntu 20.04 sudo docker pull ubuntu:20.04 # 设置容器持久化存储(my-ubuntu-data文件自动同步到docker文件/data,反之亦然) mkdir -p ~/my-ubuntu-data sudo docker run -it -v ~/my-ubuntu-data:/data ubuntu:20.04 /bin/bash # 以下命令可参考 # 管理容器。列出当前正在运行的容器 sudo docker ps # 或者。列出所有的容器,包括正在运行的、已经停止的以及未运行的容器。 sudo docker ps -a # 重新连接到容器的 shell。5d429110f4fb 为 sudo docker exec -it 5d429110f4fb /bin/bash # 停止容器 sudo docker stop # 启动容器 sudo docker start # 删除容器 sudo docker rm # 退出容器 exit 或者按 Ctrl+D # 后台运行容器 sudo docker run 的 -d 参数,并配置端口转发
apt-get install python2.7 python2.7 --version ln -s /usr/bin/python2.7 /usr/bin/python2 python2 --version curl https://bootstrap.pypa.io/pip/2.7/get-pip.py --output get-pip.py python2.7 get-pip.py pip2 --version python2 -m pip --version
# 交叉编译openssl生成lib库和include wget https://launchpad.net/ubuntu/+archive/primary/+sourcefiles/openssl/1.1.1f-1ubuntu2/openssl_1.1.1f.orig.tar.gz tar -zxvf openssl_1.1.1f.orig.tar.gz cd openssl-1.1.1f # 配置 ./config --prefix=/usr/local/ssl --openssldir=/usr/local/ssl \ --libdir=lib \ no-asm shared \ --cross-compile-prefix=/data/gcc-linaro-6.3.1-2017.05-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu- \ -fPIC
vi Makefie
找到PLATFORM定义行,修改为: PLATFORM=linux-aarch64
找到CNF_CFLAGS定义行,去掉-m64。修改为: CNF_CFLAGS=-pthread
找到CNF_CXXFLAGS定义行,去掉-m64。修改为: CNF_CXXFLAGS=-std=c++11 -pthread
保存修改后的Makefile
make
make install
make clean
在AI计算盒子SE5上运行
/bin/ld.gold -llzma --verbose
一般情况下在/lib/aarch64-linux-gnu
下面
/lib/aarch64-linux-gnu/liblzma.so
移植到docker上,路径/data/lzma-aarch64/lib
即(my-ubuntu-data文件自动同步到docker文件/data):
~/my-ubuntu-data/lzma-aarch64/lib
在CentOS7 x86系统非docker内
mkdir -p ~/my-ubuntu-data/lzma-aarch64/lib
在SE5的ARM64盒子上(注意修改user_name和host_name)
scp -r /lib/aarch64-linux-gnu/liblzma.so user_name@host_name:~/my-ubuntu-data/lzma-aarch64/lib
在CentOS7 x86系统的docker内
chmod -R +x /data/lzma-aarch64/
头文件通常安装在 /usr/include
或 /usr/local/include
下,具体取决于库的安装方式和版本。对于 libcurl4-openssl-dev
,可以使用以下命令来查找其安装的头文件:
dpkg -L libcurl4-openssl-dev | grep include
输出结果
/usr/include /usr/include/aarch64-linux-gnu /usr/include/aarch64-linux-gnu/curl /usr/include/aarch64-linux-gnu/curl/curl.h /usr/include/aarch64-linux-gnu/curl/curlver.h /usr/include/aarch64-linux-gnu/curl/easy.h /usr/include/aarch64-linux-gnu/curl/mprintf.h /usr/include/aarch64-linux-gnu/curl/multi.h /usr/include/aarch64-linux-gnu/curl/stdcheaders.h /usr/include/aarch64-linux-gnu/curl/system.h /usr/include/aarch64-linux-gnu/curl/typecheck-gcc.h /usr/include/aarch64-linux-gnu/curl/urlapi.h
头文件安装在
/usr/include/aarch64-linux-gnu/curl
库文件(.so
或 .a
文件)通常安装在 /usr/lib
或 /usr/local/lib
下,或者在特定于架构的目录中,如 /usr/lib/arm-linux-gnueabihf/
(对于 armhf)或 /usr/lib/aarch64-linux-gnu/
(对于 arm64)。对于 libcurl4-openssl-dev
,可以使用以下命令来查找其安装的库文件:
dpkg -L libcurl4-openssl-dev | grep lib
输出结果
/usr/lib /usr/lib/aarch64-linux-gnu /usr/lib/aarch64-linux-gnu/libcurl.a /usr/lib/aarch64-linux-gnu/libcurl.la /usr/lib/aarch64-linux-gnu/pkgconfig /usr/lib/aarch64-linux-gnu/pkgconfig/libcurl.pc /usr/share/aclocal/libcurl.m4 /usr/share/doc/libcurl4-openssl-dev /usr/share/doc/libcurl4-openssl-dev/copyright /usr/lib/aarch64-linux-gnu/libcurl.so /usr/share/doc/libcurl4-openssl-dev/NEWS.Debian.gz /usr/share/doc/libcurl4-openssl-dev/changelog.Debian.gz
库文件安装在
/usr/lib/aarch64-linux-gnu
主要文件是 libcurl.so
在CentOS7 x86的非docker内(my-ubuntu-data文件自动同步到docker文件/data)
mkdir -p ~/my-ubuntu-data/aarch64-curl/include mkdir -p ~/my-ubuntu-data/aarch64-curl/lib
在SE5的ARM64盒子上(注意修改user_name和host_name)
scp -r /usr/include/aarch64-linux-gnu/curl user_name@host_name:~/my-ubuntu-data/aarch64-curl/include scp -r /usr/lib/aarch64-linux-gnu/libcurl.so user_name@host_name:~/my-ubuntu-data/aarch64-curl/lib
在CentOS7 x86系统的docker内
chmod -R +x /data/aarch64-curl/
主要环境:python2,MongoDB v4.0版本,docker ubuntu:20.04,gcc-linaro-6.3.1-2017.05-x86_64_aarch64-linux-gnu,openssl 1.1.1f头文件和共享库,liblzma.so共享库,curl头文件和共享库
apt update apt install libcurl-dev apt install libcurl4-openssl-dev apt install scons apt install python-dev git clone https://github.com/mongodb/mongo.git cd mongo git checkout v4.0 python2 -m pip install pyyaml typing python2.7 -m pip install -r buildscripts/requirements.txt chmod -R +x /data/gcc-linaro-6.3.1-2017.05-x86_64_aarch64-linux-gnu/ # 编译目标 SCons Targets -------------- * mongod * mongos * mongo * core (includes mongod, mongos, mongo) * all # 编译指令。编译mongod python2 buildscripts/scons.py \ CCFLAGS="-march=armv8-a+crc -mtune=cortex-a53" \ CC=/data/gcc-linaro-6.3.1-2017.05-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-gcc \ CXX=/data/gcc-linaro-6.3.1-2017.05-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-g++ \ --ssl \ CPPPATH="/data/aarch64-curl/include /usr/local/ssl/include" \ LIBPATH="/data/aarch64-curl/lib /usr/local/ssl/lib /data/lzma-aarch64/lib" \ mongod --disable-warnings-as-errors # 编译指令。编译mongo python2 buildscripts/scons.py \ CCFLAGS="-march=armv8-a+crc -mtune=cortex-a53" \ CC=/data/gcc-linaro-6.3.1-2017.05-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-gcc \ CXX=/data/gcc-linaro-6.3.1-2017.05-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-g++ \ --ssl \ CPPPATH="/data/aarch64-curl/include /usr/local/ssl/include" \ LIBPATH="/data/aarch64-curl/lib /usr/local/ssl/lib /data/lzma-aarch64/lib" \ mongo
build/opt/mongo/mongod build/opt/mongo/mongo
在docker内
mkdir -p /data/mongodb_build_4_0 cp -r build/opt/mongo /data/mongodb_build_4_0
在CentOS7 非docker内,复制交叉编译好的MongoDB到AI计算盒子SE5上。
scp -r ~/my-ubuntu-data/mongodb_build_4_0 user_name@host_name:/data
apt update apt upgrade apt install build-essential apt-get install libcurl4-openssl-dev apt install build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libsqlite3-dev libreadline-dev libffi-dev wget curl llvm liblzma-dev python-openssl wget https://www.python.org/ftp/python/3.7.10/Python-3.7.10.tgz tar xvf Python-3.7.10.tgz cd Python-3.7.10 ./configure --enable-optimizations make -j$(nproc) make install # mv /usr/bin/python3 /usr/bin/python3.6-backup # mv /usr/bin/pip3 /usr/bin/pip3.6-backup # ln -s /usr/local/bin/python3.7 /usr/bin/python3 # ln -s /usr/local/bin/pip3.7 /usr/bin/pip3 python3 --version pip3 --version apt install curl apt install git apt install vim apt install python3.7-dev apt install libssl-dev git clone https://github.com/mongodb/mongo.git cd mongo git checkout v4.4 python3 -m pip install -r etc/pip/compile-requirements.txt # 编译目标目录 The following targets can be named on the scons command line to build only certain components: * `install-mongod` * `install-mongos` * `install-mongo` or `install-shell` * `install-servers` (includes `mongod` and `mongos`) * `install-core` (includes `mongod`, `mongos`, `mongo`) * `install-devcore` (includes `mongod`, `mongos`, and `mongo`; the name is forward-compatible with 6.0+ branches) * `install-all` # X86系统:python3 buildscripts/scons.py install-mongod --disable-warnings-as-errors # 交叉编译openssl生成lib库和include wget https://launchpad.net/ubuntu/+archive/primary/+sourcefiles/openssl/1.1.1f-1ubuntu2/openssl_1.1.1f.orig.tar.gz tar -zxvf openssl_1.1.1f.orig.tar.gz cd openssl-1.1.1f # 配置 ./config --prefix=/usr/local/ssl --openssldir=/usr/local/ssl \ --libdir=lib \ no-asm shared \ --cross-compile-prefix=/data/gcc-arm-8.2-2018.08-x86_64-aarch64-linux-gnu/bin/aarch64-linux-gnu- \ -fPIC # 修改Makefile文件 vi Makefiel # 找到PLATFORM定义行,修改为: PLATFORM=linux-aarch64 # 找到CNF_CFLAGS定义行,修改为: CNF_CFLAGS=-pthread # 找到CNF_CXXFLAGS定义行,修改为: CNF_CXXFLAGS=-std=c++11 -pthread # 保存修改后的Makefile # 编译 make # 安装 make install # 清理之前的编译产物: make clean # 交叉编译mongod # LIBPATH参数可以通过空格添加多个lib库。/data/lzma-aarch64/lib下面的lzma so库是从SE5盒子找来的。使用/bin/ld.gold -llzma --verbose查找路径。 python3 buildscripts/scons.py \ CCFLAGS="-march=armv8-a+crc -mtune=cortex-a53" \ CC=/data/gcc-arm-8.2-2018.08-x86_64-aarch64-linux-gnu/bin/aarch64-linux-gnu-gcc \ CXX=/data/gcc-arm-8.2-2018.08-x86_64-aarch64-linux-gnu/bin/aarch64-linux-gnu-g++ \ --ssl \ CPPPATH=/usr/local/ssl/include \ LIBPATH="/usr/local/ssl/lib /data/lzma-aarch64/lib" \ install-mongod --disable-warnings-as-errors # 编译结果路径 /data/mongo/build # mongod服务器可执行文件 /data/mongo/build/install/bin/mongod
要创建mongod.conf
配置文件并添加内容,包括数据目录和日志文件,按照以下步骤进行:
首先,在MongoDB 安装目录下的 etc
子目录中创建一个新的配置文件,命名为 mongod.conf
。例如,如果 MongoDB 安装目录是 /data/mongo
,则可以在 /data/mongo/etc
中创建此文件。
使用文本编辑器(如 vim
, nano
, 或 gedit
)来创建和编辑文件:
vim /etc/mongod.conf
在 mongod.conf
文件中,添加各种配置选项。设置数据目录和日志文件:
# mongod.conf # for documentation of all options, see: # http://docs.mongodb.org/manual/reference/configuration-options/ # Where and how to store data. #storage: # dbPath: /data/db # journal: # enabled: true storage: dbPath: /var/lib/mongo # where to write logging data. systemLog: destination: file logAppend: true path: /var/log/mongodb/mongod.log # network interfaces net: port: 27017 bindIp: 127.0.0.1 # process management security processManagement: # fork: true # fork and run in background fork: false # fork and run in background #security: # authorization: enabled
在这个配置中:
storage.dbPath
指定了 MongoDB 存储其数据文件的目录。systemLog.destination
和 systemLog.path
设置了日志文件的输出位置。net.port
指定了 MongoDB 监听的端口号。processManagement.fork
设置为 true
,这样 mongod
会在后台作为守护进程运行。请注意,确保指定的日志目录(在这个例子中是 /var/log/mongodb/
)和数据目录(/data/db
)存在并且 MongoDB 进程有权限写入这些目录。
groupadd mongodb useradd -r -g mongodb -s /usr/sbin/nologin mongodb usermod -aG mongodb linaro mkdir -p /var/log/mongodb chown -R mongodb:mongodb /var/log/mongodb sudo chmod 755 /var/log/mongodb mkdir -p /var/lib/mongo chown -R mongodb:mongodb /var/lib/mongo sudo chmod 755 /var/lib/mongo sudo touch /var/log/mongodb/mongod.log sudo chown mongodb:mongodb /var/log/mongodb/mongod.log
在这个命令中,mongodb
是运行 MongoDB 服务的用户,linaro
用户也可以执行。
mongod
:一旦创建了配置文件并设置了所需的选项,就可以使用 --config
参数启动 mongod
了:
cd /data/mongodb_build_4_0/mongo ./mongod --config /etc/mongod.conf
现在,当启动 mongod
时,它将使用在 mongod.conf
文件中指定的配置选项。如果一切正常,应该能够在指定的日志文件中看到 MongoDB 的日志输出,并且数据将被存储在指定的数据目录中。
如果没有遇到任何错误消息,并且希望确认 MongoDB 是否正在运行,可以尝试使用以下命令:
ps aux | grep mongod
另外,还可以尝试连接到 MongoDB 服务器来验证其是否正在监听端口:
mongo --host localhost --port 27017
退出mongo
exit
可选。为了避免必须指定MongoDB二进制文件的路径,可以将这些二进制文件复制到一个列在PATH变量中的目录,例如/usr/local/bin:
sudo cp /data/mongodb_build_4_0/mongo/mongod /usr/local/bin/ sudo cp /data/mongodb_build_4_0/mongo/mongo /usr/local/bin/
查看MongoDB数据库版本
mongod --version
输出结果
db version v4.0.28-7-g274f2fd git version: 274f2fddd6a0f975a678e8a953e704f7be6dda14 OpenSSL version: OpenSSL 1.1.1f 31 Mar 2020 allocator: tcmalloc modules: none build environment: distarch: aarch64 target_arch: aarch64
Couldn't find OpenSSL crypto.h header and library See /data/mongo/build/scons/config.log for details
缺失aarch64平台的openssl文件和指定参数。
在进行交叉编译时,编译器无法找到与目标平台(aarch64)相匹配的 OpenSSL 头文件和库文件,这就导致了编译失败。交叉编译openssl aarch64版本即可。
参考交叉编译openssl-1.1.1f章节
Checking for C library lzma… no
Cannot find system library ‘lzma’ required for use with libunwin
# 配置lzma动态库。从SE5盒子上查找so库移植到docker上 /bin/ld.gold -llzma --verbose
移植SE5盒子路径:
/data/lzma-aarch64/lib
参考准备lzma和curl头文件和共享库
Checking for curl_global_init(0) in C library curl… no
Could not find
Compiling build/scons/opt/sconf_temp/conftest_61.o
build/scons/opt/sconf_temp/conftest_61.c:3:23: fatal error: curl/curl.h: No such file or directory
#include “curl/curl.h”
^
compilation terminated.
scons: Configure: no
直接将 arm64 系统上已安装的 libcurl 库文件复制到 x86 编译主机上,然后在编译时指定这个路径,就可以成功链接到 curl 库了
查找头文件路径:
头文件通常安装在 /usr/include
或 /usr/local/include
下,具体取决于库的安装方式和版本。对于 libcurl4-openssl-dev
,使用以下命令来查找其安装的头文件:
dpkg -L libcurl4-openssl-dev | grep include
输出结果
/usr/include /usr/include/aarch64-linux-gnu /usr/include/aarch64-linux-gnu/curl /usr/include/aarch64-linux-gnu/curl/curl.h /usr/include/aarch64-linux-gnu/curl/curlver.h /usr/include/aarch64-linux-gnu/curl/easy.h /usr/include/aarch64-linux-gnu/curl/mprintf.h /usr/include/aarch64-linux-gnu/curl/multi.h /usr/include/aarch64-linux-gnu/curl/stdcheaders.h /usr/include/aarch64-linux-gnu/curl/system.h /usr/include/aarch64-linux-gnu/curl/typecheck-gcc.h /usr/include/aarch64-linux-gnu/curl/urlapi.h
头文件安装在 /usr/include/aarch64-linux-gnu/curl
查找库文件路径:
库文件(.so
或 .a
文件)通常安装在 /usr/lib
或 /usr/local/lib
下,或者在特定于架构的目录中,如 /usr/lib/arm-linux-gnueabihf/
(对于 armhf)或 /usr/lib/aarch64-linux-gnu/
(对于 arm64)。对于 libcurl4-openssl-dev
,使用以下命令来查找其安装的库文件:
dpkg -L libcurl4-openssl-dev | grep lib
输出结果
/usr/lib /usr/lib/aarch64-linux-gnu /usr/lib/aarch64-linux-gnu/libcurl.a /usr/lib/aarch64-linux-gnu/libcurl.la /usr/lib/aarch64-linux-gnu/pkgconfig /usr/lib/aarch64-linux-gnu/pkgconfig/libcurl.pc /usr/share/aclocal/libcurl.m4 /usr/share/doc/libcurl4-openssl-dev /usr/share/doc/libcurl4-openssl-dev/copyright /usr/lib/aarch64-linux-gnu/libcurl.so /usr/share/doc/libcurl4-openssl-dev/NEWS.Debian.gz /usr/share/doc/libcurl4-openssl-dev/changelog.Debian.gz
库文件安装在 /usr/lib/aarch64-linux-gnu
目录下,主要文件是 libcurl.so
将这些文件复制到 x86 编译主机的某个路径,比如 /data/aarch64-curl
# 在x86的docker上 mkdir -p ~/my-ubuntu-data/aarch64-curl/include mkdir -p ~/my-ubuntu-data/aarch64-curl/lib # 在SE5的ARM64盒子上 scp -r /usr/include/aarch64-linux-gnu/curl user_name@host_name:~/my-ubuntu-data/aarch64-curl/include scp -r /usr/lib/aarch64-linux-gnu/libcurl.so user_name@host_name:~/my-ubuntu-data/aarch64-curl/lib
降低MongoDB数据库版本4.4到数据库4.0和降低编译器版本gcc-arm-8.2-2018.08-x86_64-aarch64-linux-gnu到低版本gcc-linaro-6.3.1-2017.05-x86_64_aarch64-linux-gnu编译即可。
Illegal instruction
2024-04-02T15:38:30.049+0800 F CONTROL [main] Failed global initialization: FileNotOpen: Failed to open "/var/log/mongodb/mongod.log"
/var/log/mongodb/
和 /var/lib/mongo/
目录的权限:sudo chown -R linaro:mongodb /var/log/mongodb sudo chown -R linaro:mongodb /var/lib/mongo
linaro
用户具有所有权限:sudo chmod -R 777 /var/log/mongodb sudo chmod -R 777 /var/lib/mongo
scp .\jdk-8u401-linux-aarch64.tar.gz linaro@192.168.96.50:/data
tar -xvzf jdk-8u401-linux-aarch64.tar.gz
/usr/local/
:sudo mv jdk1.8.0_401 /usr/local/
sudo nano /etc/profile.d/javaenv.sh
在打开的文件中添加:
export JAVA_HOME=/usr/local/jdk1.8.0_401 export PATH=$PATH:$JAVA_HOME/bin
source /etc/profile.d/javaenv.sh
java -version javac -version
sudo apt update sudo apt install nginx
sudo systemctl start nginx
sudo systemctl status nginx
sudo ufw allow 'Nginx HTTP' sudo ufw allow 'Nginx HTTPS'
sudo vi /etc/profile
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/data/iristar/boxApp/dll:/system/lib:/system/usr/lib/aarch64-linux-gnu export LD_LIBRARY_PATH=/usr/local/aarch64-linux-gnu:$LD_LIBRARY_PATH
source /etc/profile
在Linux中配置环境变量,有多种方法可以实现,其中包括但不限于以下几种方式:
export
命令可以直接在当前终端会话中设置环境变量。例如,要设置LD_LIBRARY_PATH
,可以执行:export LD_LIBRARY_PATH="/usr/local/aarch64-linux-gnu:$LD_LIBRARY_PATH"
export LD_LIBRARY_PATH=/usr/local/aarch64-linux-gnu:$LD_LIBRARY_PATH
这种方式设置的环境变量只会在当前终端会话中有效,当关闭终端或启动新的终端会话时,这些设置将会失效。
/etc/profile
或/etc/environment
,将环境变量设置添加到其中。例如,在/etc/profile
文件的末尾添加:export LD_LIBRARY_PATH="/usr/local/aarch64-linux-gnu:$LD_LIBRARY_PATH"
source /etc/profile
修改完成后,需要运行source /etc/profile
命令,使新的配置立即生效。这种方式的设置会对所有用户都有效,并且会在每次用户登录时自动应用。
.bashrc
、.bash_profile
或.profile
文件,将环境变量设置添加到其中。同样,在文件的末尾添加:export LD_LIBRARY_PATH="/usr/local/aarch64-linux-gnu:$LD_LIBRARY_PATH"
source ~/.bashrc
然后,运行source ~/.bashrc
(或相应的配置文件)使新的配置立即生效。这种方式的设置仅对当前用户有效。
注意,当修改配置文件来设置环境变量时,需要确保使用正确的文本编辑器,如vi
、nano
等,并且要注意语法正确,避免因为误操作导致系统配置出错。
此外,LD_LIBRARY_PATH
环境变量主要用于指定查找共享库(动态链接库)时除了默认路径之外的其他路径。在配置这个环境变量时,需要确保路径的正确性,并且注意不同路径之间使用冒号(:
)分隔。