I'm using a Bootlin aarch64 toolchain to cross-compile some C++ code. I notice that I can compile just fine simply calling the compiler without any special flags. Specifically, I can compile without passing the --sysroot flag. I can see that the compiler has been configured with the --with-sysroot option:
--with-sysroot=/opt/aarch64--glibc--stable-2020.08-1/aarch64-buildroot-linux-gnu/sysroot
However, I don't have the compiler placed in that location, so I'd expect it to not know what sysroot to use.
I can also see the default system include list that it uses, and all paths are correctly calculated, relative to the location of the compiler. So it will use the headers from the toolchain instead of the standard ones at /usr/include and so on.
Therefore my question is: do I need to use --sysroot here? What problem would it solve? Or put differently - what problems can I run into if I don't pass that flag in this case?