代码之家  ›  专栏  ›  技术社区  ›  Dalbenn

介子交叉编译依赖项

  •  2
  • Dalbenn  · 技术社区  · 7 年前

    您好,我正在尝试为arm交叉编译systemd,但我被“mount”交叉依赖性卡住了。

    我成功地从util-linux交叉编译了libmount,但我不知道应该把它放在哪里,也不知道如何指定meson应该在哪里查找它。

    有一个“装载路径”选项,但即使提供了它,它仍然会说:

    Meson encountered an error in file meson.build, line 797, column 0:                                                    
    Cross dependency 'mount' not found
    

    我的交叉编译文件如下所示:

    [binaries]                   
    c = '/usr/bin/arm-linux-gnueabi-gcc'                       
    cpp = '/usr/bin/arm-linux-gnueabi-g++'                     
    ar = '/usr/arm-linux-gnueabi/bin/ar'                       
    strip = '/usr/arm-linux-gnueabi/bin/strip'                 
    pkgconfig = '/usr/bin/arm-linux-gnueabi-pkg-config'        
    
    [host_machine]               
    system = 'linux'             
    cpu_family = 'arm'           
    cpu = 'cortex-m4'            
    endian = 'little'            
    
    [build_machine]              
    system = 'linux'             
    cpu_family = 'x86_64'        
    cpu = 'i686'                 
    endian = 'little' 
    

    顺便说一句,如果你知道另一种不用这种荒谬的(IMHO)设置就可以在arm上安装systemd的方法,那就太好了。

    非常感谢。

    1 回复  |  直到 7 年前
        1
  •  3
  •   pmod    7 年前

    介子用途 包装配置 用于查找依赖项的工具。这个工具搜索, 包配置文件 使用 PKG\u CONFIG\u路径 环境变量。 您可以检查是否没有 攀登 在中:

    $ pkg-config --list-all
    

    这很自然,因为您刚刚编译,但没有提供包配置文件 攀登pc机 待查找。检查libmount源,它应该包含mount。安装过程中使用的pc。在交叉编译的情况下,应该将其转换为mount。根据 guide .

    创建包配置文件后,您应该能够成功运行:

    $ pkg-config --validate mount
    

    您还可以检查变量的有效性:

    $ pkg-config --cflags mount
    -I/home/<>/tmp/work/cortexa9hf-neon-poky-linux-gnueabi/libmount -I/home/<>/tmp/work/cortexa9hf-neon-poky-linux-gnueabi/blkid -I/home/<>/tmp/work/cortexa9hf-neon-poky-linux-gnueabi/uuid
    
    $ pkg-config --libs mount  
    -lmount
    

    顺便说一句,这是 攀登pc机 我有:

    prefix=/usr
    exec_prefix=/usr
    libdir=/usr/lib
    includedir=/usr/include
    
    Name: mount
    Description: mount library
    Version: 2.29.1
    Requires.private: blkid
    Cflags: -I${includedir}/libmount
    Libs: -L${libdir} -lmount
    

    顺便说一句,如果你知道另一种不用这个就可以在arm上安装systemd的方法 荒谬的(IMHO)设置会很好。

    systemd切换到了介子,所以现在这是唯一的方法,除非你想用自动工具构建旧版本。

    但从更广泛的角度来看,你也可以看看 yocto 其重点是简化交叉编译linux发行版的获取。


    使现代化

    正如@Yasushi Shoji正确指出的,对于交叉编译案例, PKG\u CONFIG\u LIBDIR 应改为使用,因为它可以防止意外/错误使用本地系统包,请检查 this .

    推荐文章