Mailing List Archive

undefined reference to fstat
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I've tried compiling gpg 0.9 under both egcc 2.91.60 and gcc 2.7.2.3 using
glibc 2.0.7 using Debian Linux (2.1/Slink), and keep getting this error:

../util/libutil.a(iobuf.o): In function `iobuf_get_filelength':
/tmp/gnupg-0.9.0/util/iobuf.c:1141: undefined reference to `fstat'
/tmp/gnupg-0.9.0/util/iobuf.c:1152: undefined reference to `fstat'

If I take out those lines, it compiles, however, I don't know why it can't
find fstat - but then, neither can I on my machine in /usr/include and
/usr/local/include and /usr/src/linux/include....where should this file be?
Which header is supposed to have this call? I think I recall this command in
ANSI C somewhere, but can't find it in my books. Anyone know about this?

Chris Wiegand

'If Bill Gates had a dime for every time Windows crashed...
... Oh wait a minute, he already does...' - Anonymous

Linux \'lih-nucks\ n.: Antidote to the computer virus known as Windows.
BSD \be-es-de\ n.: Antidote to the computer virus known as Windows NT.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v0.4.4 (GNU/Linux)
Comment: For info finger gcrypt@ftp.guug.de

iEYEARECAAYFAjaGwqUACgkQZTKjYvXk4AahvwCgvERsJWsdWiF9fTgqPBKHL16X
k24AmgOW6np5WvIr8EcEmEIQfIje1j9P
=hK25
-----END PGP SIGNATURE-----
Re: undefined reference to fstat [ In reply to ]
Christopher Wiegand <cwiegand@dimensional.com> writes:

> If I take out those lines, it compiles, however, I don't know why it can't
> find fstat - but then, neither can I on my machine in /usr/include and
> /usr/local/include and /usr/src/linux/include....where should this file be?

man 2 fstat:

! NAME
! stat, fstat, lstat - get file status
!
! SYNOPSIS
! #include <sys/stat.h>
! #include <unistd.h>
!
! int stat(const char *file_name, struct stat *buf);
! int fstat(int filedes, struct stat *buf);
! int lstat(const char *file_name, struct stat *buf);

Your libc is broken ? every program needs fstat which is indeed a
kernel function.