This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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: [MinGW] Set NATIVE_SYSTEM_HEADER_DIR relative to configured prefix


On Wed, Dec 20, 2006 at 08:01:01PM +1300, Danny Smith wrote:
>  'Bob Rossi'
>  20 December 2006 4:07 a.m.
> 
> > Please read this entire email, I think it describes very well 
> > the state
> > of gcc-4.1.1 on mingw. Also, while reading, if you know about how
> > --sysroot would effect any of this, please let me know.
> > 
> > Here we go. I'm using gcc-4.1.1 again, as a starting point. I've
> > configured and built,
> > 
> >   ../gcc-4.1.1/configure  --disable-werror  --host=mingw32  
> > --target=mingw32 \
> >   --prefix=/mingw  --program-suffix="-4.1"  --with-gcc  
> > --with-gnu-ld \
> >   --with-gnu-as  --enable-threads=win32  --disable-nls  
> > --enable-languages=c,c++ \
> >   --disable-win32-registry --disable-shared  --enable-static  
> > --without-x \
> >   --enable-libstdcxx-debug  2>&1 | tee configure-out.txt
> > 
> >   make  CFLAGS="-O2 -fomit-frame-pointer" \
> >   CXXFLAGS="-mthreads -fno-omit-frame-pointer -O2"  LDFLAGS=-s  \
> >   bootstrap 2>&1 | tee make-out.txt
> > 
> > Then I do 'make DESTDIR=/home/bobbybrasko/gcc/gcc-4.1.1/destdir
> > install'. They try,
> >   $ 
> > PATH=/home/bobbybrasko/gcc/gcc-4.1.1/destdir/mingw/bin:$PATH 
> > gcc-4.1 -o main main.c                   
> > works fine. but,
> >   $ 
> > PATH=/home/bobbybrasko/gcc/gcc-4.1.1/destdir/mingw/bin:$PATH 
> > g++-4.1 -o main main.cpp                 
> >   main.cpp:1:20: error: iostream: No such file or directory   
> >                                             
> >   main.cpp: In function 'int main(int, char**)':              
> >                                             
> >   main.cpp:8: error: 'cout' was not declared in this scope    
> >                                             
> >   main.cpp:8: error: 'endl' was not declared in this scope    
> >                                             
> > 
> > fails. I already have the w32api, mingw-runtime and binutils 
> > installed in my 
> > C:/mingw. However, I haven't installed any of that into the DESTDIR.
> > Should I?  From my understanding, this alone is a problem. Can someone
> > please tell me if this is a bug in my configure or in gcc?
> > 
> > Now, if I install w32api, mingw-runtime and binutils into the DESTDIR,
> > that also doesn't help the problem. Didn't think it would, but just
> > trying to be thorough. Can someone please tell me that this shouldn't
> > help? I assume it shouldn't because I'm still on the machine that has
> > this stuff installed in C:\mingw already.
> > 
> > Now, here is the interesting part. Remember that I untared the w32api,
> > mingw-runtime and bintutils into the DESTDIR. So now, I cd to the
> > DESTDIR and do 'tar -cvf mingw.tar mingw'. I copy that to a 
> > machine that
> > has none of these things installed. I untar in C:\mingw. I 
> > then run from 
> > a dos shell this,
> >   set PATH=C:\mingw\bin;C:\windows\system32
> >   gcc-4.1 -o main main.c
> >   g++-4.1 -o main main.cpp
> > and they both run successfully. I didn't have to install w32-api,
> > mingw-runtime or binutils, because they were already in the tar ball.
> 
> 
> You may be running into this:
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17621
> ehich is ficxed on mainline.

When you say mainline, do you mean svn trunk? svn trunk currently
doesn't work at all for mingw. I'm working with carlos to test a patch
that he's made to fix things. A discussion of this problem is here,
  http://gcc.gnu.org/ml/gcc-help/2006-12/msg00281.html

Now, once I try his patch, things are WORSE in svn trunk than 4.1.1. I
can't get gcc to create a C or C++ executable on machine if I install
gcc in C:\mingw or C:\foo\mingw. It just doesn't work. So something else
has broke since 4.1.1, unless I'm completly crazy.

> What is in 'configured path', ie /mingw?

On the machine I compiled gcc on, in /mingw is what you get when you
install the mingw package from sf.
  http://sourceforge.net/project/showfiles.php?group_id=2435&package_id=82721&release_id=158801

Here is how I got the /mingw on the mchine I copied gcc to.
Start from the machine I compiled gcc, do 
'make DESTDIR=/home/bobbybrasko/gcc/foo install', and then untar binutils, 
mingw-runtime and w32api into /home/bobbybrasko/gcc/foo/mingw. Now, tar up the
/home/bobbybrasko/gcc/foo/mingw directory, move it to another machine,
and untar it.

