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