I sometimes use LD_LIBRARY_PATH and various other preprocessor variables allowed by gcc/g++.
Sometimes I notice that I run gcc or gcc-5 or whatever and I look at it with -v (verbose) and I notice that after COLLECT_GCC_OPTIONS is echoed, I see COMPILER_PATH and LIBRARY_PATH variables have been set. These are useful as it can easily control which compiler and libraries you use - the "toolchain" so to speak.
But WHERE are these being set in a typical ubuntu environment set up? Is it lto-wrapper or what? And are they compiled into a binary. I just want to know where they are typically set when I'm not the one setting them. I can't find where this is happening so far yet they ARE being set on some of my machine.
This is a low-priority issue as I know that if I set my -I paths correctly, I can always compile. I just noticed that some platforms set the order magically correct and on others I have to tweak it slightly because there is some installation of the compiler that I am skipping and these variable eventually DO become emitted to the screen on a verbose compile but they are NOT emitted on a failed verbose compile - thus this prompts me to go to a machine that's set up better, watch it for a bit, then make sure my order of include searches is correct. Usually this works but it should be automatic on the ones I haven't installed in a formal way, but instead just expanded a bunch of packages until I had what I needed.
So my PATH, LD_LIBRARY_PATH, -I includes all have to right or I can't find stuff, and all my symbolic links have to be right. If all that's ok, I should be good to go.