X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-1.5 required=5.0 tests=AWL,BAYES_00,TW_XZ,TW_YG,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Message-ID: <4DA57D75.8070106@lysator.liu.se> Date: Wed, 13 Apr 2011 12:39:49 +0200 From: Peter Rosin User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.15) Gecko/20110303 Thunderbird/3.1.9 MIME-Version: 1.0 To: cygwin AT cygwin DOT com Subject: #include problems Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Hi! I am in the habit of building packages using a VPATH build in a subdirectory of the package, like so: tar xzf foo-x.y.tar.gz cd foo-x.y mkdir cygwin cd cygwin ../configure make This no longer works as it used to (at least not with all packages). I have not bisected when the problem was introduced, but I have reduced it to this: configure first creates a config.h in .../foo-x.y/cygwin/config.h lets fake one with this trivial content: #define HAVE_NOTHING some package source file is in .../foo-x.y/src/main.c lets fake one with this trivial content: #include "config.h" #include int main(void) { printf("hello world\n"); } In an autotooled project with subdir objects, you then get this command run from the .../foo-x.y/cygwin directory when making (I have removed a bunch of irrelevant gcc options): gcc -I. -I.. ../src/main.c *BLAM* In file included from ../src/main.c:2: /usr/include/stdio.h:53: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘fpos_t’ In file included from ../src/main.c:2: /usr/include/stdio.h:210: error: expected declaration specifiers or ‘...’ before ‘fpos_t’ /usr/include/stdio.h:216: error: expected ‘;’, ‘,’ or ‘)’ before ‘*’ token /usr/include/stdio.h:379: error: expected declaration specifiers or ‘...’ before ‘fpos_t’ /usr/include/stdio.h:380: error: expected ‘;’, ‘,’ or ‘)’ before ‘*’ token /usr/include/stdio.h:535: error: expected declaration specifiers or ‘...’ before ‘fpos_t’ /usr/include/stdio.h:540: error: expected declaration specifiers or ‘...’ before ‘fpos_t’ Running the above with -E gives this output (truncated): # 1 "../src/main.c" # 1 "" # 1 "" # 1 "../src/main.c" # 1 "./config.h" 1 # 2 "../src/main.c" 2 # 1 "/usr/include/stdio.h" 1 3 4 # 29 "/usr/include/stdio.h" 3 4 # 1 "/usr/include/_ansi.h" 1 3 4 # 15 "/usr/include/_ansi.h" 3 4 # 1 "/usr/include/newlib.h" 1 3 4 # 16 "/usr/include/_ansi.h" 2 3 4 # 1 "/usr/include/sys/config.h" 1 3 4 # 1 "/usr/include/machine/ieeefp.h" 1 3 4 # 5 "/usr/include/sys/config.h" 2 3 4 # 1 "/usr/include/sys/features.h" 1 3 4 # 6 "/usr/include/sys/config.h" 2 3 4 # 207 "/usr/include/sys/config.h" 3 4 # 1 "../cygwin/config.h" 1 3 4 # 208 "/usr/include/sys/config.h" 2 3 4 # 17 "/usr/include/_ansi.h" 2 3 4 # 30 "/usr/include/stdio.h" 2 3 4 and the reason can be spotted: /usr/include/sys/config.h tries to include /usr/include/cygwin/config.h (with #include ) but gets the config.h from the project instead via the -I.. option (see the # 1 "../cygwin/config.h" line, near the end). The -I. and -I.. options are coming from autoconf/automake and the DEFAULT_INCLUDES variable, so I didn't explicitly specify them in the real world case I got hit by. The workaround is trivial, just use a build dir that is named something !cygwin - or even better - build outside the source tree instead of beneath it. But I'm probably not the first to suffer from this [1] and I'm sure I'm not last... $ cygcheck -c cygwin gcc4 Cygwin Package Information Package Version Status cygwin 1.7.9-1 OK gcc4 4.3.4-4 OK Cheers, Peter [1] http://www.mail-archive.com/mpir-devel AT googlegroups DOT com/msg03737.html -- 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