> What happens if you rename the /mingw dir to /mingw-old?

I'm assumming you want me to do this on the machine that I compiled gcc
on. Since I've described both cases of how it works on the remote
machine with /mingw there and not there. If I do this, then 
  bobbybrasko@MOMS ~/gcc/gcc-test                                                                         
  $ PATH=/home/bobbybrasko/gcc/gcc-4.1.1/destdir/mingw/bin:$PATH g++-4.1 -o main main.cpp                 
  main.cpp:1:20: error: iostream: No such file or directory                                               
  main.cpp: In function 'int main(int, char**)':                                                          
  main.cpp:8: error: 'cout' was not declared in this scope                                                
  main.cpp:8: error: 'endl' was not declared in this scope                                                
  bobbybrasko@MOMS ~/gcc/gcc-test                                                                         
  $ PATH=/home/bobbybrasko/gcc/gcc-4.1.1/destdir/mingw/bin:$PATH gcc-4.1 -o main main.c                   
  main.c:1:19: error: stdio.h: No such file or directory                                                  
  main.c: In function 'main':                                                                             
  main.c:6: warning: incompatible implicit declaration of built-in function 'printf'                      

Now neither case works. So, it's went from bad to worse. What does this
tell you?

The same thing happens when I try svn-trunk with carlos's patch,

  bobbybrasko@MOMS ~/gcc/gcc-test                                                                         
  $ PATH=/home/bobbybrasko/gcc/svn-trunk-orig/destdir/mingw/bin:$PATH gcc-4.1 -o main main.c              
  main.c:1:19: error: stdio.h: No such file or directory                                                  
  main.c: In function 'main':                                                                             
  main.c:6: warning: incompatible implicit declaration of built-in function 'printf'                      
  bobbybrasko@MOMS ~/gcc/gcc-test                                                                         
  $ PATH=/home/bobbybrasko/gcc/svn-trunk-orig/destdir/mingw/bin:$PATH g++-4.1 -o main main.cpp            
  main.cpp:1:20: error: iostream: No such file or directory                                               
  main.cpp: In function 'int main(int, char**)':                                                          
  main.cpp:8: error: 'cout' was not declared in this scope                                                
  main.cpp:8: error: 'endl' was not declared in this scope                                                

However, you've opened up new oppurtunities for me. I didn't realize I
could move /mingw. Now I can do a 'make install' instead of a 'make
DESTDIR=... install' and try that too. That'll help me test yet another
case. Hmmm, and when I do that I get,

  if [ x != x ] ; then \                                                                                  
    /bin/install -c /bin/sh ../../gcc-4.1.1/gcc/../mkinstalldirs \                                        
	  /mingw/libexec/gcc/mingw32/4.1.1/install-tools/mkinstalldirs ; \                                
    /bin/install -c ../../gcc-4.1.1/gcc/fixproto /mingw/libexec/gcc/mingw32/4.1.1/install-tools/fixproto ;
   \                                                                                                      
    /bin/install -c build/fix-header.exe \                                                                
	  /mingw/libexec/gcc/mingw32/4.1.1/install-tools/fix-header.exe ; \                               
  else :; fi                                                                                              
  echo 'SYSTEM_HEADER_DIR="'"/mingw/include"'"' \                                                         
	  > /mingw/lib/gcc/mingw32/4.1.1/install-tools/mkheaders.conf                                     
  echo 'OTHER_FIXINCLUDES_DIRS=""' \                                                                      
	  >> /mingw/lib/gcc/mingw32/4.1.1/install-tools/mkheaders.conf                                    
  echo 'FIXPROTO_DEFINES=""' \                                                                            
	  >> /mingw/lib/gcc/mingw32/4.1.1/install-tools/mkheaders.conf                                    
  echo 'STMP_FIXPROTO=""' \                                                                               
	  >> /mingw/lib/gcc/mingw32/4.1.1/install-tools/mkheaders.conf                                    
  echo 'STMP_FIXINC="stmp-fixinc"' \                                                                      
	  >> /mingw/lib/gcc/mingw32/4.1.1/install-tools/mkheaders.conf                                    
  make[2]: *** No rule to make target `/mingw/bin/as', needed by `stamp-as'.  Stop.                       
  make[2]: Leaving directory `/home/bobbybrasko/gcc/gcc-4.1.1/gcc-builddir/gcc'                           
  make[1]: *** [install-gcc] Error 2                                                                      
  make[1]: Leaving directory `/home/bobbybrasko/gcc/gcc-4.1.1/gcc-builddir'                               
  make: *** [install] Error 2                                                                             

That's very odd to me, is that expected do you think?

Thanks,
Bob Rossi


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