本文主要是介绍meson 工具使用 glib-2.68.1交叉编译,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
安装python3.7
1.安装依赖
sudo apt-get install -y gcc make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev xz-utils tk-dev libffi-dev liblzma-dev git gperf ddbus libdbus-glib-1-dev
2.下载python源码 Python-3.7.10.tar.xz
./configure
make
sudo make install
安装 meson
pip3 install --user meson
安装 ninja
pip3 install --user ninja
meson手册 Manual
编译glib项目
#!/bin/bash
set -eDEVEL=/home/username/build_root/develif [ -d _build ];then
rm -r _build
fi
mkdir _buildarch='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交叉编译的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!