On Wed, 2025-07-30 at 19:51 +0000, Jan Strąkowski via Gcc-help wrote: > Hi there! > > I want to cross compile a chroot system and not chroot until the last > component is cross-compiled: This is my project. I do it in the exotic > ecosystem of Nix, but I will deal with the Nix stuff myself. What I want to is > to learn roughly how gcc handles all the c/c++ files from the point of view of > its dependencies (not only headers/libs, but e v e r y t h i n g ). I just > want to have some basic orientation in all the stuff. What do you advise me to > learn? > > What I know now is: > When C/C++ file is compiled you need include files (-I flag), libraries (-L > flag) because of the C/C++ standards. Gcc also has something called libgcc > that is basically included with every executable gcc produces. (Some questions > for you: When in the process of compiling a source file libgcc is looked for? > Can I specify the location of libgcc at runtime or its hardcoded?) Basically > every C/C++ file is linked against C/C++ stdlib. (How the path to stdlib is > specified? i'm interested specifically in GNU/Linux. I think its pretty always > -lc, so runpath LD_LIBRARY_PATH, and this stuff... i'm not sure are there any > exceptions. What about C++ how its discovered? (BTW I haven't programmed in > C++ pretty much at all, all my C++ is C :| ). > > So TL;DR: > I just want to learn GCC stuff that affects any dependency of the compiled > code (headers, libraries, stdlibs, libgcc, e v e r y t h i n g ). The gcc command is really driving other programs. Its behavior is specified by GCC spec file. https://gcc.gnu.org/onlinedocs/gcc/Spec-Files.html -- Basile STARYNKEVITCH <basile@xxxxxxxxxxxxxxxxx> 8 rue de la Faïencerie http://starynkevitch.net/Basile/ 92340 Bourg-la-Reine https://github.com/bstarynk France https://github.com/RefPerSys/RefPerSys