linux编译sys,【分享】编译并使用sysroot

1. 编译并使用sysroot

在Xilinx SDK可以开发Linux应用程序。GCC自带一部分头文件,库文件。如果自己单板有额外的功能,比如显示,GCC就没有提供相关头文件、库文件,编译时会报告错误。

这时候需要给自己单板编译sysroot,通过sysroot提供自己单板的所有头文件,库文件。

1.1. GCC文档3.15 Options for Directory Search

-I dir

-iquote dir

-isystem dir

-idirafter dir

Add the directory dir to the list of directories to be searched for header files during preprocessing. If dir begins with ‘=’ or $SYSROOT, then the ‘=’ or $SYSROOT is replaced by the sysroot prefix; see --sysroot and -isysroot.

--sysroot=dir

Use dir as the logical root directory for headers and libraries. For example, if the compiler normally searches for headers in /usr/include and libraries in /usr/lib, it instead searches dir/usr/include and dir/usr/lib.

If you use both this option and the -isysroot option, then the --sysroot option applies to libraries, but the -isysroot option applies to header files.

The GNU linker (beginning with version 2.16) has the necessary support for this option. If your linker does not support this option, the header file aspect of --sysroot still works, but the library aspect does not.

1.2. PetaLinux编译mubianba目标板SDK

使用命令“petalinux-build --sdk”编译目标板SDK,含有sysroot。

编译成功后,在目录images/linux/能看到sdk.sh。hankf@xszgs4:/proj/hankf/zcu106/v183/zcu106-v2018.3-bsp-egl$ petalinux-build --sdk

[INFO] building project

[INFO] sourcing bitbake

INFO: bitbake petalinux-user-image -c do_populate_sdk

Loading cache: 100% |#################################################################################################| Time: 0:00:00

Loaded 3460 entries from dependency cache.

Parsing recipes: 100% |###############################################################################################| Time: 0:00:03

Parsing of 2569 .bb files complete (2534 cached, 35 parsed). 3461 targets, 135 skipped, 0 masked, 0 errors.

NOTE: Resolving any missing task queue dependencies

Initialising tasks: 100% |############################################################################################| Time: 0:00:14

WARNING: The glib-2.0:do_install sig is computed to be 6d1616bc32584bce93c31e05f2957c43, but the sig is locked to db443bb86424a65223b97130408b8bb3 in SIGGEN_LOCKEDSIGS_t-aarch64

NOTE: Executing SetScene Tasks

NOTE: Executing RunQueue Tasks

NOTE: Tasks Summary: Attempted 5896 tasks of which 5895 didn't need to be rerun and al

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值