This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: blackbox does not compile with latest cygwin


On Tue, 27 Apr 2004, Carlo Florendo wrote:

> Igor Pechtchanski wrote:
>
> >On Mon, 26 Apr 2004, Carlo Florendo wrote:
> >
> >
> >>Larry Hall wrote:
> >>
> >>
> >>>At 11:28 PM 4/25/2004, you wrote:
> >>>
> >>>
> >>>>Hi,
> >>>>
> >>>>Now, upon running ./configure on blackbox, all was ok.  When I started make, this is the error I got:
> >>>>
> >>>>Making all in src
> >>>>Window.cc:1396: error: `assert' undeclared (first use this function)
> >>>>Window.cc:3234: error: `assert' undeclared (first use this function)
> >>>>
> >>>>
> >>>Clearly the problem is that you're missing "#include <assert.h>".  That's
> >>>likely the result of a configure problem but I didn't investigate to any
> >>>great extent so I might be wrong.
> >>>
> >>>
> >>Right!  When I added "#include <assert.h>", blackbox compiled clearly.
> >>How come it didn't complain in the past cygwin?  I compiled the same
> >>blackbox at a linux box (without my added "#include <assert.h>") and the
> >>thing built perfectly.  How come the new cygwin behaves differently?
> >>
> >>Thanks!
> >>
> >>Best Regards,
> >>Carlo
> >>
> >>
> >
> >Well, as a WAG, assert.h could have been #included in some standard header
> >file before, and isn't now.  This indicates buggy software, BTW: it
> >shouldn't rely on anything else including the needed functionality --
> >that's what the double include guards are for.  The rule of thumb is:
> >"when in doubt, include it".  You might want to submit a patch to the
> >blackbox maintainers.
> >       Igor
>
> I installed the exact blackbox version as last time which is the latest
> official release.  This latest official release has one file that calls
> assert() but does not #include it.  I checked its include tree and, as
> far as I looked, have not found the #include <assert.h> anywhere on the
> tree.

Yes, because it expects <assert.h> to be included from one of the system
headers.

> Other files that call assert have the header included in them. The
> strangest thing is that the same version compiles under the current
> linux that I have (Redhat 9.0), the former cygwin, but *not* the latest
> cygwin.

That's because some Cygwin system headers got changed to not include
<assert.h> where they previously did.

> It compiles with the latest cygwin if I #include <assert.h> on
> the file in question.
>
> Does this mean that there is a problem with gcc?   or configure?  I'm
> confused now whether the problem resides in the packaging of blackbox,
> in the way ./configure runs on the old cygwin, or on the way ./configure
> runs on the new cygwin, or in Linux or even in gcc.    Why doesn't gcc
> complain in the old cygwin and in Linux?

The problem is with blackbox.  Apparently, some of the Linux system
headers[*] include <assert.h>, and so did some of the Cygwin ones.  So
this particular file in blackbox relied on a needed header (<assert.h>) to
be inluded from elsewhere (another header).  This is a bug.  Cygwin's
headers got changed, and <assert.h> is no longer in the include chain, so
blackbox broke.  The fix is to #include <assert.h> in the file that calls
assert(). It may also be possible to do this through some configure magic
if the project maintainers *really* want to avoid including <assert.h>
twice in the project code, but why bother?

> I could submit a patch to the blackbox maintainers but will have to tell
> them that the reason for it is so that it will compile with the latest
> cygwin.  Or could it be that ./configure needs to be patched?
>
> Thanks a lot!
> Best Regards,
> Carlo

The reason for the patch is portability.  Sure, it will compile on the
current Linux, but POSIX doesn't require any other header to include
<assert.h>, so blackbox should do it itself.  As I said above, I don't
think you should bother with patching configure.
	Igor
[*] If you want to find out which header includes <assert.h> on Linux,
simply preprocess the broken file on Linux using gcc -E and see where
"assert.h" got included from.
-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_		pechtcha@cs.nyu.edu
ZZZzz /,`.-'`'    -.  ;-;;,_		igor@watson.ibm.com
     |,4-  ) )-,_. ,\ (  `'-'		Igor Pechtchanski, Ph.D.
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

"I have since come to realize that being between your mentor and his route
to the bathroom is a major career booster."  -- Patrick Naughton

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]