Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Suppose a set of custom-built gcc/glibc/binutils are in $prefix (e.g. /home/user/path)

I want:

  1. gcc to look for libraries in $prefix/lib64 instead of /lib64
  2. gcc to look for headers in $prefix/include instead of /include
  3. to use $prefix/lib64/ as the (hard-coded) loader path instead of /lib64/
  4. the dynamic loader to look for shared libraries in $prefix/lib64 instead of /lib64

How should I configure the builds? Do I need to modify gcc's specs file or do anything else?

share|improve this question
up vote 2 down vote accepted

Try using crosstool-ng. It is a very good script that builds toolchain with a Kconfig interface (like Linux kernel has). It allows you to configure almost everything in the toolchain, and it has the settings you need.

I once made an arm-gnueabi toolchain with it, and it works in any directory I unpacked the .tbz2 to.

share|improve this answer
Thanks for the reference, I'll give it a try! – netvope Jun 7 '10 at 2:40
Unfortunately it does not support building cross-native (build!=host==target) tool-chain yet. – netvope Jun 15 '10 at 5:00
AFAIK there are no other similar utilities that support x86_64 ( is a good overview). You can try just building the toolchain as usual, but set --prefix $prefix option for everything. (I think the toolchain building process is too complex to describe here, but --prefix trick has worked for me. Of course, it is much harder than using crosstool-ng, and you already need another cross-toolchain.) – whitequark Jun 15 '10 at 5:16

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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