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++...!

12 comments:

  1. Can you please tell me the same procedure in Linux environment??? I am not able to configure OSLC in RTC 3.0.1. with linux

    ReplyDelete
  2. and also wants to know about following files supported Linux Fedora 13:

    1. libcurl: curl-7.21.7-devel-mingw32.zip
    2. libxml2: libxml2-2.7.8.win32.zip
    3. libiconv: iconv-1.9.2.win32.zip
    4. MinGW

    Do I need to set these environments in Linux too? if yes, then what are the files versions should I use to configure OSLC in RTC 3.0.1 (Linux)?

    ReplyDelete
  3. As Linux is a UNIX variant MinGW is not needed. If you are using Fedora all you need to ensure is that the GNU compiler/linker toolchain is installed (gcc, g++, binutils, etc.) and that the libcurl, libxml2, libiconv RPMs are installed, both the regular and devel RPMS as you will need the headers and static libs. You may find these RPM on the Fedora distribution. If not you can download them from the net. You can look at the library home pages or use something like http://rpmfind.net/.

    If there is stronger demand perhaps i will right an addendum article about Linux.

    ReplyDelete
  4. Hi Boris,

    Thanks for the reply..
    I have one more query that my company is using Rhapsody 7.6 on fedora 13 for C/C++ development... and I had also tried to create a perspective of Rhapsody 7.6 on linux with RTC 3.0.1. but failed to do the same.. is it mandatory to integrate both the tools for automated build generation??? if yes, then please guide me for the same....

    ReplyDelete
  5. I am not sure how your company is using Rhapsody but RTC can generate make files that can be used with the Jazz build Engine (with some small modifications). You generally should not need Rhapsody to do this.

    ReplyDelete
  6. Hi Boris,

    I had tried to develop OSLC with RTC 3.0.1.. but failed to do the same.. I am facing lots of problem in this... Can you please help me in Developing OSLC on Linux Environment??? I had already installed all the related RPMs including libcurl, libiconv, libxml2, etc....

    Thanks
    Shruti

    ReplyDelete
  7. This comment has been removed by the author.

    ReplyDelete
  8. Hi Boris,

    I had tried Eclipse helios 3.6x with RTC 3.0.1.. it is showing me the version compatibility error... While installing RTC 3.0.1 through Installation manager,it asks about adding existing eclipse IDE. at the end of the installation wizard, it gives me version problem.
    Is this is the problem with RTC 3.0.1 or I need to use another eclipse IDE rather then Helios3.6x??

    ReplyDelete
  9. Yes, Helios 3.6.x is supported by RTC 3.0.1.
    Basically, you need to install the Helios distribution first (into /opt/eclipse for example) from the eclipse home page and then install RTC 3.0.1 into it by selecting an existing eclipse installation.
    What kind of problems are you having? You can look at the installation log.
    Usually, CDT works out of the box with Linux. What exact problem are you experiencing?

    ReplyDelete
  10. Hi Boris,

    its a version problem, I had installed Helios first and then i installed RTC 3.0.1 by selecting an existing eclipse installation. At the end of the installation wizard when I clicked on "Install" at the same time it gives me a version of eclipse is not compatible" error.
    Is this problem occurs with linux platform???

    ReplyDelete
  11. It should work and has worked for me in the past so I am not sure what it is. My suggestions is to ask on the Jazz.net forums. My colleagues and I monitor that forum and some others may have had similar experiences. Get as much information as you can, logs, screenshots, exact environment configuration etc. The more the better, then post it with your issue.

    https://jazz.net/forums/

    ReplyDelete
  12. I have installed oslc in Maximo to integrate the maximo with jazz(rtc). But facing an error BMXAA4214E. Please help.

    ReplyDelete