sysroot 在编译时的作用

5688人阅读 评论(1) 收藏 举报
本文章已收录于:
分类:

如果在编译时指定了-sysroot就是为编译时指定了逻辑目录。编译过程中需要引用的库,头文件,如果要到/usr/include目录下去找的情况下,则会在前面加上逻辑目录。

如此处我们指定 -sysroot=/home/shell.albert/tools/toolschain_arm/4.4.3/arm-none-Linux-gnueabi/sys-root

则如果在编译过程中需要找stdio.h,则会用/usr/include/目录下去找,因为我们指定了系统目录,则会到下面的路径去找。

shell.albert@yantai:~/tools/toolschain_arm/4.4.3/arm-none-linux-gnueabi/sys-root/usr/include> pwd
/home/shell.albert/tools/toolschain_arm/4.4.3/arm-none-linux-gnueabi/sys-root/usr/include
shell.albert@yantai:~/tools/toolschain_arm/4.4.3/arm-none-linux-gnueabi/sys-root/usr/include> ls -l stdio.h
-r--r--r-- 1 shell.albert users 31052 Jul 24  2010 stdio.h
shell.albert@yantai:~/tools/toolschain_arm/4.4.3/arm-none-linux-gnueabi/sys-root/usr/include>

当然,如果我们同时指定了--prefix=/home/shell.albert/libqt5.3.2希望生成的库和头文件等都安装到此目录下,执行make install开始复制操作。

但是当我们去系统的/home/shell.albert/libqt5.3.2中去寻找编译成果时却没有这些文件,

而直接的成果输出在了,输出路径是相对于-sysroot的。

