Sunday, 31 July 2011

OSLC Development using C/C++ and Rational Team Concert (Part 1)

It somehow doesn't surprise me that my first blog posting is about c/c++ development. No matter how many languages I have tried in my career of software development, I can never quite match the sense of nostalgia I get when I start a C/C++ project.

I still remember those many late nights debugging memory corruptions and tracing through cryptic and horrendous code (often my own) trying to understand the spaghetti of pointers, templates and operator overloads. I have yet to find a language as ugly as C++, yet having the ability/affliction of being able to be productive in writing quality C/C++ code comes with a sense of pride and accomplishment that in my experience has never been rivaled by any other programming language. Of course, effective tooling has a lot to do with that.

We have come a long way in terms of the quality of tooling that is now available for C/C++, not only the features that help with coding debugging and testing but also for collaboration with other developers on the team. The ability to share and cross reference information, whether its code, files, plans, change sets, work items, defects is essential for productivity and quality and is as important to C/C++ developers as much, and perhaps even more, as other developers using different technologies.

In many of the complex IT solutions that are being built today, C/C++ developers also need to collaborate with other developers and team members (no matter what technology and role) in order to plan and coordinate the complexity of a multi-component system so as to agree on interfaces and such.

To make a long story short, C/C++ developers need to be able to participate in this ecosystem and the best platform to do this is Jazz so my blog today is about how to start with Rational Team Concert (RTC and the C/C++ Development Tooling.

I will show how to integrate the MinGW GCC toolchain into Rational Team Concert on Windows. In a follow up blog posting I will show how to create an OSLC CM consumer in C/C++ that lists project areas using libcurl and libxml2.

To do this, you'll need the following:

1. Rational Team Concert 3.0.1 (https://jazz.net/downloads/rational-team-concert/releases/3.0.1)

2. The latest MinGW-get (http://sourceforge.net/projects/mingw/files/Automated%20MinGW%20Installer/mingw-get/)
NOTE: I am using MinGW over cygwin because I prefer not to have runtime dependencies on my executables. Nevertheless, RTC DOES work with the Cygwin toolchain.

3. You will need to download CDR but this is done in the instructions below as you will need to install RTC first

What to configure and Install:

1. Install, at a minimum, RTC and the Jazz Team Server (I will use it in subsequent posts).
NOTE: There is extensive information on jazz.net and in the CLM 3.0.1 information center on how to do this so I won't cover it here.
2. Unzip the mingw-get package into C:\MinGW (of D:,E:, whatever).
NOTE: You can put it anywhere you want but the important thing is NOT TO USE SPACES IN THE PATH

3. Set the MINGW_HOME environmental variable on Windows to this directory. Put MINGW_HOME\bin in the system PATH.

4. Launch a command prompt in Windows. Type the following commands:
mingw-get install gcc (should download many things)
mingw-get install g++
mingw-get install mingw32-make
mingw-get install gdb
mingw-get install pexports

5. Test the environment by running gcc. It should come back with gcc: no input files.

6. Launch the RTC Client, connect to your Jazz server if you have not done so already

7. Go to the Help->Install New Software menu

8. Install a new update site by clicking the Add button

9. Put the Galileo update site in the name and location: http://download.eclipse.org/releases/galileo
NOTE: You can also install RTC on Eclipse 3.6.x (Helios). If you have this configuration, use the Helios update site.
NOTE: If you are on Windows 7 or Vista, you have not turned off user access control (UAC) and you installed RTC into "Program Files", you must install as administrator by right clicking on the RTC executable and selecting "Run as administrator"

10. Search for and install the Eclipse C/C++ Development Tools

11. Restart RTC

12. Go to Window->Preferences->C/C++->New CDR Project Wizard and make sure you can see the MinGW toolchain and ensure that it is the preferred for all wizards.

13. Go to Window->Preferences->C/C++->New CDR Project Wizard->Makefile Project and set PE Windows parser in the Binary Parser tab. Go to the Builder Settings Tab and put: C:\MinGW\bin\mingw32-make.exe or wherever else your MINGW_HOME is.

14. Switch to the C/++ perspective and create a test project. File->New->C Test Project. Select the Hello World ANSI C Project. Click through to Finish.

15. Now you should be able Build from the Project menu and Run and Debug from the Run Menu

Pretty Simple!! Note that in the scenario above we allow RTC to manage our build environment. For some people (like myself) prefer to manage the Makefile and this is also possible in RTC and I will perhaps cover it in a future blog along with automated Makefile builds with Jazz.

Next up.... OSLC CM Client in C/C++...!