Print

eclipse_tour

Your IP: 38.107.179.210
View number: 621
Should be useable now.

Table of contents

1. Reference materials

[+]

2. Tool chain(s)

[+]

3. Development environment

[+]

4. Why our example is different.

There turns out to be a number of gotchas in using the "Hello World" example hard coded into the Autotools plug-in:

  • The Eclipse-CDT setup assumes your doing native development out of the box.
  • The "Hello World" example assumes the same and evidently does a global "Restore Defaults" in its template.
    Meaning that all of the carefully crafted cross-compile build configurations get wiped out.
  • Although the Eclipse-CDT supports CVS (and GIT, SVN) out of the box, we are using the Mercurial (hg) plug-in.
    Since HG is a distributed source control system, the wording of the stock panels can be hard to relate to HG operations.
  • The operation of both our Published and Un-Published Mercurial repositories is such that a person typically starts with a pair (local and remote) of empty repositories.
    The procedure described here has been changed so that the starting point is two, empty repositories placed in-sync with each other rather than making a clone of the empty remote repository.

4.1. Mercurial is a distributed source control system

Each instance of a directory tree under hg version control is complete unto itself. There is no concept of a "Central Repository" in this distributed source control system other than that established by user policy.

What makes each instance different is the contents of the .hg/hgrc file in the instance. This file is instance local and never transferred.

As a matter of use-case policy, the published (visiable in the web interface) repositories here are "owned" by the member that created them. Any member that has requested repository services has write authorization to both their private (in the sense that these are not shown in the web interface) and their published repositories.

At the moment of this page's writing, the server side automation that allows each owner to administer the server-side repository instance is not complete. It requires manual intervention by myself, our remote-agent script does not (yet) know how to fill in the server-side .hg/hgrc file.
Someday, RSN. . . . .

4.2. Mercurial as a web site master repository

Once a member has write access to the service, they create their remote repository with the "hg init ..." command. The same as they do for their local file system repositories, only the URI is different.

Then either the service's administrator (me) or the remote-agent script will fill in the server-side .hg/hgrc file.

The server-side .hg/hgrc file of the example dummy repository looks like this:

[web]
description = Eclipse-CDT Dummy
contact = minimod at morethan.org
hidden = false
allowpull = true

[ui]
username = mikez ~lt~minimod at morethan.org>

Which can be seen (since: hidden = false) in the list of published site repositories.
This example, empty, repository may be cloned (since: allowpull = true) as a read-only copy by anyone.
A member who just created an empty repository would be able to clone a read/write copy.
The procedure described in this HowTo does a "push" of an empty local repository to an empty remote repository to establish the initial in-sync condition.

4.3. Site repository service structure

Repositories accessed via HTTP are "public, read-only". Write access via HTTP is not supported.
All write access is controlled by ssh/rsa public-key authentication for both public and private work spaces.

From the viewpoint of site access, there are three repository service trees:

  • hg.minimodding.com/repos/[topic]/
    Any repository in this tree may or may not be visible in the web interface; under owner's control.
  • hg.minimodding.com/users/[username]/
    Features same as above, only organized as a per-member tree.
  • hg.minimodding.com/[username]/
    The "private" (never http published) per-member repository tree. This tree has at least one repository, the member's administration repository controlling the features of the repositories then own.

Every repository has an "owner" - the member who created it.
Every repository supports "group collaboration" where the group is one (the owner) or more people; as determined by that repository owner.
While the member who created a repository is the "owner" and "primary administrator", that owner may specify additional "sub-administrators".

4.4. Site repository URI structure

For public (read-only) clones of the repositories displayed in the web interface, the URI is simply the URL of the repository's name (left most column).

For all other access, ssh with 2,048 bit RSA public key authentication is used.
The URI structures are:

  • ssh://authority/repos/[topic]/[repo name]
  • ssh://authority/users/[user name]/[repo name]
  • ssh://authority/[user name]/[repo name]

The last of the three shown is used by the member to access both their administrative repository and their private repositories.

Examples of the third form can be seen in this HowTo, as:
ssh://hguser/mmghg/[repo name]

The authority field (hguser) is an entry in the user's home .ssh/config file that gives a short-cut name to all of the authority details required by ssh.

The user name field (mmghg) is the members repository service, user name. Not required to be the same as the web-site user name but commonly is the same. (In these examples, it is not a web-site member name.)

The tree structure of the repository collections is created by the user when they create the repository by name. The field shown above as: "repo name" may contain path components, even non-existent path components.

5. Compatibility Issues

As of this writing, there are known in-compatibilities between the tests generated by autoconf and certain Debian/Squeeze compilers.

I have not researched this to find if it is a problem with the generated tests (an autoconf problem) or a change in the series-4 compilers.

