When installing GCC, libraries, header files and some executables are placed in directories similar to /usr/lib/gcc/i686-pc-linux-gnu/4.5.4/ and /usr/libexec/gcc/i686-pc-linux-gnu/4.5.4/.

I'm building a native compiler on a custom system and would like to place executables in /bin, header files in /include/gcc and anything else in /lib/gcc (no paths containing the target machine name nor the gcc version). Unfortunately this seems to be impossible considering the available options of the gcc configure script. Simply relocating all the installed files is no problem, but then the gcc executable won't be able to find those anymore. The search directories look as follows on my system (pretty ugly in my point of view, a lot of useless paths):

$ gcc -print-search-dirs
install: /usr/lib/gcc/i686-pc-linux-gnu/4.5.4/
programs: =/usr/libexec/gcc/i686-pc-linux-gnu/4.5.4/:/usr/libexec/gcc/i686-pc-linux-gnu/4.5.4/:/usr/libexec/gcc/i686-pc-linux-gnu/:/usr/lib/gcc/i686-pc-linux-gnu/4.5.4/:/usr/lib/gcc/i686-pc-linux-gnu/:/usr/lib/gcc/i686-pc-linux-gnu/4.5.4/../../../../i686-pc-linux-gnu/bin/i686-pc-linux-gnu/4.5.4/:/usr/lib/gcc/i686-pc-linux-gnu/4.5.4/../../../../i686-pc-linux-gnu/bin/
libraries: =/usr/lib/gcc/i686-pc-linux-gnu/4.5.4/:/usr/lib/gcc/i686-pc-linux-gnu/4.5.4/../../../../i686-pc-linux-gnu/lib/i686-pc-linux-gnu/4.5.4/:/usr/lib/gcc/i686-pc-linux-gnu/4.5.4/../../../../i686-pc-linux-gnu/lib/../lib/:/usr/lib/gcc/i686-pc-linux-gnu/4.5.4/../../../i686-pc-linux-gnu/4.5.4/:/usr/lib/gcc/i686-pc-linux-gnu/4.5.4/../../../../lib/:/lib/i686-pc-linux-gnu/4.5.4/:/lib/../lib/:/usr/lib/i686-pc-linux-gnu/4.5.4/:/usr/lib/../lib/:/usr/lib/gcc/i686-pc-linux-gnu/4.5.4/../../../../i686-pc-linux-gnu/lib/:/usr/lib/gcc/i686-pc-linux-gnu/4.5.4/../../../:/lib/:/usr/lib/

I've looked at the source of gcc, but to me it seems that a lot would have to be changed in order to achieve what I want; the structure of those paths are actually hardcoded. Manipulating DEFAULT_TARGET_MACHINE or DEFAULT_TARGET_VERSION in gcc/Makefile.in prior to configuration would do, but that will break other things for sure.

Any help/ideas appreciated.

migrated from serverfault.com Nov 26 '12 at 13:44

This question came from our site for system and network administrators.

  • Please comment if you downvote. I don't really see a reason to downvote my question. – watain Nov 25 '12 at 8:34

Try those options for ./configure script:


Compiling gcc manual

  • This doesn't change the fact that the target machine name and the target version are both affixed to the installation paths. – watain Nov 25 '12 at 8:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.