From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12459 invoked by alias); 4 Jul 2014 08:43:08 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 12447 invoked by uid 89); 4 Jul 2014 08:43:06 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-wi0-f176.google.com Received: from mail-wi0-f176.google.com (HELO mail-wi0-f176.google.com) (209.85.212.176) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Fri, 04 Jul 2014 08:43:04 +0000 Received: by mail-wi0-f176.google.com with SMTP id n3so12650695wiv.9 for ; Fri, 04 Jul 2014 01:43:01 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.194.78.68 with SMTP id z4mr1440758wjw.126.1404463381307; Fri, 04 Jul 2014 01:43:01 -0700 (PDT) Received: by 10.194.173.2 with HTTP; Fri, 4 Jul 2014 01:43:01 -0700 (PDT) In-Reply-To: References: Date: Fri, 04 Jul 2014 08:43:00 -0000 Message-ID: Subject: Re: Problems with time.h from an inexperienced user? From: Csaba Raduly To: cygwin list Content-Type: text/plain; charset=ISO-8859-1 X-SW-Source: 2014-07/txt/msg00041.txt.bz2 Hi Hal, On Thu, Jul 3, 2014 at 11:37 PM, Hal Wills wrote: > Apparently there is a discrepancy between how Cygwin handles timeval.h > and how most Linux distributions handle it, because I am unable to > build htop and ncmpcpp with visualizer support on Cygwin. > > Here are the errors when I attempt to 'make' ncmpcpp and './configure' htop: > > > then mv -f ".deps/cmdargs.Tpo" ".deps/cmdargs.Po"; else rm -f > ".deps/cmdargs.Tpo"; exit 1; fi > In file included from cmdargs.cpp:41:0: > visualizer.h:72:2: error: 'timeval' does not name a type > timeval m_timer; > ^ > Makefile:444: recipe for target 'cmdargs.o' failed > make[2]: *** [cmdargs.o] Error 1 > make[2]: Leaving directory '/home/ullr/ncmpcpp/src' > Makefile:305: recipe for target 'all-recursive' failed > make[1]: *** [all-recursive] Error 1 > make[1]: Leaving directory '/home/ullr/ncmpcpp' > Makefile:217: recipe for target 'all' failed > make: *** [all] Error 2 > > > In file included from Header.h:13:0, > from Settings.h:15, > from AvailableMetersPanel.h:12, > from AvailableMetersPanel.c:8: > Meter.h:88:19: error: field 'time' has incomplete type > struct timeval time; > ^ At least for htop, this is due to the very Linux-centric nature of htop, and the different way system headers include each other. htop's Meter.h uses timeval, but does not include sys/time.h This is incorrect, but htop on Linux gets away with it, because Meter.h includes Process.h, which also doesn't include sys/time.h, but includes sys/types.h On my Ubuntu 12.04 LTS, /usr/include/x86_64-linux-gnu/sys/types.h includes time.h, which drags in the declaration of timeval. Here's a report from include-what-you-use (a tool based on clang) for Meter.h: ---------------------------------------- $ make CC=iwyu Meter.o iwyu -DHAVE_CONFIG_H -I. -DNDEBUG -g -O2 -MT Meter.o -MD -MP -MF .deps/Meter.Tpo -c -o Meter.o Meter.c Meter.h should add these lines: #include // for attrset, mvaddch #include // for timeval !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! #include "Object.h" // for Object, ObjectClass #include "Panel.h" // for MAX #include "RichString.h" // for MIN struct Meter_; Meter.h should remove these lines: The full include-list for Meter.h: #include // for attrset, mvaddch #include // for timeval #include "ListItem.h" // for ListItem #include "Object.h" // for Object, ObjectClass #include "Panel.h" // for MAX #include "ProcessList.h" // for ProcessList #include "RichString.h" // for MIN struct Meter_; --- Meter.c should add these lines: #include // for size_t #include // for snprintf Meter.c should remove these lines: - #include // lines 29-29 - #include "String.h" // lines 22-22 ---------------------------------------- You should #include in your local copy of Meter.h (and similar fixes elsewhere, if needed). Then you could try convincing the author of htop to fix his program by sending the necessary diffs. Csaba -- GCS a+ e++ d- C++ ULS$ L+$ !E- W++ P+++$ w++$ tv+ b++ DI D++ 5++ The Tao of math: The numbers you can count are not the real numbers. Life is complex, with real and imaginary parts. "Ok, it boots. Which means it must be bug-free and perfect. " -- Linus Torvalds "People disagree with me. I just ignore them." -- Linus Torvalds -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple