Laika Eclipse plugin

I sneaked out of bed early this morning to invest some time in setting up Eclipse, hoping it can speed up my current tedious build/check/fix/build routine while working in Scratchbox.

  • You’ll want to install the recommended eclipse-gcj package as well as the eclipse package, because it seems to make it faster.
  • The Laika plugin requires a newer CDT (C/C++ development plugin for Eclipse), because Ubuntu Edgy has an old (and apparently incompatible) one. You can install that via Help/Software Updates/Find and Install/Search for new features to install/Callisto Discovery Site/yadda yadda yadda.
    I guess this will clash one day with the Ubuntu-packaged CDT, when they update it, but that’s some fun for later.
  • You’ll get “permission denied” and “file does not exist” errors during the install unless you fix the permissions (maybe this is OK in a fresh Ubuntu Edgy install?), like so:
    /usr/lib/eclipse$ sudo chown youruser:youruser plugins
    /usr/lib/eclipse$ sudo chown youruser:youruser features
    Update: In later versions, you will also need to do the same thing in /usr/local/lib/eclipse/
  • Install the Laika plugin by the same method, after adding the http://www.cs.tut.fi/~laika/update remote location. Don’t use the URL as the human-readable name for that location, or it will fail.
  • In Window/Preferences, there are now Scratchbox preferences. The defaults are mostly good, but you’ll want to change the X Environment preferences to run your start_xephyr script instead of vnc. There are details about this in the Laika manual (in the left-hand menu on their web site).

When using File/New/Project, you’ll now have extra wizards under C and C++, such as “Standard Make C Project inside Scratchbox”. When you create one of these projects you’ll see convenient toolbar buttons to start the X Server, and to start the Maemo desktop (af-sb-init.sh start) inside scratchbox, on that display. You can even start your project with a GTK+ helloworld.

Note that clicking the Run button will show an “Internal Error” until you open that Run combobox, select “Run …” and select a path to a generated executable in the “Application” entry (the second one).

Eclipse has awfully obscure UI, and I can’t be the only one who thinks this. I wonder why it isn’t getting better as a result of being open, or maybe it used to be worse. Unfortunately, people have become used to IDEs that hate them (MS Visual Studio).

Workspace schworkschpace

Now there’s just the usual IDE problem of it forcing you to import (copy) your projects from other directories instead of just letting you open your existing project. (This is not Laika’s fault.)

As I’ve mentioned before, I don’t understand why Eclipse defaults to forcing me to put my source code in $HOME/workspaces, and copying existing projects into there. Just let me edit my files and build my executables without pretending you’re special. It’s good to make it easy to make your first helloworld project, but don’t make it hard for me to actually work with this thing afterwards.

The fix for this is to:

  • Open Window/Preferences, choose General/Startup and Shutdown, and select “prompt for workspace on startup”. Notice how it’s cryptically named – it affects project creation, not program startup, and it doesn’t prompt, it just lets you choose a non-standard workspace, without telling you why you’d want to do that (see the next point). And it’s hidden away among hundreds of other options, without even a tooltip to guide the user.
  • When creating a project (The import feature is now unnecessary), the Project Contents frame now lets you select an existing project’s path instead of $HOME/workspace. If there’s a project there already then it will just add the Eclipse files without moving or copying your existing files. If there had been no files there, it would have offered to create some. That’s implicit, hidden, and unexpected. This “feature” should be made explicitly available.
  • Update: Aargh, no, it silently overwrites your build files, such as autogen.sh, configure.ac, all your Makefile.am files, and even the license (!) in COPYING. Bastard.

Further ranting: Why oh why can’t an Eclipse project contain characters such as “-“? Why go to the trouble of implementing UI to prevent users from entering this, instead of just fixing whatever text escaping bug it’s hiding.

Update: I was looking forward to code-completion, but I had to turn it off in Window/Preferences/C/C++/Editor/Content Assist and unclicking all 3 triggers. One minute of hang (100% CPU) whenever I type -> is not working out for me. (Or only 20 seconds when I tell it to search only the current project and not the include files.) When the user clicks or types away from the line, the code-completion search really should silently cancel.