Close
warningKnown Status
Distribution: Debian/Squeeze, x86_64
gcc-3.4 works
gcc-4.1 works
gcc-4.2 none shipped
gcc-4.3 fails to properly execute the ./configure tests
gcc-4.4 fails to properly execute the ./configure tests

Code Sourcery, Cross compilers for MIPS
mips-sde-elf-gcc (4.3) works
mips-linux-gnu-gcc (4.3) works

Users must set their environment to a working gcc compiler!
Either by manually setting the link in /usr/bin or using your distribution's update-alternative utility.

You can test your own setup by installing "autoproject" and then doing a quick example.
Specify each available compiler as: CC=whatever ./configure
If your sample project fails to complete the configuration test, bit bucket that compiler!

6. Installed software

Since Eclipse/CDT is primarily just a GUI wrapper on top of your existing development tools, knowing what tools I had installed while developing this Wiki page may become significant.

The first thing to check if your results are different than this Wiki page is the versions of the external tools you are using.

6.1. Installed Auto Tools

[+]

6.2. Installed Mercurial (hg)

[+]

6.3. Installed native compilers

[+]

6.4. Selected native compiler

[+]

6.5. Installed cross-compilers

[+]

7. Preliminaries

There are a few things you need to decide and/or look-up about your own installation before following this Wiki example.
Things which will differ on your installation from what I show here, which is based on my installation.

Since this process is mostly a "fill-in-the-blanks" exercise, its handy to have the answers before you start. biggrin

7.1. Path to your installed hg

[+]

7.2. The short-cut name you set in your own .ssh/config file, mine:

[+]

7.3. Decide on a project name

[+]

7.4. Decide on remote repository location

[+]

8. New project set-up

From the decisions made in the prior section, you know:

  • The remote URI will be: ssh://hguser/mmghg/myHello
  • The absolute path to your local hg install is: /usr/bin/hg

8.1. Create new (empty) local workspace

This is an important point!
The Autotools "Hello World" example we will use here does a "Reset defaults" to your running instance of Eclipse when it loads.
Which has the side effect of removing all of your carefully defined "Build configurations". Oops.

mszick@deb2core:~$ mkdir ecdt

8.2. Bring up Eclipse

If the Workspace Laucher is still enabled, select the new workspace;
else:

Eclipse wrote:
File -> Switch workspace -> Other; select the new workspace.

You will be shown the Welcome screen (since the new workspace did not have an Eclipse .metadata directory).

Eclipse wrote:
Click: Go to Workbench

Select the C/C++ perspective if not already in that perspective.

8.3. Create the GNU Autotools example

Create the GNU Autotools Hello World example.

Eclipse wrote:
File -> New -> C Project -> GNU Autotools -> Hello World ANSI C Project
Set project name: myHello
"Finish"

The automation will kick in, build all of the infrastructure, create the source program, configure it for a native build and build it.

For instance:

mszick@deb2core:~$ ecdt/myHello/src/a.out
Hello World

8.4. Create the local hg, dvcs repository

Eclipse wrote:
Right-Click the project name -> New -> Other -> Mercurial -> Create New Mercurial Repository
Browse local file system to: /home/mszick/ecdt/myHello
"Finish"

8.5. Create the remote hg, dvcs repository

There is a slight disconnect between the way the hg plug-in author(s) use Mercurial and the way it is used here.

The work-around here will be to define several "External tool" commands.
Two commands that are used once per project and one that is used at each update of the remote repository

8.5.1. Create the "Remote Init" tool

The hg remote init command, used once per project.

Eclipse wrote:
Run -> External Tools -> External Tool Configurations
Select: Program, Click: New
Name: HGrinit
Main -> Location -> Browse File System
Select: /usr/bin/hg
Main -> Working Directory -> Browse Workspace
Select: myHello
Main -> Arguments
Set (without any of the quotes): "init ssh://hguser/mmghg/myHello "
Build -> un-set "Build before launch"
Common -> un-set "Launch in background"
"Apply"
"Run"

8.5.2. Expected Result

Expect something similar in the console window as the remote agent reply:

Remote agent reply
* * * * * * * *
sshd Agent: hgadm@173.236.167.90
ssh Client: mmghg@71.2.117.133
Collection:
    users   /home/hgadm/hg
    repos   /home/hgadm/hg
    mmghg   /home/hgadm/uhome
CommandStr: hg init /home/hgadm/uhome/mmghg/myHello
* * * * * * * *

Which, if you puzzle over it a bit, tells you the command just put the new repository in your private repository space.
It details the (local) client and (remote) agent that ran the command and lists the repository collections to which your account has access..

Note: There may be additional output. That just depends on where I am at in the on-going development of our remote agent script.

8.6. Local repository configuration

Since the current version of the hg plug-in doesn't get this correct, we get to do it ourselves.

8.6.1. Connect local and remote repositories

And since Eclipse really, really doesn't like us working in hidden directories, another one-time use custom tool:

