Subject: Re: trouble compiling gcc3 on IRIX64 6.5.20m
To: Michal Pasternak <>
From: Ryan Cresawn <>
List: tech-pkg
Date: 11/25/2003 16:43:44

Here's what I've discovered.

  # find . -name config.h 

Only the first three files are unique.  The fourth is identical to the
third.  Next I ran 'grep' to gather the following information.

  # pwd
  # grep HAVE_STDLIB_H work/gcc-3.3/gcc/config.h
  # grep HAVE_STDLIB_H work/gcc-3.3/libiberty/config.h
  #define HAVE_STDLIB_H 1
  # grep HAVE_STDLIB_H work/gcc-3.3/mips-sgi-irix6.5/libiberty/config.h
  /* #undef HAVE_STDLIB_H */

Here are two lines from the 'config.h' with the '#define' statement.

  /* Define if you have the <stdlib.h> header file.  */
  #define HAVE_STDLIB_H 1

I also found a total of four 'config.log' files.  I will e-mail you a
file named 'config.logs.tar.gz' which contains all four files.  It is
18.8 kb.  This is where the four files are located.

  # find . -name config.log

Do you think that there's a chance that with 'gcc3' from 'pkgsrc'
installed and working that the building of other packages would be
simplified?  It makes me wonder if perhaps the SGI Freeware
maintainer(s) use 'pkgsrc' to update their software tree.


On Tue, Nov 25, 2003 at 05:37:21PM +0100, Michal Pasternak wrote:
> Ryan Cresawn [Tue, Nov 25, 2003 at 11:10:31AM -0500]:
> > I have attached the file 'getpwd.c' and the output from the command
> > you asked me to run is below.  What do you mean when you mention
> > 'priv'?
> By "priv" I mean 
> 	"my private e-mail account, so you won't spam the list and
> 	 the list archive with unneeded attachments"
> :)	 
> Anyway, here we go... the generic-guide-of-dealing-with-configure, part 1.
> Those are error messages you got:
> >   getpwd.c:74: error: storage size of dotstat' isn't known
> >   getpwd.c:74: error: storage size of pwdstat' isn't known
> >   getpwd.c:78: warning: implicit declaration of function getenv'
> >   getpwd.c:78: warning: assignment makes pointer from integer without a cast
> >   getpwd.c:80: warning: implicit declaration of function stat'
> >   getpwd.c:86: warning: implicit declaration of function getcwd'
> >   getpwd.c:89: warning: implicit declaration of function free'
> >   getpwd.c:74: warning: unused variable dotstat'
> >   getpwd.c:74: warning: unused variable pwdstat'
> "implicit declaration" means, that C compiler haven't seen the function
> declaration before. It's a warning, because such function may be present in
> the libraries, that are linked later -- so it's not really an error.
> But, look at the names of declaration it mentions. stat(2), getcwd(3),
> free(3) - all of them are "standard C library functions". Definitions
> (located in include .h files) for those functions exists almost on every OS
> in the universe. Every C programmer knows/should know those files.
> But, in this case, they're not included. Why? Let's investigate. free(3) is
> declared in /usr/include/stdlib.h (and I'm perfectly sure, that on IRIX it
> is also declared there. Why? As you can read on free(3) manpage:
> 	The malloc(), calloc(), realloc() and free() functions conform to ANSI
>      	X3.159-1989 (`ANSI C'').
> But, stdlib.h is not being included. What the heck?
> >From getpwd.c:
> > #ifdef HAVE_STDLIB_H
> > #include <stdlib.h>
> > #endif
> See? stdlib.h is _not_ included, because HAVE_STDLIB_H is not defined.
> HAVE_* macros are defined by configure system - a smart shell script,
> generated via tools like automake/autoconf. Configure is meant to allow
> autoconfiguration of C sources, so such cases - as yours - won't occur. As
> you can see it's only a theory / it works good only on Linux operating
> systems.
> So, simply check "config.h" file, located somewhere near root directory of
> extracted sources (this file exists only after configure command has been
> run, before it you will find only Does it define HAVE_STDLIB_H
> ? I doubt so. Chances are, it includes a line #undef HAVE_STDLIB_H.
> Why?
> Because configure failed to run script, that tested for presence of stdlib.h.
> Where was this script defined/created/run ?
> In configure script. You can check config.log file (search for a phrase like
> "stdlib.h" in it) - you'll see the source of the test program, the command
> that was executed to build this file and the reason why it failed.
> There lies the answer to the problem.
> In short, send me config.log _on_ _priv_, and we'll go on with it.
> Was all, what I said, true?
> Depends. These are generic instructions on dealing with configure problems.
> GCC compiler build has 2 phases. First, it builds itself with a compiler,
> that's available -- in second phase it builds itself. I think, that if you
> have second-phase build problems on IRIX, you should contact rather someone
> from GNU Compiler Project (anyway, you could still use my hints with telling
> them, where the error is :). We can work on it while it's in pkgsrc, sure,
> why not -- the patches could be imported to the mainstream later.
> Anyway, gcc building is quite an issue sometimes.
> Take care,
> -- 
> Michal Pasternak ::