shell.albert@yantai:~/tools/toolschain_arm/4.4.3/arm-none-linux-gnueabi/sys-root/home/shell.albert/libqt5.3.2> pwd
/home/shell.albert/tools/toolschain_arm/4.4.3/arm-none-linux-gnueabi/sys-root/home/shell.albert/libqt5.3.2
shell.albert@yantai:~/tools/toolschain_arm/4.4.3/arm-none-linux-gnueabi/sys-root/home/shell.albert/libqt5.3.2> ls
bin  doc  imports  include  lib  phrasebooks  plugins  qml  translations
shell.albert@yantai:~/tools/toolschain_arm/4.4.3/arm-none-linux-gnueabi/sys-root/home/shell.albert/libqt5.3.2> ls lib
cmake                              libQt5Designer.so.5.3.2           libQt5Positioning.so.5       libQt5Sql.so.5.3
fonts                              libQt5Gui.la                      libQt5Positioning.so.5.3     libQt5Sql.so.5.3.2
libQt5Bluetooth.la                 libQt5Gui.prl                     libQt5Positioning.so.5.3.2   libQt5Svg.la
libQt5Bluetooth.prl                libQt5Gui.so                      libQt5PrintSupport.la        libQt5Svg.prl
libQt5Bluetooth.so                 libQt5Gui.so.5                    libQt5PrintSupport.prl       libQt5Svg.so
libQt5Bluetooth.so.5               libQt5Gui.so.5.3                  libQt5PrintSupport.so        libQt5Svg.so.5
libQt5Bluetooth.so.5.3             libQt5Gui.so.5.3.2                libQt5PrintSupport.so.5      libQt5Svg.so.5.3
libQt5Bluetooth.so.5.3.2           libQt5Help.la                     libQt5PrintSupport.so.5.3    libQt5Svg.so.5.3.2
libQt5CLucene.la                   libQt5Help.prl                    libQt5PrintSupport.so.5.3.2  libQt5Test.la
libQt5CLucene.prl                  libQt5Help.so                     libQt5Qml.la                 libQt5Test.prl
libQt5CLucene.so                   libQt5Help.so.5                   libQt5Qml.prl                libQt5Test.so
libQt5CLucene.so.5                 libQt5Help.so.5.3                 libQt5Qml.so                 libQt5Test.so.5
libQt5CLucene.so.5.3               libQt5Help.so.5.3.2               libQt5Qml.so.5               libQt5Test.so.5.3
libQt5CLucene.so.5.3.2             libQt5Multimedia.la               libQt5Qml.so.5.3             libQt5Test.so.5.3.2
libQt5Concurrent.la                libQt5Multimedia.prl              libQt5Qml.so.5.3.2           libQt5UiTools.a
libQt5Concurrent.prl               libQt5Multimedia.so               libQt5Script.la              libQt5UiTools.la
libQt5Concurrent.so                libQt5Multimedia.so.5             libQt5Script.prl             libQt5UiTools.prl
libQt5Concurrent.so.5              libQt5Multimedia.so.5.3           libQt5Script.so              libQt5WebSockets.la
libQt5Concurrent.so.5.3            libQt5Multimedia.so.5.3.2         libQt5Script.so.5            libQt5WebSockets.prl
libQt5Concurrent.so.5.3.2          libQt5MultimediaWidgets.la        libQt5Script.so.5.3          libQt5WebSockets.so
libQt5Core.la                      libQt5MultimediaWidgets.prl       libQt5Script.so.5.3.2        libQt5WebSockets.so.5
libQt5Core.prl                     libQt5MultimediaWidgets.so        libQt5ScriptTools.la         libQt5WebSockets.so.5.3
libQt5Core.so                      libQt5MultimediaWidgets.so.5      libQt5ScriptTools.prl        libQt5WebSockets.so.5.3.2
libQt5Core.so.5                    libQt5MultimediaWidgets.so.5.3    libQt5ScriptTools.so         libQt5Widgets.la
libQt5Core.so.5.3                  libQt5MultimediaWidgets.so.5.3.2  libQt5ScriptTools.so.5       libQt5Widgets.prl
libQt5Core.so.5.3.2                libQt5Network.la                  libQt5ScriptTools.so.5.3     libQt5Widgets.so
libQt5Declarative.la               libQt5Network.prl                 libQt5ScriptTools.so.5.3.2   libQt5Widgets.so.5
libQt5Declarative.prl              libQt5Network.so                  libQt5Sensors.la             libQt5Widgets.so.5.3
libQt5Declarative.so               libQt5Network.so.5                libQt5Sensors.prl            libQt5Widgets.so.5.3.2
libQt5Declarative.so.5             libQt5Network.so.5.3              libQt5Sensors.so             libQt5Xml.la
libQt5Declarative.so.5.3           libQt5Network.so.5.3.2            libQt5Sensors.so.5           libQt5XmlPatterns.la
libQt5Declarative.so.5.3.2         libQt5Nfc.la                      libQt5Sensors.so.5.3         libQt5XmlPatterns.prl
libQt5DesignerComponents.la        libQt5Nfc.prl                     libQt5Sensors.so.5.3.2       libQt5XmlPatterns.so
libQt5DesignerComponents.prl       libQt5Nfc.so                      libQt5SerialPort.la          libQt5XmlPatterns.so.5
libQt5DesignerComponents.so        libQt5Nfc.so.5                    libQt5SerialPort.prl         libQt5XmlPatterns.so.5.3
libQt5DesignerComponents.so.5      libQt5Nfc.so.5.3                  libQt5SerialPort.so          libQt5XmlPatterns.so.5.3.2
libQt5DesignerComponents.so.5.3    libQt5Nfc.so.5.3.2                libQt5SerialPort.so.5        libQt5Xml.prl
libQt5DesignerComponents.so.5.3.2  libQt5PlatformSupport.a           libQt5SerialPort.so.5.3      libQt5Xml.so
libQt5Designer.la                  libQt5PlatformSupport.la          libQt5SerialPort.so.5.3.2    libQt5Xml.so.5
libQt5Designer.prl                 libQt5PlatformSupport.prl         libQt5Sql.la                 libQt5Xml.so.5.3
libQt5Designer.so                  libQt5Positioning.la              libQt5Sql.prl                libQt5Xml.so.5.3.2
libQt5Designer.so.5                libQt5Positioning.prl             libQt5Sql.so                 pkgconfig
libQt5Designer.so.5.3              libQt5Positioning.so              libQt5Sql.so.5
shell.albert@yantai:~/tools/toolschain_arm/4.4.3/arm-none-linux-gnueabi/sys-root/home/shell.albert/libqt5.3.2>

