meson 使用 ndk 工具链交叉编译 arm64 的配置
[binaries]
c = '/Android/Sdk/ndk/22.1.7171670/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android29-clang'
cpp = '/Android/Sdk/ndk/22.1.7171670/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android29-clang++'
ar = '/Android/Sdk/ndk/22.1.7171670/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android-ar'
strip = '/Android/Sdk/ndk/22.1.7171670/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android-strip'
#pkgconfig = '/usr/bin/x86_64-pc-linux-gnu-pkg-config'
cmake = '/Android/Sdk/cmake/3.18.1/bin/cmake'
ld = '/Android/Sdk/ndk/22.1.7171670/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android-ld.gold'
#pcap-config = ''
[properties]
skip_sanity_check = true
sys_root = '/Android/Sdk/ndk/22.1.7171670/toolchains/llvm/prebuilt/linux-x86_64/sysroot'
root = '/Android/Sdk/ndk/22.1.7171670/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/aarch64-linux-android/29'
[built-in options]
c_args = ['-O2', '-pipe', '-g', '-feliminate-unused-debug-types']
c_link_args = ['-Wl,-O1', '-Wl,--hash-style=gnu', '-Wl,--as-needed']
cpp_args = ['-O2', '-pipe', '-g', '-feliminate-unused-debug-types']
cpp_link_args = ['-Wl,-O1', '-Wl,--hash-style=gnu', '-Wl,--as-needed']
#sys_root = '/Android/Sdk/ndk/22.1.7171670/toolchains/llvm/prebuilt/linux-x86_64/sysroot'
#pkg_config_libdir ='/Android/Sdk/ndk/22.1.7171670/prebuilt/linux-x86_64/lib/pkgconfig'
#pkg_config_libdir ='/Android/Sdk/ndk/22.1.7171670/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/aarch64-linux-android/29'
[host_machine]
system = 'linux'
cpu_family = 'aarch64'
cpu = 'aarch64'
endian = 'little'
[target_machine]
system = 'linux'
cpu_family = 'aarch64'
cpu = 'armv8a'
endian = 'little'
将上述内容保存成类似叫做 arm64.txt 的文件。然后运行:
meson arm64-build --cross-file arm64.txt
编译:
ninja -C arm64-build
最后因为缺库文件,没成功。
讲道理,把时间花在编译这种破事上真的是很烦。希望多久能出个工具把这种浪费人生的事扫进历史的尘埃里。