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.
cc1_options used in the lang-specs.h

I wonder does it have to do with this? I'm still pretty much stabbing in the dark.

My run of gcc sets the COMPILER_PATH and LIBRARY_PATH but I did not tell it how to do that.

Does some sort of gcc-build process?
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.
Last edited on
Registered users can post here. Sign in or register to post.