Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

include autoconf.h in gss-server.c #884

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

lhoward
Copy link
Contributor

@lhoward lhoward commented Dec 26, 2018

gss-server.c fails to build on macOS 10.14 without including autoconf.h, as it's missing a definition for close() (aliased from closesocket()), which is defined in unistd.h. HAVE_UNISTD_H requires autoconf.h.

gss-server.c fails to build on macOS 10.14 without including autoconf.h, as
it's missing a definition for close() (aliased from closesocket()), which is
defined in unistd.h. HAVE_UNISTD_H requires autoconf.h.
@greghudson
Copy link
Member

I think gss-server.c is trying not to use too many project include files since it's sample code. An alternative would be to conditionalize <unistd.h> on not-Windows (there's a Windows if block just above) instead of HAVE_UNISTD_H, and de-conditionalize <string.h> because it's no longer the 1980s.

@greghudson
Copy link
Member

But also, port-sockets.h includes autoconf.h for Unix-like platforms, so I'm confused about what's causing the build error.

@lhoward
Copy link
Contributor Author

lhoward commented Dec 26, 2018

close() needs unistd.h on macOS. Perhaps better to include (with appropriate guard) that in port-sockets.h.

@greghudson
Copy link
Member

I get that, but (unmodiifed) gss-server.c includes port-sockets.h at line 52, and port-sockets.h includes autoconf.h at line 156. So HAVE_UNISTD_H should be visible to gss-server.c at line 54.

@lhoward
Copy link
Contributor Author

lhoward commented Dec 27, 2018

Hmm, yes. Not sure then.

@lhoward
Copy link
Contributor Author

lhoward commented Dec 27, 2018

gcc -DHAVE_CONFIG_H -DUSE_AUTOCONF_H -DGSSAPI_V2 -I../../include -I../../include  -DKRB5_DEPRECATED=1 -DKRB5_PRIVATE  -g -fno-common -Werror=unknown-warning-option -Wall -Wcast-align -Wshadow -Wmissing-prototypes -Wno-format-zero-length -Woverflow -Wstrict-overflow -Wmissing-format-attribute -Wmissing-prototypes -Wreturn-type -Wmissing-braces -Wparentheses -Wswitch -Wunused-function -Wunused-label -Wunused-variable -Wunused-value -Wunknown-pragmas -Wsign-compare -Wnewline-eof -Werror=uninitialized -Werror=pointer-arith -Werror=int-conversion -Werror=incompatible-pointer-types -Werror=implicit-int -Werror=declaration-after-statement -Werror-implicit-function-declaration -pthread  -c gss-server.c
gss-server.c:332:16: error: implicit declaration of function 'close' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
        (void) closesocket(s);
               ^
./port-sockets.h:191:25: note: expanded from macro 'closesocket'
#define closesocket     close
                        ^
gss-server.c:337:16: error: implicit declaration of function 'close' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
        (void) closesocket(s);
               ^
./port-sockets.h:191:25: note: expanded from macro 'closesocket'
#define closesocket     close
                        ^
gss-server.c:650:5: error: implicit declaration of function 'close' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
    closesocket(work->s);
    ^
./port-sockets.h:191:25: note: expanded from macro 'closesocket'
#define closesocket     close
                        ^
gss-server.c:760:9: error: implicit declaration of function 'close' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
        close(1);
        ^
gss-server.c:814:13: error: implicit declaration of function 'close' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
            closesocket(stmp);
            ^
./port-sockets.h:191:25: note: expanded from macro 'closesocket'
#define closesocket     close
                        ^
5 errors generated.

@frozencemetery
Copy link
Contributor

Can you maybe show cc -E output?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants