#include problems

2011-04-13 Thread Peter Rosin
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 stdio.h
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 built-in
# 1 command-line
# 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 cygwin/config.h)
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  VersionStatus
cygwin   1.7.9-1OK
gcc4 4.3.4-4OK

Cheers,
Peter

[1] http://www.mail-archive.com/mpir-devel@googlegroups.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



Include problems....

2002-02-06 Thread Ben


I am having major problems with include files in cygwin.  Firstly, I cant
include files which are linked (.lnk files (symlinks?).  This works fine
on bash under redhat.  This isnt my main problem though...!

The main problem is that I can tget the -I flag to work correctly under
cygwin.  Take a look at this:

Cygwin:-

bash-2.05a$ gcc asd.cpp -I/tmp -v

#include ... search starts here:
#include ... search starts here:
 c:\program
files\devcpp\bin\..\lib\gcc-lib\i386-mingw32msvc\2.95.2\..\..\..\..\include
End of search list.



Linux:-
bash-2.05a$ gcc asd.cpp -I/tmp -v

#include ... search starts here:
#include ... search starts here:
 /tmp
 /usr/local/gcc-3.0/include/g++-v3
 /usr/local/gcc-3.0/include/g++-v3/i686-pc-linux-gnu
 /usr/local/gcc-3.0/include/g++-v3/backward
 /usr/local/include
 /usr/local/gcc-3.0/lib/gcc-lib/i686-pc-linux-gnu/3.0/include
 /usr/include
End of search list.


The linux one is adding /tmp to the list of directories to be searched.
Why isnt cygwin?  The redhat gcc is version 3, whereas the one on my
machine is 2.9 something, but I dont think its that...!

Hopefully someone can help with this?!

Thanks in advance,
Ben


-- 
Ben
[EMAIL PROTECTED]



--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html
Documentation: http://cygwin.com/docs.html
FAQ:   http://cygwin.com/faq/