linux跨平台构建aarch64架构conan包

工具链下载

https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-a/downloads

构建系统可以选择Windows (mingw-w64-i686) hosted cross compilersx86_64 Linux hosted cross compilers

目标平台如下表格

目标平台
AArch32 bare-metal target (arm-none-eabi) aarch32 裸板
AArch32 target with hard float (arm-linux-none-gnueabihf) aarch32 linux 包含浮点数
AArch64 ELF bare-metal target (aarch64-none-elf) aarch64 裸板
AArch64 GNU/Linux target (aarch64-none-linux-gnu) aarch64 linux
AArch64 GNU/Linux target (aarch64_be-none-linux-gnu) aarch64 linux 大端字节序

配置conan构建profile

解压后的目录如下所示:

toolchain folder root

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
toolchain=/path/to/tool/folder/gcc-arm-8.3-2019.03-x86_64-aarch64-linux-gnu #指定工具链目录
target_host=aarch64-linux-gnu #目标平台
cc_compiler=gcc
cxx_compiler=g++

[settings]
os=Linux
arch=armv8
compiler=gcc
compiler.version=8.3
compiler.libcxx=libstdc++11
build_type=Release

[options]

[build_requires]

[env]
PATH=[$toolchain/bin]
CONAN_CMAKE_FIND_ROOT_PATH=$toolchain/bin
CONAN_CMAKE_SYSROOT=$toolchain/$target_host/libc
CHOST=$target_host
AR=$target_host-ar
AS=$target_host-as
RANLIB=$target_host-ranlib
CC=$target_host-$cc_compiler
CXX=$target_host-$cxx_compiler
STRIP=$target_host-strip
RC=$target_host-windres

保存到~/.conan/profile/linux_to_aarch64

创建conan包

1
conan create conanfile.py conan/my --profile linux_to_aarch64