This is the mail archive of the
glibc-linux@ricardo.ecn.wfu.edu
mailing list for the glibc project.
Re: Problems with stat() and lstat() in glibc 2.2
- To: Count0 <count0 at linuxfreak dot com>
- Subject: Re: Problems with stat() and lstat() in glibc 2.2
- From: Andreas Jaeger <aj at suse dot de>
- Date: 28 Nov 2000 07:34:20 +0100
- Cc: glibc-linux at ricardo dot ecn dot wfu dot edu
- References: <200011280021.eAS0LWL00647@panther.unisys.com.br>
- Reply-To: glibc-linux at ricardo dot ecn dot wfu dot edu
>>>>> Count0 writes:
Please read the FAQ, the problem is mentioned there - it's a broken
setup on your side.
Andreas
> Hi there.
> I've been experiencing some problems when trying to compile code that uses
> stat() and/or lstat().
> When I try to compile the following program:
> #include <sys/stat.h>
> #include <unistd.h>
> int main()
> {
> struct stat *buf;
> return stat("blah", buf); /* Could be lstat()... */
> }
> I get this error :
> gcc test.c -o test
> /tmp/cc04OuUD.o: In function `main':
> /tmp/cc04OuUD.o(.text+0x13): undefined reference to `stat'
> collect2: ld returned 1 exit status
> I checked <sys/stat.h>, and found out that stat(), lstat(), etc are inline
> wrappers to the internal functions __xstat(), __lxstat(), etc. So I passed
> '-O' to the compiler and it compiled fine, because it didn't ignore the
> inlines.
> But it's also said in sys/stat.h that "It is arranged that when not inlined
> these function[the wrappers] are always statically linked" (line 289).
> Anybody know why isn't it working then ? Is this a bug ?
> This is breaking a lot of major builds, such as gcc, and I don't know if I've
> done anything wrong.
> I'm using glibc 2.2 and gcc 2.95.2.
> Please help !
--
Andreas Jaeger
SuSE Labs aj@suse.de
private aj@arthur.inka.de
http://www.suse.de/~aj