[Swan-dev] ace1aaf777 CentOS 6 addr_lookup.c:220: error: 'errno' undeclared

D. Hugh Redelmeier hugh at mimosa.com
Thu Jun 20 14:21:32 UTC 2019

| From: Antony Antony <antony at phenome.org>

| I am writing this e-mail really amused(too many broken commits in the name 
| of fixing) and annoyed when I wake up master is broken again! You are 
| warned!

Yes, I broke it.  Sorry about that.  It worked for me.  Thanks for fixing it!

The fundamental problem is headers including headers.  Apparently
CentOS 6 does not #include <event2/event.h> and thus doesn't get these
"for free":

	$ grep -h '#include' /usr/include/event2/{event,visibility,event-config,event-config-64,util}.h | sort -u
	#include <BaseTsd.h>
	#include <bits/wordsize.h>
	#include <errno.h>
	#include <event2/event-config-32.h>
	#include <event2/event-config-64.h>
	#include <event2/event-config.h>
	#include <event2/util.h>
	#include <event2/visibility.h>
	#include <inttypes.h>
	#include <netdb.h>
	#include <stdarg.h>
	#include <stddef.h>
	#include <stdint.h>
	#include <stdio.h>
	#include <sys/socket.h>
	#include <sys/time.h>
	#include <sys/types.h>
	#include <time.h>
	#include <winsock2.h>
	#include <ws2tcpip.h>

That's an embarrassingly large set.

| On Tue, Jun 18, 2019 at 04:04:52PM -0400, Andrew Cagney wrote:
| > why is a library function calling printf()? (if a c file needs
| > something #include it).

[If you are in effect replying to a message, it's good to use your
mailer's reply command so the messages get threaded properly.  Failing
that, you should probably make the Subject: evident.  In this case
	Subject: Re: [Swan-dev] CentOS 6 "implicit declaration of function ‘printf’"

| While these are good questions and good to explore, I can't seems to feel 
| these questions are deflecting immediate issues, that I feel more important
| in this thread.

The immediate issues had already been addressed in the thread.

I asked the same question as Andrew in mail to which Andrew was
replying.  Perhaps too obliquely to be noticed.

I'll raise it in a separate thread in the hope that it will get

| 1. why CentOS 6 catching these missing includes? why not the later 
| GCC/Distributions?


I mentioned this in previous mail.  Or perhaps the commit message.

| 2. The instance I pointed was changes to includes, which broke on some 
| distribution and when pointed out those are not fixed in due time. I call it 
| leaving master broken for for others while 'your greatest fix' is pushed.

Yes.  I did suggest how you could fix it (more than once, I think).  I
did not fix it because I could not test the result.

| I am a bit annoyed, because I feel I find Libreswan master broken too often
| and get distracted from it. May be that is why I am overreacting a bit:)
| I think it is everyone's interest to avoid these, contribute time to wider 
| basic testing.


This kind of error is fairly straight-forward to fix.  I'm sorry that
I caused the second one.  But fixing it certainly doesn't require days
of delay and long discussions.

What do I mean "this kind of error"?  Well, at least "undeclared"
messages referring to library functions where the man page spells out
what header supplies the declaration.

1. observe "undeclared" error message for symbol X
2. "man X" or perhaps "man 3 X" or perhaps "man -a X"
3. copy #include from synopsis.

| So I am continuing on this thread to remind us how a one line change you 
| find greatest may cost time for others when they wake up and want continue 
| what they were doing.
| Now after venting my feelings, lets look at the new issue.

Oh.  I was already talking about it (because of my guilt).

| ace1aaf777 broke on CentOS6
| on CentOS 6
| USE_DNSSEC=false USE_NSS_IPSEC_PROFILE=flase make base
| /home/build/libreswan/lib/libswan/addr_lookup.c: In function ‘netlink_query’:
| /home/build/libreswan/lib/libswan/addr_lookup.c:220: error: ‘errno’ undeclared (first use in this function)
| /home/build/libreswan/lib/libswan/addr_lookup.c:220: error: (Each undeclared identifier is reported only once
| /home/build/libreswan/lib/libswan/addr_lookup.c:220: error: for each 
| function it appears in.)
| One could say fix one line and move on:) I guess that is what I going to do 
| right after the e-mail.


More information about the Swan-dev mailing list