10 thoughts on “Laika Eclipse plugin

  1. The Eclipse package that came with Edgy mysteriously stopped working for me after one or two runs. Some obscure error during startup. Installed the offical binaries and worked fine for me after that.

    I don’t really mind the Eclipse UI in general. It’s rather clunky though, even clunkier than some people claim GTK+ usually is. (I’m not one of those people. ;)) Especially the tabs are annoying.
    Workspaces are a bit of a hassle aswell, I have to agree. But I guess they did come in handy for me when I had a project depending on another project, a static library. Is it okay for me to like the way MSVC handles it with ‘solutions’? :)

    The only reason I’m using this is because I got so used to MSVC over the past half year of using it. I do believe using an IDE in general is far more productive than Vim or whatever. Personally, I really wish for MonoDevelop to start supporting C/C++ make projects. That’d be great.

    Another small thing that had me confused for almost an entire day straight was the naming of “Managed Make C/C++ project”. I thought ‘managed’ had something to do with .NET/Mono. :)

  2. A better solution for the permissions thing would be to install the plugins in a new extension directory in your home. You can do it while installing it.

    Also… what’s up with the “-” thing? All of my projects have dashes in their name…

  3. “I don’t understand why Eclipse defaults to forcing me to put my source code in $HOME/workspaces”

    Eclipse can create/open projects that are not in the workspace directory. Go to “New” – “Project”, for Java projects select the “Create project from existing source”, for General projects uncheck the “Use default location” box. These folder may be empty (new project) or contain existing source. If the existing project is an eclipse project (has the .project file…) then it will read the setting for that project.

    There are some restrictions, e.g. the non-default location can not be within an eclipse workspace directory.

    Mike.

  4. Projects which are not in the workspace can also be loaded using “File > Import… > General > Existing Projects into Workspace”, just make sure that the “Copy projects into workspace” box is unchecked on the next screen. This will work if you have an existing project with a .project file, otherwise use the method described by Mike above.

    In general I like the idea of workspaces a lot, it let’s you work with several projects at a time and you can switch to a different set of projects and settings easily.

    Nils

  5. Hi Murray,

    I’m sorry to hear your experiences weren’t great. The CDT is continuously improving and perhaps the version that you’re using isn’t the latest release. We’re also working on autotools support that I think is coming along nicely. It’s in our FC6 eclipse-cdt packages as a patch/extension but hopefully more distros will start shipping it now that our “Eclipse on Linux Distributions” project at eclipse.org has been approved.

    I’m suprised to hear that Ubuntu’s packages don’t carry the patch for using the update manager in your home dir. This is https://bugs.eclipse.org/bugs/show_bug.cgi?id=90630. I thought all distros were carrying this. Ben Konrath is going to work on finishing it up without API changes so it’ll hopefully go into 3.2.2 upstream.

    As for the -gcj package, that’s a decision made by Debian/Ubuntu. Fedora ships the gcj-compiled bits (*.jar.{so,db}) alongside the bytecode in our packages. This makes them bigger than they need to be if the user wants to use a proprietary JVM, but we can only support the free stack so we figured it was better to make the download size a bit bigger than have everyone ask “Why is everything so slow?” when they were just running the interpreter (gij). I think this is also an issue of DEB having the notion of “Suggests” where RPM doesn’t.

    Thanks for giving Eclipse a shot, though. We are really trying to make the CDT better for FOSS projects and we hope Gnome will be one of the first large projects that benefits. Stay tuned.

    Andrew

  6. Andrew, yeah, I’ve just been telling people about the work you’re doing on the CDT. I’m very optimistic about the future of Eclipse, what with your work and GPL Java to look forward to. It’s our best hope.

  7. Yeah, the code completion feature is totally unusable with C and C++ code. That, and the intimidating user interface, was what made me refrain from using Eclipse as well. I do use it occasionally for Java and Python projects though.

  8. I really want to like eclipse, but i cannot get past the clunkiness of the UI. It is very unusable. I get the impression that the Eclipse CDT/IDE is too heavily encumbered by the Java development/workflow. I much prefer Anjuta or Kdevelop. I really think the “managed C/C++” project type is bizarre. What is that?

    Sean

  9. Mike “Create project from existing source” requires that the project-type has such a wizard. They don’t all have this. It would be nice if the location was orthogonal to the project type, as it should be.

    Nils, I’m trying to create an Eclipse project, so it doesn’t help me much to import an existing Eclipse project.

Comments are closed.