Eclipse - How to Setup Eclipse in a Shrew Checkout: Difference between revisions

From OPeNDAP Documentation
⧼opendap2-jumptonavigation⧽
Line 109: Line 109:
This will create a separate project tab for the module.  If you click on this project and press the Build button (with the hammer icon), just that project will be built.
This will create a separate project tab for the module.  If you click on this project and press the Build button (with the hammer icon), just that project will be built.


==Building==
==Debugging a Module==
==Debugging a Module==

Revision as of 20:11, 22 April 2010

Eclipse as an IDE for Shew

It can be useful to use an IDE when debugging and developing for Hyrax due to the graphical interface to gdb as well as the extensive searching and code indexing features that Eclipse provides. This document will go through the steps for getting Eclipse set up pointing into a Shrew checkout. We also explain how we set up debug configurations for debugging modules using the besstandalone program.

Downloading Eclipse

Eclipse may be found at http://eclipse.org/downloads/

Download the Eclipse for C/C++ Development (with Mylyn Integration).

If you also plan to do Java development, you can add these bundles in later using the Software Update.

Creating a Workspace In A Shrew Directory

You need to have a shrew project checked out and built in debug mode using the standard approach. The first-time debug build is required after a fresh checkout in order to get autoconf and configure to run properly and set up the Makefile for all the projects. Eclipse will then piggyback on these.

If you do not have this done already, please follow the steps in the next section "Setting Up a Debug Shrew Project"

Setting Up a Debug Shrew Project

Go to the directory you want the shrew project and do a checkout. For example, to get the fully trunk shrew:

svn co http://scm.opendap.org/svn/trunk/shrew

Note that shrew uses svn externals, so make sure you know which versions you are getting so when you commit you are commiting to the right place!

To check the externals being used, get the property in the shrew directory you checked out:

svn propget svn:externals

which for the trunk shrew returns:

aries@chinchilla$ svn propget svn:externals
^/trunk/libdap src/libdap
^/trunk/bes src/bes
^/trunk/dap-server src/modules/dap-server
^/trunk/freeform_handler src/modules/freeform_handler
^/trunk/fileout_netcdf src/modules/fileout_netcdf
^/trunk/netcdf_handler src/modules/netcdf_handler
^/trunk/hdf4_handler src/modules/hdf4_handler
^/trunk/hdf5_handler src/modules/hdf5_handler
^/trunk/ncml_module src/modules/ncml_module
^/trunk/wcs_gateway_module src/modules/wcs_gateway_module
^/trunk/wcs_module src/modules/wcs_module
^/trunk/olfs src/olfs


Module Development/Debugging

If you plan to debug or develop modules for the BES in Hyrax 1.6, we suggest you use:

http://scm.opendap.org/svn/branch/shrew/module_dev_1.6

as the shrew starting point as this will be set to use the trunk versions of the modules but to use the fixed, release versions of libdap and the BES for Hyrax 1.6. This ensures that development doesn't use any new APIs from the libdap or bes trunk versions so that modules may be released incrementally and dynamically work with an existing Hyrax 1.6 installation with no other changes necessary.

Configuring a Debug Build

Since you likely plan to use the shrew project for debugging in Eclipse, you'll want to run the build_hyrax_debug script in order to make sure the configuration for all the subprojects is set up to perform debug builds (i.e. no optimization and full symbol tables). That way Eclipse will be able to find breakpoints and let you view variables in a running debug.

In a bash terminal in the top-level shrew directory, type:

source build_hyrax_debug

This will run autoconf on everything, then configure, then build it. If there are any missing dependencies, make sure to get them until everything builds. This will ensure that all the subprojects are configured properly so that the Eclipse Build command, which simply calls 'make', will succeed in compiling a debug version of the specified project.


Pointing the Workspace at Shew Using Existing Makefiles

New Workspace

First, create a new workspace if you have an existing one. You can use:

File > Switch Workspace > Other...

and just create a new directory for the workspace to make the new one.

New Project for Shrew

You probably won't use this directly, but making a top-level project for shrew will let Workspace searches find functions and files in all the subprojects. More likely, you will be using a specific subproject directly. (More on this later).

Create a new Project in the workspace.

File > New > C++ Project

In the dialog:

  • Enter a project name. Something like "Shrew" should be OK.
  • UNcheck "Use Default Location" since we want to point at an existing directory
  • Enter the location of the shrew project you checked out and want to debug (you can use Browse...)
  • Select the "Makefile Project" tab since we want to use 'make' to build
  • Under the "Makefile Project" select "Empty Project" so Eclipse doesn't overwrite the existing Makefile
  • Select the "MaxOSX GCC Toolchain"

You will now have a shrew project. Since Eclipse uses 'make all' to build and shrew doesn't have this target, you can't use Build on shrew. In general, you'll want to create a subproject for each project you plan to modify so that you can do make on each one. Otherwise, you will want to do makes in the shell as needed.

New Project for BES and/or Libdap

If you plan to modify the BES or libdap, you can make a project for each of these as well in the same way, but by pointing the location of the project at the appropriate subdirectory (src/bes or src/libdap) of the top-level shrew checkout.

New Project for a Module

In this section, we'll set up the subproject for a particular module you'll want to develop or debug. I will use the ncml_module as the example since this is the one I normally develop and I have added some tools to the project to make setting up debugging files easier.

Create the project just like the shrew project, using an Empty Project in the Makefile Project tab. Set the location to be the subdirectory of the top-level shrew, e.g.

src/modules/ncml_module

This will create a separate project tab for the module. If you click on this project and press the Build button (with the hammer icon), just that project will be built.

Debugging a Module