[OFFTOPIC?] Compiled glibc2, now ld =?ISO-8859-1?Q?doesn=B4t?= find stat and friends !

Rainer Keller (Rainer.Keller@studbox.uni-stuttgart.de)
Fri, 18 Dec 1998 12:52:11 +0100


Hello !
Sorry, if this is offtopic, but I donīt know anymore *where* to ask, I
canīt find anything about this anywhere...

I wanted to upgrade from libc5 to glibc2, by hand. So I got the newest
egcs 1.1.1 and binutils 2.9.1.19a -- then compiled and installed them.
Then, I got me a copy of glic-2.0.6 (+threads, crypt and...) !
Well, I did everything, the GLIBC-Howto told me to (save the old libc
and binarys and then tell ldd about it (/etc/ld.so.conf)).
Then I recompiled all the binaries necessary to compile with the NEW
glibc2.

Now: OLD programs, based on libc5 do run.
But I canīt compile new programs, such as the below, cause ld will gripe
about:
rainer@James:~/C > gcc -o test_stat test_stat.o
test_stat.o: In function `main':
test_stat.o(.text+0x6b): undefined reference to `stat'
collect2: ld returned 1 exit status

Only when I add -static, the program will build fine (of course, this is
not diserable)...
BTW, this is not the only call "missing" !

Now, it seems, that stat is missing in /lib/libc-2.0.6.so: nm does not
show anything like that, only
00072280 T __syscall_fstat
000722d0 T __syscall_lstat
000723c0 T __syscall_stat
00072110 T __syscall_ustat

Is that, what the linker should be looking for ???

What do I have to do to make ld shut up about it ?!

Thanx a lot for Your time,
Greetings, Rainer

OK, here is the program, which I tested with:
#include <stdio.h>
#include <stdlib.h>

#include <sys/stat.h>

#define PROG_NAME_SIZE 256
static char prog_name[PROG_NAME_SIZE];

#define IF_PRINTF_TYPE(type,mode,char) \
if (S_IS##type (mode)) { printf ("%s", char); }

void usage ()
{
printf ("Usage: %s FILE\n", prog_name);
printf (" Prints stat of FILE.\n");
exit (0);
}

int main (int argc, char * argv[])
{
struct stat buf;

strncpy (prog_name, argv[0], PROG_NAME_SIZE);

if (argc < 2)
usage();

stat (argv[1], &buf);

IF_PRINTF_TYPE (DIR, buf.st_mode, "d")
else
IF_PRINTF_TYPE (CHR, buf.st_mode, "c")
else
IF_PRINTF_TYPE (REG, buf.st_mode, "-")
}

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/