This is the mail archive of the glibc-linux@ricardo.ecn.wfu.edu mailing list for the glibc project.


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

Re: Problems with stat() and lstat() in glibc 2.2


>>>>> 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

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