problems building samba4 with intel c compiler

Brad Hards bradh at frogmouth.net
Sat Aug 29 01:32:30 MDT 2009


Hi,

I think I've found a problem with AC_VERIFY_C_PROTOTYPE when using
the icc compiler.

I was trying to build samba4 with icc, and it died with this:
Compiling ../lib/nss_wrapper/nss_wrapper.c                                                                                    
(some mostly harmless warnings elided here)
../lib/nss_wrapper/nss_wrapper.c(1938): error #165: too few arguments in function call
                pw = real_getpwent_r(pwdst, buf, buflen);                             
                                                       ^                              

../lib/nss_wrapper/nss_wrapper.c(1938): warning #556: a value of type "int" cannot be assigned to an entity of type "struct passwd *"                                                                                                                       
                pw = real_getpwent_r(pwdst, buf, buflen);                                                                     
                   ^                                                                                                          


../lib/nss_wrapper/nss_wrapper.c(2123): error #165: too few arguments in function call
                gr = real_getgrent_r(grdst, buf, buflen);
                                                       ^

../lib/nss_wrapper/nss_wrapper.c(2123): warning #556: a value of type "int" cannot be assigned to an entity of type "struct group *"
                gr = real_getgrent_r(grdst, buf, buflen);
                   ^

compilation aborted for ../lib/nss_wrapper/nss_wrapper.c (code 2)
The following command failed:
icc -g -DDEBUG_PASSWORD -DDEVELOPER -Wall -Wshadow -Werror-implicit-function-declaration -Wstrict-prototypes -Wpointer-arith -
Wcast-qual -Wcast-align -Wwrite-strings -Wmissing-format-attribute -Wformat=2 -Wdeclaration-after-statement -Wunused-macros -Wno-
format-y2k -Wno-unused-parameter -fPIC -I./include -I. -I./lib -I./../lib/replace -I./../lib/talloc -I./.. -D_SAMBA_BUILD_=4 -DHAVE_CONFIG_H  -c 
../lib/nss_wrapper/nss_wrapper.c -o ../lib/nss_wrapper/nss_wrapper.o
make: *** [../lib/nss_wrapper/nss_wrapper.o] Error 1

It looks like the problem is caused by having SOLARIS_GETPWENT_R
set when it shouldn't be. That looks to be coming from libreplace.

In lib/replace autoconf run, I see this

checking for getpwent_r declaration... yes                                                                                
checking for prototype struct passwd *getpwent_r(struct passwd *src, char *buf, int buflen)... yes                        
checking for prototype struct passwd *getpwent_r(struct passwd *src, char *buf, size_t buflen)... yes                     

and 

checking for getgrent_r declaration... yes                                                                                
checking for prototype struct group *getgrent_r(struct group *src, char *buf, int buflen)... yes                          
checking for prototype struct group *getgrent_r(struct group *src, char *buf, size_t buflen)... yes

config.log shows the problem:

  configure:17324: checking for prototype struct passwd *getpwent_r(struct passwd *src, char *buf, int buflen)
configure:17358: icc -c  -I.  conftest.c >&5
conftest.c(196): warning #147: declaration is incompatible with "int getpwent_r(struct passwd *restrict, char *restrict, size_t={unsigned 
int}, struct passwd **restrict)" (declared at line 140 of "/usr/include/pwd.h")
                struct passwd *getpwent_r(struct passwd *src, char *buf, int buflen)
                               ^

configure:17365: $? = 0
configure:17385: result: yes
configure:17398: checking for prototype struct passwd *getpwent_r(struct passwd *src, char *buf, size_t buflen)
configure:17432: icc -c  -I.  conftest.c >&5
conftest.c(197): warning #147: declaration is incompatible with "int getpwent_r(struct passwd *restrict, char *restrict, size_t={unsigned 
int}, struct passwd **restrict)" (declared at line 140 of "/usr/include/pwd.h")
                struct passwd *getpwent_r(struct passwd *src, char *buf, size_t buflen)
                               ^

configure:17439: $? = 0
configure:17459: result: yes

Unfortunately, this is where I come unstuck. The m4 for
AC_VERIFY_C_PROTOTYPE is in lib/replace/libreplace_macros.m4,
but it is unintelligible to me.

I guess we need to turn that warning into an error somehow,
perhaps with -Werror?

Brad



More information about the samba-technical mailing list