对于查询How the C library works in cross-tools
在配置期间编译和构建跨工具链时,它们将提供 sysroot。
喜欢--with-sysroot=${CLFS_CROSS_TOOLS}
--with-sysroot
--with-sysroot=dir
Tells GCC to consider dir as the root of a tree that contains (a subset of) the root filesystem of the target operating system. Target system headers, libraries and run-time object files will be searched for in there. More specifically, this acts as if --sysroot=dir was added to the default options of the built compiler. The specified directory is not copied into the install tree, unlike the options --with-headers and --with-libs that this option obsoletes. The default value, in case --with-sysroot is not given an argument, is ${gcc_tooldir}/sys-root. If the specified directory is a subdirectory of ${exec_prefix}, then it will be found relative to the GCC binaries if the installation tree is moved.
因此,/lib /usr/include
在编译时,它不会看起来像 /Toolchain/(libc) 和 (include files)
你可以检查
arm-linux-gnueabihf-gcc -print-sysroot
这显示了在哪里寻找 libc 。
还
arm-linux-gnueabihf-gcc -print-search-dirs
给你清晰的画面