[krbdev.mit.edu #3025] kerberos compilation fails on AIX 5.1 system with setenv apis prototype difference

sharma via RT rt-comment at krbdev.mit.edu
Fri Apr 22 16:10:08 EDT 2005


Hi

I wrote about this problem earlier where kerberos compilation fails on AIX
5.1 [oslevel 5100-07].

My observations about this problem on AIX system are as:

1. HAVE_SETENV=1 and NEED_SETENV=1 both flags are defined for compilation.
The part of config.log file where setenv HAVE_SETENV definition checked ok
and NEED_SETENV failed. Here in the config.log code it is clearly visible
that the configure generate code is not right where setenv apis is passed
only one argument instead of required three arguments. The code compilation
fails and NEDD_SETENV = 1 definition was generated. 

...

configure:4949: checking for setenv
configure:5011: result: yes

...

configure:5238: checking for memory.h
configure:5243: result: yes
configure:5360: checking if setenv needs a prototype provided
configure:5387: gcc  -c  -D_THREAD_SAFE   conftest.c >&5
configure: In function `main':
configure:5377: error: conflicting types for `setenv'
/usr/local/lib/gcc-lib/powerpc-ibm-aix5.1.0.0/3.3.4/include/stdlib.h:480:
error: previous declaration of `setenv'
configure:5377: warning: extern declaration of `setenv' doesn't match global
one
configure:5390: $? = 1
configure: failed program was:
#line 5365 "configure"
#include "confdefs.h"
#include <stdlib.h>
#ifdef F77_DUMMY_MAIN
#  ifdef __cplusplus
     extern "C"
#  endif
   int F77_DUMMY_MAIN() { return 1; }
#endif
int
main ()
{
struct k5foo {int foo; } xx;
extern int setenv (struct k5foo*);
setenv(&xx);

  ;
  return 0;
}
configure:5406: result: no
configure:5417: checking for an ANSI C-conforming const
configure:5506: result: yes

2. I also verified that on the following platforms Red Hat Linux, Darvin
10.3 MAX OSX and AIX, the setenv prototype is as:

int setenv(const char *name, const char *value, int overwrite);

On the following platforms HP-UX 11.11i, IRIX 6.5, Soalris 8 the NEED_SETENV
1 was defined. There is setenv apis available on these platforms. 

It may be a good idea to have proper prototype for setenv apis with const
keyword in kerberos source code, to avoid this compilation error on AIX
system.

Existing: extern int setenv(char *, char *, int);

Should be: extern int setenv(const char *, const char *, int);

3. There is a different between setenv api's prototype definition in these
two files

libtelnet/forward.c : line no 39
	extern int setenv(char *, char *, int);

/usr/local/lib/gcc-lib/powerpc-ibm-aix5.1.0.0/3.3.4/include/stdlib.h:line no
480
	extern int  setenv(const char *, const char *, int);

The AIX compiler does not like this difference. 


gmake[3]: Entering directory
`/home/srbpkg/srbpkg/kerberos/32/krb5-1.4/src/appl/telnet'
making all in appl/telnet/libtelnet...
gmake[4]: Entering directory
`/home/srbpkg/srbpkg/kerberos/32/krb5-1.4/src/appl/telnet/libtelnet'
gcc  -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\"
-DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DKRB5_KRB4_COMPAT=1
-DHAVE_BT_RSEQ=1 -DKRB5_PRIVATE=1 -DKRB5_DEPRECATED=1
-DKRB5_DNS_LOOKUP_KDC=1 -DKRB5_DNS_LOOKUP=1 -DHAVE_RES_NSEARCH=1
-DHAVE_RES_SEARCH=1 -DHAVE_NS_INITPARSE=1 -DHAVE_NS_NAME_UNCOMPRESS=1
-DHAVE_DN_SKIPNAME=1 -DDELAY_INITIALIZER=1 -DCONSTRUCTOR_ATTR_WORKS=1
-DDESTRUCTOR_ATTR_WORKS=1 -DUSE_LINKER_FINI_OPTION=1 -DENABLE_THREADS=1
-DHAVE_PTHREAD=1 -DHAVE_PTHREAD_ONCE=1 -DHAVE_PTHREAD_RWLOCK_INIT=1
-DHAVE_PTHREAD_RWLOCK_INIT_IN_THREAD_LIB=1 -DHAVE_STRCASECMP=1
-DHAVE_STRDUP=1 -DHAVE_SETSID=1 -DHAVE_STRERROR=1 -DHAVE_STRFTIME=1
-DHAVE_GETOPT=1 -DHAVE_HERROR=1 -DHAVE_SETENV=1 -DHAVE_GETENV=1
-DHAVE_VSNPRINTF=1 -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1
-DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1
-DHAVE_INTTYPES_H=1 -DHAVE_UNISTD_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1
-DHAVE_UNISTD_H=1 -DHAVE_ARPA_NAMESER_H=1 -DHAVE_SYS_SELECT_H=1
-DHAVE_ARPA_INET_H=1 -DHAVE_CURSES_H=1 -DHAVE_UTMP_H=1 -DHAVE_SYS_TIME_H=1
-DHAVE_SYS_STREAM_H=1 -DHAVE_SYS_UTSNAME_H=1 -DHAVE_MEMORY_H=1
-DNEED_SETENV=1 -DKRB4=1 -DHAVE_UNISTD_H=1 -DHAVE_FORK=1 -DHAVE_VFORK=1
-DHAVE_WORKING_VFORK=1 -DHAVE_WORKING_FORK=1 -DHAVE_STDARG_H=1
-DHAVE_TERM_H=1 -DHAVE_SA_LEN=1 -DHAVE_STRUCT_SOCKADDR_STORAGE=1
-DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_SOCKET_H=1 -DHAVE_NETINET_IN_H=1
-DHAVE_NETDB_H=1 -DHAVE_INET_NTOP=1 -DHAVE_INET_PTON=1 -DHAVE_GETNAMEINFO=1
-DHAVE_GETADDRINFO=1 -DKRB5_USE_INET6=1 -DHAVE_SETUPTERM=1 -DUSE_TERMIO=1
-DNEED_PARSETOS_PROTO=1 -DNEED_HERROR_PROTO=1 -DPOSIX_SIGNALS=1 -DKRB4=1
-DHAVE_REGCOMP=1 -DTIME_WITH_SYS_TIME=1 -DSTREAMSPTY=1
-DNEED_UNSETENV_PROTO=1  -DAUTHENTICATION -DENCRYPTION -DDES_ENCRYPTION
-DKRB5 -DFORWARD -UNO_LOGIN_F -DLOGIN_CAP_F -DLOGIN_PROGRAM=KRB5_PATH_LOGIN
-I../../../include -I./../../../include -I../../../include/krb5
-I./../../../include/krb5 -I.. -I./.. -I./../../../include/kerberosIV
-I../../../include/kerberosIV  -D_THREAD_SAFE   -c forward.c
forward.c:39: error: conflicting types for `setenv'
/usr/local/lib/gcc-lib/powerpc-ibm-aix5.1.0.0/3.3.4/include/stdlib.h:480:
error: previous declaration of `setenv'
gmake[4]: *** [forward.o] Error 1
gmake[4]: Leaving directory
`/home/srbpkg/srbpkg/kerberos/32/krb5-1.4/src/appl/telnet/libtelnet'
gmake[3]: *** [all-recurse] Error 1
gmake[3]: Leaving directory
`/home/srbpkg/srbpkg/kerberos/32/krb5-1.4/src/appl/telnet'
gmake[2]: *** [all-recurse] Error 1
gmake[2]: Leaving directory
`/home/srbpkg/srbpkg/kerberos/32/krb5-1.4/src/appl'
gmake[1]: *** [all-recurse] Error 1
gmake[1]: Leaving directory `/home/srbpkg/srbpkg/kerberos/32/krb5-1.4/src'
gmake: *** [krb32] Error 2
bash-2.04$

Thanks

SAM SHARMA





More information about the krb5-bugs mailing list