meson 工具使用 glib-2.68.1交叉编译

2021/4/12 18:25:24

本文主要是介绍meson 工具使用 glib-2.68.1交叉编译,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

 需要python meson ninja,安装方法百度即可

meson手册 https://mesonbuild.com/Manual.html

防止忘记,仅仅记录如下

#!/bin/bash
set -e

DEVEL=/home/username/build_root/devel

if [ -d _build ];then
rm -r _build
fi
mkdir _build

arch='arm-linux-gnueabi-'
sys_root='/home/username/build_root/devel'
#创建交叉编译配置文件cross_file.txt

#还可设置c_args等等类似 CFLAGS
echo "[constants]" > cross_file.txt
echo "arch = '${arch}'" >> cross_file.txt
echo "[binaries]" >> cross_file.txt
echo "c = arch + 'gcc'" >> cross_file.txt
echo "cpp = arch + 'g++'" >> cross_file.txt
echo "ar = arch + 'ar'" >> cross_file.txt
echo "ld = arch + 'ld'" >> cross_file.txt
echo "srtip = arch + 'strip'" >> cross_file.txt
echo "sys_root = '${sys_root}'" >> cross_file.txt
echo "pkg_config_libdir = '${sys_root}/usr/lib/pkgconfig'" >> cross_file.txt

#编译结果可运行平台的架构
echo "[host_machine]" >> cross_file.txt
echo "system = 'linux'" >> cross_file.txt
echo "cpu_family = 'arm'" >> cross_file.txt
echo "cpu = 'armv7hl'" >> cross_file.txt
echo "endian = 'little'" >> cross_file.txt

#类似于configure功能 meson configure 获取到可配置项
echo "[project options]" >> cross_file.txt
echo "prefix = '/usr'" >> cross_file.txt
echo "selinux = 'disabled'" >> cross_file.txt
echo "libelf = 'disabled'" >> cross_file.txt

#类似于执行configure
meson setup _build --cross-file cross_file.txt
cd _build
#编译 类似于make
ninja
cd ../ 
#类似于make install DESTDIR=$DEVEL
DESTDIR=$DEVEL meson install

 



这篇关于meson 工具使用 glib-2.68.1交叉编译的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程