Subject: Re: trouble compiling gcc3 on IRIX64 6.5.20m
To: Ryan Cresawn <cresawn@chass.utoronto.ca>
From: Michal Pasternak <michal@pasternak.w.lub.pl>
List: tech-pkg
Date: 11/25/2003 17:37:21
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 config.h.in). 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 :: http://pasternak.w.lub.pl