Tuesday, February 19, 2008

eclipse + cdt + cygwin = hours of misery! hooray!

Holy dammit Christmas, every step along the way to debug a simple hello world app is an exercise in misery.

  • it appears to have found make/gcc/etc... but then won't actually run anything. Launching eclipse via a batch script that adds c:\cygwin\bin to the path before starting eclipse fixes this. It would have been nice if eclipse threw up more red flags about not finding the things it needed.
  • I get everything building, launch the debugger and it complains that it can't find the source file. This was answered by the FAQ... once I found the FAQ.
I hate that I didn't think to look for the FAQ as the first step. I hate that the top google search results were all 3 or more years out of date. I hate Eclipse's web site -- it's as bad as my employer's intranet site.

10 comments:

Bartski said...

Geez, Mr Whiney Pants.

I hate the rain and sunny weather.
And I hate the beach and mountains too.
I don't like a thing about the city.
And I hate the countryside too!
I don't like a thing about your mother.
And I hate your daddy's guts too.
I don't like a thing about your sister.
And I think sex is overrated too.
And I...

Hate everything about you!

neeber said...

Yeah, yeah.

The worst part is how stupid I feel once I find the information. Typically at the end of an hours long hair-pulling session with Eclipse, I finally click the magic link that takes me to the exact (and up-to-date) information that I need.

If I'd phrased my search slightly differently, or decided to wade into the impenetrable Eclipse web site I might have found it earlier.

Bartski said...

Word up, homie.

I deal with this scenario all the time. And not just because I'm a bumbling simpleton. Granted, that's a big part of it, but...

Brian said...

I found it surprising that Eclipse/CDT/Cygwin didn't Just Work. If not for this blog post I might still be guessing what was wrong.

It seems odd that Eclipse was smart enough to find the cygwin compiler/linker but needs the Windows PATH to find gdb at all and needs this additional mapping for gdb to find the source files. I don't think one should feel stupid for failing to know this, especially when trying it for the first time.

The sad part is that other Windows people who have seen MS VC++ Just Work may give up on Eclipse.

Patrick said...

Thanks for the info and link to the FAQ, but now when I follow the FAQ, Eclipse changes /cygwin/c to \cygwin\c for me and it still doesn't work. How helpful!

I want this to work, as I like working with Open Source products that transcend operating systems. We also use Macs and Linux here.

Patrick said...

oops... after a restart, it worked. I hate the / \ Unix/Dos changeovers.

toshak said...

Just for the record, Eclipse/CDT/MinGW/MinSYS Just Works!

I guess it's a shame this, because Cygwin is more well know, has a smarter installer and looks more mature (eg. not like a hackers tool).

Anyhow, I find it almost surreal that once it works, Eclipse/CDT/MinGW not only works, but actually gives code completion (and header file completion as well), refactoring (renaming, function extraction), absolutely for free. For its weaknesses, ,ost obviously, it doesn't have content assist for preprocessor macros and STL type inspection (waiting for gdb 6 to come out to stable version though).

Aalok said...

Toshak, you are lucky.

I tried using MinGW's installer. It dies trying to contact its own website. I had to manually install based on minimal notes on the MinGW site.

As you know, gdb does not install automatically with MinGW. Nor is there documentation easily available that you need gdb for degugging.

I come from a world of using Turbo Pascal and MS (gasp) Visual Studio 2003 / 2005, where everything really just does work. I find the menus of CDT ridiculously long and riddled with unnecessary duplicates - as if many developers decided all the other developers were idiots and decided to do the same thing a different way. It's not intuitive - just like CDE is not intuitive to a GNOME user (or NeWS was in comparison to Display PDF = MAC OS X). CDT needs to seriously mature, and this is one example of where it should be relatively easy. On Windows, you have few options when trying to set up a GNU-based toolchain - MinGW or Cygwin. (That's it!)

Andrew said...

Thanks, this was the fix!

Thinking about the hours I invested into this when all it needed was a PATH tweak kind of hurts my head.

Can anyone explain why Eclipse seems to ignore the value of PATH when you set it the way that you're supposed to, i.e., in the Build Properties?

Anonymous said...

My God! CDT + Cygwin + gcc is some of the most mind-boggling setup stuff I have ever encountered. My main problem is getting CDT to debug using GDB through eclipse. It took me a good 6-hours and tons of searching on the net to get it to finally work! I even wrote a 2 page step by step manual for myself on how to set things up. Things worked fine for a while as long as I followed each of the 40+ steps one by one in the precise order they appeared. But then today, BOOM, it no longer works! The 40 steps give me the same old "Source not found" error. I now only use CDT as an editor and compile via the command line and debug via the gdb command line. Is this really such a difficult thing to build into CDT? Or is the demand for cygwin + CDT so low they don't feel its worth spending any time on? Call me Whiney pants if you want, but I spent literally DAYS trying to get this thing to work so please pity my tortured soul!! :) As may Dad always says, "Computers are great--WHEN THEY WORK!!"