Eclipse wrote:
Run -> External Tools -> External Tool Configurations
Select: Program
"New"
Name: HGtouch
Main -> Location: /bin/touch
Main -> Working Directory -> Browse Workspace
Select: myHello
Main -> Arguments: .hg/hgrc
Build -> un-set: "Build before launch"
Common -> un-set: "Launch in background"
"Apply"
"Run"

Now that we have successfully created a new, empty file within the hidden hg repository tree; Eclipse will allow us to edit it.

Eclipse wrote:
File -> Open File -> Browse to: .hg/hgrc

Set (URI to remote and local User Identification):

[paths]
default = ssh://hguser/mmghg/myHello

[ui]
username = yourname ~lt~e-you at e-where.tld~gt~

You need not be concerned about using your real e-mail address here, the hg web interface uses an anti-harvester algorithm to keep spam-bots from copying it.
The e-mail entry is bracketed with the usual "less than" and "greater than" characters.

8.6.2. Define files and/or directories to ignore

As a general rule, you don't want to push your local Eclipse environment configuration into a shared repository. That would just alter the Eclipse environment of anyone who cloned the repository.

Tell hg to ignore the Eclipse xml config files and any others that you don't want in the repository of your project.

Note: Since this is a private, remote repository you might want to track (by not ignoring) your local Eclipse environment configuration files.
That may help you keep track of how you set up your custom commands or recovering them if we stumble into another tool example that does a global "Restore Defaults" command.

Eclipse wrote:
File -> New -> General -> File
"Next"
Select: myHello
Set file name: .hgignore
"Finish"

Now edit it to contain the files and/or directories you do not want to track in the repository.
For example, set:

syntax: glob
.project
.cproject
.autotools
*.orig
*.rej   
*~   
*.bak   
*.out
*.i
*.s   
*.o
*.map
*.lst

8.7. Define a custom "Push" command

Once again, since this version of the hg plug-in can't seem to get this correct;
The first two commands we defined where only work-arounds used once per project.

This one will be used throughout the lifetime of the project so it will be put into the "Favorites" section of the list of external tools.

Eclipse wrote:
Run -> External Tools -> External Tool Configuration
Select: Program
"New"
Name: HGpush
Main -> Location: /usr/bin/hg
Main -> Working Directory -> Browse Workspace
Select: myHello
Main -> Arguments: push
Build -> un-set: "Build before launch"
Common -> Display in favorites -> set: External tools
Common -> un-set: "Launch in background"
"Apply"
"Run"

Expect:

pushing to ssh://hguser/mmghg/myHello
no changes found

Because: Since we haven't done an add and commit to the local repository, the local repository is empty and the remote repository is empty.

8.8. Get Eclipse up to speed about the local (file system) repository.

Eclipse wrote:
Right-click myHello -> Team -> Share -> Local repository

Note that your "Mercurial Repositories" view shows two repositories now, the local one and the remote.

9. Make the initial add-commit

This version of the hg plug-in has a combined add and commit function entry.

9.1. Update the local repository copy

Note: This obeys the .hgignore, we will edit that so the Eclipse xml files are added in a later step.
Note: For some reason, Eclipse-HG does not show us the "config.log" file here, but we will pick it up later.

Eclipse wrote:
Right-Click myHello -> Team -> Commit
Edit the commit message as desired;
Edit the (.hg/hgrc) committer information as desired;
Set: Select all
"OK"

9.2. Update the remote repository copy

Update the remote repository to match the local repository

Eclipse wrote:
Run -> External Tools -> HGpush

Expect:

pushing to ssh://hguser/mmghg/myHello
searching for changes
remote: adding changesets
remote: adding manifests
remote: adding file changes
remote: added 1 changesets with 29 changes to 29 files

10. Including the Eclipse configuration files

Since there is a lot more to do getting the cross-compile build commands defined and working.
In our private repository space, we want to track the Eclipse configuration files.

10.1. Edit the .hgignore file

Eclipse wrote:
File -> .hgignore
Delete the three hidden project file names.
Save

10.2. Add the Eclipse xml (and config.log) files

This will add these files to the changeset which will be marked by the next "commit" action.
Note: This list now includes the config.log file. (???)

Eclipse wrote:
Right-Click myHello -> Team -> Add
Select All
"OK"

10.3. Commit (local) these additions

Note: In this example, we are also including .hgignore in the tracked files.

Eclipse wrote:
Right-Click myHello -> Team -> Commit
Edit the commit message as desired
Edit the committer information if desired
"OK"

Now your local repository is "ahead" of your remote repository.
Which is just fine, you don't have to update your remote until your ready.

11. What more do you want?

A HowTo on setting the cross-compile build configurations maybe? biggrin


Contributors to this page: mikez .
Page last modified on Monday 20 of December, 2010 08:13:47 CST by mikez.