title: GCC cross-compiling using a rootfs
body: <p>We are currently developing an application for an ARM embedded system that is running a full Linux OS (NVIDIA Jetson TX2). I have a copy of the rootfs from the embedded system as well as the GNU toolchain for ARM version 8.2-2018.08.
  I am having difficulty getting the GCC compiler (<code>gcc-arm-8.2-2018.11-x86_64-aarch64-linux-gnu/bin/aarch64-linux-gnu-gcc</code>) to look in the correct directory of the rootfs for both include and library files.</p>
  
  <p>I have set the —sysroot variable to point to the location of my sysroot. However, looking in the lib and include directories there is a subfolder that <code>usr/lib/aarch64-linux-gnu</code> that contains further include and libraries and it is these ones that are actually the ones needed. For example instead of the libraries being located in <code>$rootfs/usr/lib</code> or <code>$rootfs/usr/local/lib</code>, instead, the libraries are in <code>$rootfs/usr/lib/aarch64-linux-gnu</code> I have tested and using the -I/-L commands I can get the project o compile.</p>
  
  <p>My questions are as follows</p>
  
  <ul>
  <li>Is using the -I and -L the "correct" way to be doing this? If not, what is?</li>
  <li>Why does linux place these libraries in this other directory?</li>
  <li>When compiling using --sysroot I can see that other non-sysroot directories are being checked. Why would gcc be doing this?</li>
  </ul>