[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
Problems when compiling -static
- From: Michal Jaegermann <michal ellpspace math ualberta ca>
- To: axp-list redhat com
- Subject: Problems when compiling -static
- Date: Tue, 27 Jun 2000 15:22:54 -0600 (MDT)
Before I will start to tear the whole system apart - does anybody
has a handle on that? I do not recall seeing something of that sort.
The following program (file, say, 'name.c'):
#include <stdio.h>
#include <stdlib.h>
#include <pwd.h>
#include <sys/types.h>
int
main (int argc, char *argv[])
{
struct passwd *pw;
uid_t uid = 0;
if (argc > 1) {
uid = atoi(argv[1]);
}
pw = getpwuid(uid);
printf("%p\n", pw);
if (pw) {
printf("%s\n", pw->pw_name);
}
return 0;
}
compiled on RH 6.2 on alpha with 'gcc -o name name.c' behaves like
expected. That means that it prints things of that sort:
$ ./name
0x2000034ff08
root
$ ./name 99
0x2000034ff08
nobody
But compiled with 'gcc -static -o name name.c' it will print
$ ./name
(nil)
$ ./name 99
(nil)
In other words getpwuid() always returns NULL if '-static' is present.
Changing optimization levels, versions of a compiler or a version of
binutils does not seem to have any effect; but when compiling on RH
6.1 distro everything looks ok. Still executables compiled 'static'
on RH 6.1, and running there correctly, will exhibit the same faulty
behaviour when copied to RH 6.2 installation (in other words, they are
not that static; bummer!).
I have reasons to suspect that libnss_... stuff is messed up here
but maybe only as a side effect? I will be grateful for any hits.
Oh, BTW, /etc/nsswitch.conf is sane on the system in question.
Michal
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
[]