Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "Getting started with CDT development"

(Using Oomph (experimental))
(22 intermediate revisions by 4 users not shown)
Line 1: Line 1:
== Eclipse SDK ==
+
== Eclipse installation ==
  
The very first thing you'll need to do to work on the CDT sources is install an Eclipse SDK (officially known as the ''Eclipse Project''). The SDK contains the Eclipse platform plus other features that developers typically need to develop plug-ins, e.g., JDT and PDE. Which version of the SDK you need depends on which version of CDT you're building. To build the master branch of CDT today (October 1, 2013), you need Eclipse 3.8 or above (4.2, 4.3, 4.4 will work). To build an earlier version of CDT, you'll probably want to use an earlier version of Eclipse SDK. Visit the [http://www.eclipse.org/cdt/downloads.php CDT downloads page] to see which version of Eclipse/SDK matches a particular CDT version.
+
The very first thing you'll need to do to work on the CDT sources is install an Eclipse package. The '''Eclipse IDE for Eclipse Committers''' package contains the Eclipse platform plus other features that developers typically need to develop plug-ins, e.g., JDT, PDE and EGit. Which version of Eclipse you need depends on which version of CDT you're building. To build the master branch of CDT today (September 26, 2014), you need Eclipse 4.4 or above. To build an earlier version of CDT, you might need to use an earlier version of Eclipse. Visit the [http://www.eclipse.org/cdt/downloads.php CDT downloads page] to see which version of Eclipse matches a particular CDT version.
 
+
One thing to keep in mind is that as development enters the new year, the CDT team typically starts making use of new API in the platform. The platform releases new API first via milestone releases. If someone in the CDT development team commits code to the master branch that uses that new API, all CDT developers (working on the master branch) are required to use the latest Eclipse SDK milestone from that point on. Typically such decisions/changes are discussed on the CDT dev list, so check there when in doubt. Alternatively, just use the latest platform milestone for building the master branch of CDT.<br>
+
  
 
==== Eclipse Setup ====
 
==== Eclipse Setup ====
* Get the latest Eclipse Standard package (current 4.3.1) from http://www.eclipse.org/downloads. You can also find older versions of the Eclipse SDK here: http://archive.eclipse.org/eclipse/downloads/
+
* Get the latest '''Eclipse IDE for Eclipse Committers''' (current 4.4.1) from http://www.eclipse.org/downloads. You can also find older versions of the Eclipse here: http://archive.eclipse.org/eclipse/downloads/
* Install a separate copy of CDT 8.2 to establish an API baseline in the Preferences. See [[CDT/policy#Using_API_Tooling]]
+
* Install a separate copy of CDT 8.5 (for master branch) to establish an '''API baseline''' in the Preferences. See [[CDT/policy#Using_API_Tooling]]
* Install EGit (Eclipse Git Team Provider). You can get it from Help->Install New Software... See docs http://wiki.eclipse.org/EGit/User_Guide
+
* Install '''API Tools Execution Environment Descriptions'''. You can install it by going to Help -> Install New Software..., then select the update site for the Eclipse Project matching your Eclipse version, currently it is http://download.eclipse.org/eclipse/updates/4.4
* Install API Tools Execution Environment Descriptions. You can get it from Help->Install New Software...
+
  
 
== Setting up the Sources<br>  ==
 
== Setting up the Sources<br>  ==
Line 19: Line 16:
 
From the Git perspective, select Clone a Git Repository action
 
From the Git perspective, select Clone a Git Repository action
 
* Cut & Paste following url in the first page of wizard for cloning: git://git.eclipse.org/gitroot/cdt/org.eclipse.cdt.git
 
* Cut & Paste following url in the first page of wizard for cloning: git://git.eclipse.org/gitroot/cdt/org.eclipse.cdt.git
* It will ask you what branches to import. If you only care about head select master, if you want to work with other branches select a corresponding branch, for example cdt_8_0.
+
* It will ask you what branches to import. If you only care about head select master, if you want to work with other branches select a corresponding branch, for example cdt_8_4.
 
* Press Next. As location where files are stored select a folder inside your workspaces, for example workspace/cdt-git
 
* Press Next. As location where files are stored select a folder inside your workspaces, for example workspace/cdt-git
 
* Press Finish (skip Gerrit page)
 
* Press Finish (skip Gerrit page)
 
* This should take about 3-5 minutes
 
* This should take about 3-5 minutes
 
From the repo, select Import Projects...
 
From the repo, select Import Projects...
* Select all the projects or individual. Project filter does not seems to work. It maybe easier select all, then close projects you don't need
+
* Select all the projects or individual. It maybe easier select all, then close projects you don't need
  
 
Here's a list of projects you could start with:
 
Here's a list of projects you could start with:
Line 35: Line 32:
 
* org.eclipse.cdt.codan.ui.cxx
 
* org.eclipse.cdt.codan.ui.cxx
 
* org.eclipse.cdt.core
 
* org.eclipse.cdt.core
 +
* org.eclipse.cdt.core.native
 
* org.eclipse.cdt.core.linux          (Platform specific, change accordingly)
 
* org.eclipse.cdt.core.linux          (Platform specific, change accordingly)
 
* org.eclipse.cdt.core.linux.x86_64  (Platform specific, change accordingly)
 
* org.eclipse.cdt.core.linux.x86_64  (Platform specific, change accordingly)
Line 57: Line 55:
 
* org.eclipse.cdt.managedbuilder.ui
 
* org.eclipse.cdt.managedbuilder.ui
 
* org.eclipse.cdt.ui
 
* org.eclipse.cdt.ui
 +
* org.eclipse.cdt.target
  
 
If you want to run tests, add the corresponding test project, for example, org.eclipse.cdt.core.tests.
 
If you want to run tests, add the corresponding test project, for example, org.eclipse.cdt.core.tests.
  
 
==== Dependencies ====
 
==== Dependencies ====
Some parts of CDT have additional dependencies, which are easiest to install via update sites into your own dev environment (assuming a self hosted launch):
+
The easiest way to satisfy all dependencies for CDT is to set a target platform. The target platform will download all the dependencies so that you can compile and run your imported CDT plug-ins without having to install the dependencies in your Eclipse installation.
  
If using lp-parsers:
+
To set the target platform:
* SourceForge LPG and its Java runtime, from a stable Orbit build repository found on http://download.eclipse.org/tools/orbit/downloads/
+
* Expand the "org.eclipse.cdt.target" project.
If using test plugins:
+
* Double-click on '''cdt-e4.4.target''' (or the .target file that corresponds to the Eclipse version you want to target).
* SWTBot, from http://download.eclipse.org/technology/swtbot/helios/dev-build/update-site
+
* In the editor that just opened, click ''Set as Target Platform'' on the top right.
* Hamcrest Library of Matchers (not "core"), Apache Jakarta Log4j, from a stable Orbit build's update site found on http://download.eclipse.org/tools/orbit/downloads/
+
 
* Using git with git://git.eclipse.org/gitroot/platform/eclipse.platform.releng.git, import the project org.eclipse.test.performance
+
Eclipse will now download the required dependencies, which may take some time the first time. Once this is done, it should trigger a full build of your workspace and a lot of errors should go away.
If using cross component plugins:
+
 
* TM and RSE 3.3.1 Main Features, from the Target Management (RSE) project: http://download.eclipse.org/tm/updates/3.3/
+
If you wish to switch target platforms in the future, you can open a different .target file, or you can go to "Window -> Preferences -> Plug-in Development -> Target Platform".
  
 
== Launching  ==
 
== Launching  ==
Line 76: Line 75:
 
After all the CDT projects have successfully built, you'll probably want to run and/or do source-level debugging of the CDT code. Open the PDE (Plug-in Development Environment) perspective:&nbsp; Window-&gt;Perspective-&gt;Other-&gt;"Plug in Development". There, you'll see a project with the name org.eclipse.cdt.ui, right click the org.eclipse.cdt.ui project, select "Run As"-&gt;"eclipse application". You should see a new instance of eclipse - with the latest version of eclipse CDT plugins.  
 
After all the CDT projects have successfully built, you'll probably want to run and/or do source-level debugging of the CDT code. Open the PDE (Plug-in Development Environment) perspective:&nbsp; Window-&gt;Perspective-&gt;Other-&gt;"Plug in Development". There, you'll see a project with the name org.eclipse.cdt.ui, right click the org.eclipse.cdt.ui project, select "Run As"-&gt;"eclipse application". You should see a new instance of eclipse - with the latest version of eclipse CDT plugins.  
  
Alternatively, you can create a Launcher: Go to Run - Debug Configurations... Select "Eclipse Application" and click New. Give the Debug Configuration a Name and the other defaults are OK. This appears to be a more widely used launching technique. You may also want to go to the Arguments tab and add "-console" to the list of Program arguments. This will open an OSGi console and allow you to (temporarily) insert system.out.println statements in the CDT code to sanity check your plug-in development procedure. Regardless of whether you're launching an Eclipse Application using Debug As... or Run As..., or "deploying" your modified plugin(s) by Exporting them into a target Eclipse installation, you should see your debug println statements. Until you are familiar with the CDT code base, however, using a Debug Launcher and experimenting with breakpoints is probably the best way to get a warm fuzzy feeling if you have doubts about modifications you are making.<br>
+
Alternatively, you can create a Launcher: Go to Run - Debug Configurations... Select "Eclipse Application" and click New. Give the Debug Configuration a Name and the other defaults are OK. This appears to be a more widely used launching technique.
  
Note: On Mac OS X, you might need an additional argument in the launch configuration, see [http://www.eclipse.org/swt/faq.php#cocoa32launch SWT FAQ]
+
Until you are familiar with the CDT code base, using a Debug Launcher and experimenting with breakpoints is probably the best way to get a warm fuzzy feeling if you have doubts about modifications you are making.<br>
  
 
== Submitting and Applying Patches  ==
 
== Submitting and Applying Patches  ==
  
If you wish to contribute your changes to CDT see these [[CDT/contributing|instructions]].  
+
If you wish to contribute your changes to CDT see these [[CDT/contributing|instructions]].
 
+
In order to apply a patch, right click the relevant project, and select Team-&gt;Apply Patch...
+
 
+
Keep in mind that each patch is a list of "before" and "after" text changes to files. These are highly version-specific. If you are trying to apply an old patch to newer code, or vice versa, you will encounter problems in the Apply Patch Wizard. <br>
+
  
 
== Creating a runtime patch ==
 
== Creating a runtime patch ==
Line 96: Line 91:
 
You can generate your own CDT zip using Maven.
 
You can generate your own CDT zip using Maven.
  
* Install Maven if not already installed (mvn command). Maven 3.0.0 or greater is required.
+
* Install Maven if not already installed (mvn command). Maven 3.0.5 or greater is required.
 
* In command line, change the directory to the cdt git directory (the top folder that contains a pom.xml file)
 
* In command line, change the directory to the cdt git directory (the top folder that contains a pom.xml file)
* Run "mvn package". This will take a lot longer the first time because it needs to download a lot of things. If it seems stuck on a download and you're behind a proxy, make sure that you set your Maven proxy settings.
+
* Run "mvn package". This will take a lot longer the first time because it needs to download a lot of things. If it seems stuck on a download and you're behind a proxy, make sure that you set your [http://maven.apache.org/settings.html#Proxies Maven proxy settings].
 
* If the build is succesfull, the zip will be in org.eclipse.cdt/releng/org.eclipse.cdt.repo/target/org.eclipse.cdt.repo.zip
 
* If the build is succesfull, the zip will be in org.eclipse.cdt/releng/org.eclipse.cdt.repo/target/org.eclipse.cdt.repo.zip
 
* Go to Install new software, click Add, Archive and browse for to the zip
 
* Go to Install new software, click Add, Archive and browse for to the zip
  
 
You should now be able to install or update CDT using your modified code.
 
You should now be able to install or update CDT using your modified code.
 +
 +
== Using Oomph (experimental) ==
 +
 +
You can use the Oomph installer to setup the Eclipse installation and everything required to get started with CDT development. It downloads Eclipse, sets the API baseline, clones the CDT git repo and imports the projects for you.
 +
 +
# Download the Oomph installer, available at https://wiki.eclipse.org/Eclipse_Oomph_Installer
 +
# Start the installer.
 +
# After the initial preference questions, at the package selection, click the Advanced Mode button in the top-right corner.
 +
# Select Eclipse IDE for Eclipse Committers. Click next.
 +
# Under Eclipse.org, double-click on CDT
 +
# Enter installation folder name, workspace name, etc. Click Next, Finish.
 +
 +
After the initial setup, you should have a complete Eclipse environment to work on CDT.
  
 
[[Category:CDT]]
 
[[Category:CDT]]

Revision as of 13:45, 28 January 2015

Eclipse installation

The very first thing you'll need to do to work on the CDT sources is install an Eclipse package. The Eclipse IDE for Eclipse Committers package contains the Eclipse platform plus other features that developers typically need to develop plug-ins, e.g., JDT, PDE and EGit. Which version of Eclipse you need depends on which version of CDT you're building. To build the master branch of CDT today (September 26, 2014), you need Eclipse 4.4 or above. To build an earlier version of CDT, you might need to use an earlier version of Eclipse. Visit the CDT downloads page to see which version of Eclipse matches a particular CDT version.

Eclipse Setup

Setting up the Sources

For detailed information on how to setup git, and check out source of CDT as a committer, see CDT/git. Otherwise, follow the non-committer setup instructions below.

Clone the Repo

From the Git perspective, select Clone a Git Repository action

  • Cut & Paste following url in the first page of wizard for cloning: git://git.eclipse.org/gitroot/cdt/org.eclipse.cdt.git
  • It will ask you what branches to import. If you only care about head select master, if you want to work with other branches select a corresponding branch, for example cdt_8_4.
  • Press Next. As location where files are stored select a folder inside your workspaces, for example workspace/cdt-git
  • Press Finish (skip Gerrit page)
  • This should take about 3-5 minutes

From the repo, select Import Projects...

  • Select all the projects or individual. It maybe easier select all, then close projects you don't need

Here's a list of projects you could start with:

  • org.eclipse.cdt.codan.checkers
  • org.eclipse.cdt.codan.checkers.ui
  • org.eclipse.cdt.codan.core
  • org.eclipse.cdt.codan.core.cxx
  • org.eclipse.cdt.codan.ui
  • org.eclipse.cdt.codan.ui.cfgview
  • org.eclipse.cdt.codan.ui.cxx
  • org.eclipse.cdt.core
  • org.eclipse.cdt.core.native
  • org.eclipse.cdt.core.linux (Platform specific, change accordingly)
  • org.eclipse.cdt.core.linux.x86_64 (Platform specific, change accordingly)
  • org.eclipse.cdt.core.win32 (Platform specific, change accordingly)
  • org.eclipse.cdt.core.win32.x86 (Platform specific, change accordingly)
  • org.eclipse.cdt.core.win32.x86_64 (Platform specific, change accordingly)
  • org.eclipse.cdt.debug.core
  • org.eclipse.cdt.debug.mi.core
  • org.eclipse.cdt.debug.mi.ui
  • org.eclipse.cdt.debug.ui
  • org.eclipse.cdt.dsf
  • org.eclipse.cdt.dsf.gdb
  • org.eclipse.cdt.dsf.gdb.ui
  • org.eclipse.cdt.dsf.ui
  • org.eclipse.cdt.gdb
  • org.eclipse.cdt.gdb.ui
  • org.eclipse.cdt.launch
  • org.eclipse.cdt.make.core
  • org.eclipse.cdt.make.ui
  • org.eclipse.cdt.managedbuilder.core
  • org.eclipse.cdt.managedbuilder.gnu.ui
  • org.eclipse.cdt.managedbuilder.ui
  • org.eclipse.cdt.ui
  • org.eclipse.cdt.target

If you want to run tests, add the corresponding test project, for example, org.eclipse.cdt.core.tests.

Dependencies

The easiest way to satisfy all dependencies for CDT is to set a target platform. The target platform will download all the dependencies so that you can compile and run your imported CDT plug-ins without having to install the dependencies in your Eclipse installation.

To set the target platform:

  • Expand the "org.eclipse.cdt.target" project.
  • Double-click on cdt-e4.4.target (or the .target file that corresponds to the Eclipse version you want to target).
  • In the editor that just opened, click Set as Target Platform on the top right.

Eclipse will now download the required dependencies, which may take some time the first time. Once this is done, it should trigger a full build of your workspace and a lot of errors should go away.

If you wish to switch target platforms in the future, you can open a different .target file, or you can go to "Window -> Preferences -> Plug-in Development -> Target Platform".

Launching

After all the CDT projects have successfully built, you'll probably want to run and/or do source-level debugging of the CDT code. Open the PDE (Plug-in Development Environment) perspective:  Window->Perspective->Other->"Plug in Development". There, you'll see a project with the name org.eclipse.cdt.ui, right click the org.eclipse.cdt.ui project, select "Run As"->"eclipse application". You should see a new instance of eclipse - with the latest version of eclipse CDT plugins.

Alternatively, you can create a Launcher: Go to Run - Debug Configurations... Select "Eclipse Application" and click New. Give the Debug Configuration a Name and the other defaults are OK. This appears to be a more widely used launching technique.

Until you are familiar with the CDT code base, using a Debug Launcher and experimenting with breakpoints is probably the best way to get a warm fuzzy feeling if you have doubts about modifications you are making.

Submitting and Applying Patches

If you wish to contribute your changes to CDT see these instructions.

Creating a runtime patch

If you want just patch up your local installation you can export plugin(s) to which source patch is applied using Export->Plugins, export as archive and use your eclipse installation as destination. Make sure after this you have 2 version of the same plugin (one from installation and one new) in the plugins directory and version qualifier of your new plugin is higher.

Building the CDT p2 repository

You can generate your own CDT zip using Maven.

  • Install Maven if not already installed (mvn command). Maven 3.0.5 or greater is required.
  • In command line, change the directory to the cdt git directory (the top folder that contains a pom.xml file)
  • Run "mvn package". This will take a lot longer the first time because it needs to download a lot of things. If it seems stuck on a download and you're behind a proxy, make sure that you set your Maven proxy settings.
  • If the build is succesfull, the zip will be in org.eclipse.cdt/releng/org.eclipse.cdt.repo/target/org.eclipse.cdt.repo.zip
  • Go to Install new software, click Add, Archive and browse for to the zip

You should now be able to install or update CDT using your modified code.

Using Oomph (experimental)

You can use the Oomph installer to setup the Eclipse installation and everything required to get started with CDT development. It downloads Eclipse, sets the API baseline, clones the CDT git repo and imports the projects for you.

  1. Download the Oomph installer, available at https://wiki.eclipse.org/Eclipse_Oomph_Installer
  2. Start the installer.
  3. After the initial preference questions, at the package selection, click the Advanced Mode button in the top-right corner.
  4. Select Eclipse IDE for Eclipse Committers. Click next.
  5. Under Eclipse.org, double-click on CDT
  6. Enter installation folder name, workspace name, etc. Click Next, Finish.

After the initial setup, you should have a complete Eclipse environment to work on CDT.

Back to the top