• 交叉编译glib2.72.1


    较早的版本编译起来比较费,要依赖别的库像libffi处理高级语言之间相互调用的问题,zlib等

    较新的版本采用meson构建,会自动下载依赖库,所以比较方便。

    现在glib源码:http://ftp.acc.umu.se/pub/GNOME/sources/glib/ 我这里下载的是最新的2.72.1

    tar xvf glib-2.72.1.tar.xz

    cd glib-2.72.1

    新建编译脚本arm.sh

    #!/bin/bash

    if [ -d arm_build ];then
    rm -r arm_build
    fi
    mkdir arm_build
    arch='arm-cortex_a9-linux-gnueabi-' #根据实际情况
    sys_root=/opt/arm-cortex_a9/arm-cortex_a9-linux-gnueabi/sysroot/   #根据实际情况


    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 "strip = 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 "pkgconfig = 'pkg-config'" >> cross_file.txt


    echo "[host_machine]" >> cross_file.txt
    echo "system = 'linux'" >> cross_file.txt
    echo "cpu_family = 'arm'" >> cross_file.txt
    echo "cpu = 'armv7a'" >> 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 arm_build --cross-file cross_file.txt
    cd arm_build
    #编译 类似于make
    ninja -C arm_build
    DESTDIR=/opt/rootfs/xpylib/glib2.72.1 meson install #根据实际情况

    没想到这么顺利,都不报错就安装成功了,心里没底去验证一下

    --------------------------------------------------------------------

    1.编译ffi

    ./configure --prefix=/opt/rootfs/xpylib/ffi \
    CC=arm-cortex_a9-linux-gnueabi-gcc \
    --host=arm-linux
    make && make install

    第二次编译有出错,手动指定libffi的路径

    echo "pkg_config_libdir = '/opt/rootfs/xpylib/ffi/lib/pkgconfig'" >> cross_file.txt

     
  • 相关阅读:
    Django 模型层
    Django 模板层
    就在明晚,3月10日19:30,#HMS Core Insights#直播来了!
    Unity平台 | 快速集成华为性能管理服务
    手把手教你集成华为机器学习服务(ML Kit)人脸检测功能
    在onBackPress中实现退出拦截时不生效
    在家也可以享受购物体验?AR+Scene 帮您实现商品3D展示和虚拟试戴
    web组件发消息给H5页面时报错
    借助近距离通信,实现手机作为游戏控制器掌控大屏游戏
    快应用审核常见问题
  • 原文地址:https://www.cnblogs.com/xpylovely/p/16201338.html
Copyright © 2020-2023  润新知