将编译出来的结果 /opt/xxx/xxx_aarch64_gcc9.4.0_glibc2.23linux/ 拷贝到任意的x86_64都linux编译机上(环境的glibc版本必须要高于2.23版本),将编译命令的的gcc/g++等程序换成/opt/xxx/xxx_aarch64_gcc9.4.0_glibc2.23linux/bin里面对应程序,并增加链接库的搜索路径/opt/xxx/xxx_aarch64_gcc9.4.0_glibc2.23linux/lib,增加头文件搜索路径/opt/xxx/xxx_aarch64_gcc9.4.0_glibc2.23linux/include就可以正常编译了。例如:
/opt/xxx/xxx_aarch64_gcc9.4.0_glibc2.23linux/bin/xxx_aarch64_gcc9.4.0_glibc2.23linuxg++ -I/opt/xxx/xxx_aarch64_gcc9.4.0_glibc2.23linux/include ~/zrh/test.cpp
编译出来的结果a.out可以拷贝到飞腾服务器上运行:
PS C:\Users\ronghua.zhou> ssh zzz@xxx
Authorized users only. All activities may be monitored and reported.
zzz@xxxs password:
Authorized users only. All activities may be monitored and reported.
Web console: https://localhost:9090/ or https://10.12.110.184:9090/
Last login: Wed Jul 21 16:12:49 2021 from 10.12.60.98
[iqd@localhost ~]$ uname -a
Linux localhost.localdomain 4.19.90-17.5.ky10.aarch64 #1 SMP Fri Aug 7 13:35:33 CST 2020 aarch64 aarch64 aarch64 GNU/Linux
[iqd@localhost ~]$ ./a.out
sz=3, sz1=8