Mail Archives: cygwin/2002/11/25/19:35:51
On Mon, 25 Nov 2002, Andrew DeFaria wrote:
> Peter A. Castro wrote:
> > On Sun, 24 Nov 2002, Andrew DeFaria wrote:
> >> Peter A. Castro wrote:
> >>
> >>> What you show below is only linking. I believe you need to
> >>> re-compile all of your source with -mno-cygwin -mwindows as well to
> >>> make the _impure_ptr references go away.
> >>
> >> But I did re-compile all my sources with -mno-cygwin -mwindows! Still
> >> have the error.
> >
> > Suggest you run nm against all your objects and libraries and find which
> > has the _impure_ptr references, then recompile just those.
>
> But I did recompile everything already! The _impure_ptr keeps getting
> generated:
>
> $ nm mksf.o | grep impure
> U __impure_ptr
> $ rm mksf.o
> $ make mksf.o
> /bin/gcc -c -g -mno-cygwin -mwindows -I. -I../../include -I/usr/include
> -DCYGWIN mksf.c
> $ nm mksf.o | grep impure
> U __impure_ptr
> $
You're getting stdio.h from /usr/include, that's why.
> As you can see the _impure_ptr reference gets regenerated. But wait!
> There's more!
>
> I can cause these _impure_ptr even with the little foo.c merely by
> including -I/usr/include on the command line. Why am I referencing
> /usr/include? Because in my larger application I need it for getopt.h.
> The mere inclusion of -I/usr/include causes_impure_ptr's to be emitted.
> So the question now is: How do I satisfy my need for getopt and still
> produce objects without _impure_ptr's?
libiberty.a in /usr/lib/mingw has getopt(), so link with -liberty
> Ah ha!
>
> $ grep impure /usr/include/*.h
> /usr/include/stdio.h:#define stdin (_impure_ptr->_stdin)
> /usr/include/stdio.h:#define stdout (_impure_ptr->_stdout)
> /usr/include/stdio.h:#define stderr (_impure_ptr->_stderr)
>
> Hmmm... Changed options to:
>
> /bin/gcc -c -g -mno-cygwin -I. -I../../include -I/usr/include/mingw
> -I/usr/include -DCYGWIN mksf.c
> cc1: warning: changing search order for system directory
> "/usr/include/mingw"
> cc1: warning: as it has already been specified as a non-system directory
>
> This works but why am I getting this warning?
Because -mno-cygwin specifies /usr/include/mingw as a system dir and
you're specifying it again on the command line with -I, which makes it a
User dir too. gcc is a bit puzzled about why you're doing that.
If you add the "-v" flag to you compile flags, gcc will dump the list of
directories it searches for include files. In this case it would be:
../../include
/usr/include/mingw
/usr/include
/usr/lib/gcc-lib/i686-pc-cygwin/2.95.3-5/include
/usr/include/mingw
/usr/include/w32api
--
Peter A. Castro <doctor AT fruitbat DOT org> or <Peter DOT Castro AT oracle DOT com>
"Cats are just autistic Dogs" -- Dr. Tony Attwood
--
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/
- Raw text -