2

I've installed crosstool-NG and built GCC on a host+build x86 machine that targets arm-unknown-linux-gnueabi. I've then used arm-unknown-linux-gnueabi-gcc to compile a program that ran well on my ARM board.

I'm wanting to now build GCC, targeting ARM to be hosted on ARM. I believe the lingo is

build=i486-pc-linux-gnu
target=arm-unknown-linux-gnueabi-gcc
host=arm-unknown-linux-gnueabi-gcc

How do I do this? do I run ./configure for crosstool-NG passing --host=arm-unknown-linux-gnueabi-gcc?

or do I change the environment variables for CC/etc?

artless noise
  • 21,212
  • 6
  • 68
  • 105
stuck
  • 2,264
  • 2
  • 28
  • 62
  • I believe it is the right approach. What did you try, and what does not work? Perhaps `gcc-help@gcc.gnu.org` is a better place to ask. – Basile Starynkevitch Mar 26 '12 at 05:19
  • mostly I'm lacking confidence and am seeking reassurance that I'm on the correct path :) I tried this but crosstool-ng-1.14.1 is giving an error saying that the curses header couldnt be found. Since it worked very well for making a standard cross compiler I assumed I was doing something incorrectly – stuck Mar 26 '12 at 05:38
  • It looks right to me. Note that that's not a *Canadian Cross*: that's a *Cross-Native* build. A Canadian Cross would have all three platforms different. E.g. a good way to build for Windows is to use build=i686-pc-liunx-gnu host=i686-mingw32 target=arm-unknown-linux-gnu – ams Mar 27 '12 at 08:56

1 Answers1

1

You do this with a .config file. I think samples with a comma in the name are good ones to look at. The main difference is that you must run ct-ng multiple times to create several cross compilers.

ct-ng has under went some changes in Canadian crosses lately. However, you will probably need to re-use your original cross compiler that runs on the PC. The reason is that a compiler will include libraries compiled for the ARM and you need to generate these libraries on your PC. Generally, ensure that the iX86-host+ARM-target compiler is on your path. Then you must set the host tuple or prefix for this tool chain in the toolchain menu. You need set the build tuple to the same compiler.

ct-ng help | grep variables

This gives a directory with a bunch of text files that you can grep for hints.

See 6 - Toolchain types.txt for example. Cross-native or Canadian-cross really doesn't matter, in terms of complexity of building. You need only one intermediate for Cross native, but you need two intermediate compilers for a Canadian cross.

Edit: Ct-ng's How a compiler is constructed has some information on all the happening.

artless noise
  • 21,212
  • 6
  • 68
  • 105
  • The 'git' link is [Ct-ng's How a compiler is constructed](http://crosstool-ng.org/git/crosstool-ng/plain/docs/6%20-%20Toolchain%20types.txt) which is probably longer term, since the answer was written. – artless noise Mar 26 '15 at 21:21