Switching GNU toolchains in eclipse — the easy way

October 13, 2008 by
Filed under: Development 

This is a method of switching to a different toolchain that I found in eclipse. Basically, my goal was to get eclipse to use a secondary toolchain. Primarily in my first step, I tried making eclipse use a crosscompiling gnu toolchain.

Doing this the “right” way seems to entail writing plugins eclipse, and to write lots of XML configurations and so forth. Not having the luxury of infinite time and money (yet wanting a managed build), but rather being result driven, I finally managed to solve it partially with a hack.

My secondary goal now is to make the build work with a completely “non-gnu toolchain” (renesas sh compiler), I will try to hack together this in the upcoming days. I’ll get back to this topic again, once I know if it works or not. In the meantime, this is how I got it to compile with “non-standard” toolchain, and “standard” cygwin toolchain at the same time.

  1. Install the toolchain somewhere.
  2. Setup your PATH with the /bin/ directory in it.
    1. Start -> Control Panel -> System.
    2. Enter the Advanced tab.
    3. Click Environment Variables.
    4. Find the PATH variable in System variables.
    5. Edit and add ;c:pathtoyourtoolchain at the end of it.
    6. OK
    7. OK
  3. Create a new Build Configuration (Target for example).
    1. Right click the project in the Project Explorer.
    2. Build Configurations -> Manage…
    3. New…
    4. Write name “Target” and a description.
    5. Copy settings from another target that might contain decent default values.
    6. Ok
    7. Ok
  4. Edit the Settings for the “Target” Build Configuration.
    1. Right click the project in the Project Explorer.
    2. Choose Properties.
    3. Go to C/C++ Build -> Settings.
    4. Choose the right Configuration at the top (Target in our case).
    5. For each heading in Tool Settings (GCC Assembler, Cygwin C Compiler, Cygwin C Linker)
      1. Click the heading.
      2. Edit the Command field (for example, instead of using gcc, you might be using arm-elf-gcc or m68k-uclinux-gcc).
      3. Apply.
    6. OK.
  5. Try to build the new “Target” Build.

Hint: A problem I ran into was that my new toolchain couldnt understand/interpret unix style paths properly and not hinting very openly about it. Ie, I got “missing header files” all over the build. Turning on verbose (-v flag) in the C/C++ Builds -> Settings, and then under Cygwin C Compiler -> Miscellaneous gave me an error like “ignoring nonexistent directory”, which turned out that instead of using “../inc/” I had to use “..inc”.

Comments

Tell me what you're thinking...
and oh, if you want a pic to show with your comment, go get a gravatar!

You must be logged in to post a comment.