您有 6条新通知
  • 3
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
从github.com/raspberrypi/tools完整下载的主分支,直接git太慢还容易失败,特意分享出来,实测在Ubuntu 18上安装x64工具链可用,gcc版本:4.8.3. 文件300M+,不能上传大于220M的,尝试过解压后分卷,会导致安装有问题,所以直接发一个链接,大家去那里下吧。 文件信息: └─tools-master ├─arm-bcm2708 │ ├─arm-bcm2708-linux-gnueabi │ │ ├─arm-bcm2708-linux-gnueabi │ │ │ ├─bin │ │ │ ├─debug-root │ │ │ │ └─usr │ │ │ │ └─bin │ │ │ ├─include │ │ │ │ └─c++ │ │ │ │ └─4.7.1 │ │ │ │ ├─arm-bcm2708-linux-gnueabi │ │ │ │ │ └─bits │ │ │ │ ├─backward │ │ │ │ ├─bits │ │ │ │ ├─debug │ │ │ │ ├─decimal │ │ │ │ ├─ext │ │ │ │ │ └─pb_ds │ │ │ │ │ └─detail │ │ │ │ │ ├─binary_heap_ │ │ │ │ │ ├─binomial_heap_ │ │ │ │ │ ├─binomial_heap_base_ │ │ │ │ │ ├─bin_search_tree_ │ │ │ │ │ ├─branch_policy │ │ │ │ │ ├─cc_hash_table_map_ │ │ │ │ │ ├─eq_fn │ │ │ │ │ ├─gp_hash_table_map_ │ │ │ │ │ ├─hash_fn │ │ │ │ │ ├─left_child_next_sibling_heap_ │ │ │ │ │ ├─list_update_map_ │ │ │ │ │ ├─list_update_policy │ │ │ │ │ ├─ov_tree_map_ │ │ │ │ │ ├─pairing_heap_ │ │ │ │ │ ├─pat_trie_ │ │ │ │ │ ├─rb_tree_map_ │ │ │ │ │ ├─rc_binomial_heap_ │ │ │ │ │ ├─resize_policy │ │ │ │ │ ├─splay_tree_ │ │ │ │ │ ├─thin_heap_ │ │ │ │ │ ├─tree_policy │ │ │ │ │ ├─trie_policy │ │ │ │ │ └─unordered_iterator │ │ │ │ ├─profile │ │ │ │ │ └─impl │ │ │ │ ├─tr1 │ │ │ │ └─tr2 │ │ │ └─sysroot │ │ │ ├─etc │ │ │ ├─lib │ │ │ ├─sbin │ │ │ └─usr │ │ │ ├─bin │ │ │ ├─include │ │ │ │ ├─arpa │ │ │ │ ├─asm │ │ │ │ ├─asm-generic │ │ │ │ ├─bits │ │ │ │ ├─drm │ │ │ │ ├─gnu │ │ │ │ ├─linux │ │ │ │ │ ├─byteorder │ │ │ │ │ ├─caif │ │ │ │ │ ├─can │ │ │ │ │ ├─dvb │ │ │ │ │ ├─hdlc │ │ │ │ │ ├─isdn │ │ │ │ │ ├─mmc │ │ │ │ │ ├─netfilter │ │ │ │ │ │ └─ipset │ │ │ │ │ ├─netfilter_arp │ │ │ │ │ ├─netfilter_bridge │ │ │ │ │ ├─netfilter_ipv4 │ │ │ │ │ ├─netfilter_ipv6 │ │ │ │ │ ├─nfsd │ │ │ │ │ ├─raid │ │ │ │ │ ├─spi │ │ │ │ │ ├─sunrpc │ │ │ │ │ ├─tc_act │ │ │ │ │ ├─tc_ematch │ │ │ │ │ ├─usb │ │ │ │ │ └─wimax │ │ │ │ ├─mtd │ │ │ │ ├─net │ │ │ │ ├─netash │ │ │ │ ├─netatalk │ │ │ │ ├─netax25 │ │ │ │ ├─neteconet │ │ │ │ ├─netinet │ │ │ │ ├─netipx │ │ │ │ ├─netiucv │ │ │ │ ├─netpacket │ │ │ │ ├─netrom │ │ │ │ ├─netrose │ │ │ │ ├─nfs │ │ │ │ ├─protocols │ │ │ │ ├─rdma │ │ │ │ ├─rpc │ │ │ │ ├─rpcsvc │ │ │ │ ├─scsi │ │ │ │ │ └─fc │ │ │ │ ├─sound │ │ │ │ ├─sys │ │ │ │ ├─video │ │ │ │ └─xen │ │ │ ├─lib │ │ │ │ └─gconv │ │ │ ├─libexec │ │ │ ├─sbin │ │ │ └─share │ │ │ ├─i18n │ │ │ │ ├─charmaps │ │ │ │ └─locales │ │ │ └─locale │ │ │ ├─be │ │ │ │ └─LC_MESSAGES │ │ │ ├─bg │ │ │ │ └─LC_MESSAGES │ │ │ ├─ca │ │ │ │ └─LC_MESSAGES │ │ │ ├─cs │ │ │ │ └─LC_MESSAGES │ │ │ ├─da │ │ │ │ └─LC_MESSAGES │ │ │ ├─de │ │ │ │ └─LC_MESSAGES │ │ │ ├─el │ │ │ │ └─LC_MESSAGES │ │ │ ├─en_GB │ │ │ │ └─LC_MESSAGES │ │ │ ├─es │ │ │ │ └─LC_

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值