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: glibc-linux at ricardo dot ecn dot wfu dot edu
- Subject: Re: Problems with stat() and lstat() in glibc 2.2
- From: Yang Jingsong <yjs at mail dot topresult dot com>
- Date: Tue, 28 Nov 2000 18:10:53 +0800
- Organization: SEL SYSTEM LTD.
- References: Failed to connect to host (smtp2.unisys.com.br): Connection refused <200011280021.eAS0LWL00647@panther.unisys.com.br>
- Reply-To: glibc-linux at ricardo dot ecn dot wfu dot edu
Count0 wrote:
> 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 !
I'm using libc 2.1.92 and gcc 2.6, has no this problem.