sysroot 在编译时的作用

5688人阅读 评论(1) 收藏 举报
本文章已收录于:
分类:
软件技术(153)
作者同类文章 X

如果在编译时指定了-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条新通知

你可能感兴趣的:(sysroot 在编译时的作用)