[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gpsd-dev] Problem compiling gpsd without ipv6 support
From: |
Mick Durkin |
Subject: |
[gpsd-dev] Problem compiling gpsd without ipv6 support |
Date: |
Mon, 7 Oct 2013 18:45:28 +0100 (BST) |
Hi All,
I recently tried to compile gpsd with ipv6 support disabled. I changed the
line:-
("ipv6", True, "build IPv6 support"),
to
("ipv6", False, "build IPv6 support"),
in the file SConstruct.
The compile failed with this error:-
gcc -o gpsd.o -c -D_GNU_SOURCE -O2 -pthread -I/usr/include/libusb-1.0 gpsd.c
gpsd.c: In function 'passivesock_af':
gpsd.c:402:5: error: 'sockaddr_t' has no member named 'sa_in6'
scons: *** [gpsd.o] Error 1
scons: building terminated because of errors.
When I examined gpsd.c, I noticed that one #if statement seemed to be
mis-ordered. This was not immediately obvious, as the corresponding #endif did
not carry one of the helpful cross-reference labels that seem to be in general
use throughout the code.
I re-arranged the #ifs so it now compiles cleanly and also I added a
cross-reference
label. I offer my solution below for your consideration.
BR
Mick
===========================================
diff --git a/gpsd.c b/gpsd.c
index c79d84a..34e41e9 100644
--- a/gpsd.c
+++ b/gpsd.c
@@ -385,8 +385,8 @@ static socket_t passivesock_af(int af, char *service, char
*tcp_or_udp, int qlen
/* see PF_INET6 case below */
s = socket(PF_INET, type, proto);
break;
-#ifndef S_SPLINT_S
#ifdef IPV6_ENABLE
+#ifndef S_SPLINT_S
case AF_INET6:
sin_len = sizeof(sat.sa_in6);
@@ -428,7 +428,7 @@ static socket_t passivesock_af(int af, char *service, char
*tcp_or_udp, int qlen
}
}
break;
-#endif
+#endif /* IPV6_ENABLE */
default:
gpsd_report(context.debug, LOG_ERROR,
"unhandled address family %d\n", af);
- [gpsd-dev] Problem compiling gpsd without ipv6 support,
Mick Durkin <=