[FFmpeg-devel] [fixed] FreeBSD 8.1, --disable-network due to in.h not included.

Martin Storsjö martin
Tue Sep 7 14:57:01 CEST 2010


On Tue, 7 Sep 2010, Ronald S. Bultje wrote:

> 2010/9/7 M?ns Rullg?rd <mans at mansr.com>:
> > Martin Storsj? <martin at martin.st> writes:
> >> On Tue, 7 Sep 2010, Igor 'Lo' (?.L.) wrote:
> >>> Had fixed this:
> >>> ?libavformat/udp.c:77: error: 'IPPROTO_IPV6' undeclared (first use in
> >>> this function)
> >>
> >> I think this issue can be fixed using the attached patch (by not compiling
> >> such code unless the IPPROTO_IPV6 define is visible).
> >>
> >> // Martin
> >>
> >> From 7ca45311458b096bdf256aef2b9518637274336e Mon Sep 17 00:00:00 2001
> >> From: Martin Storsjo <martin at martin.st>
> >> Date: Tue, 7 Sep 2010 13:56:22 +0300
> >> Subject: [PATCH] Check for the IPPROTO_IPV6 define before using it
> >>
> >> ---
> >> ?libavformat/udp.c | ? ?4 ++--
> >> ?1 files changed, 2 insertions(+), 2 deletions(-)
> >>
> >> diff --git a/libavformat/udp.c b/libavformat/udp.c
> >> index 3636d8c..83e8b37 100644
> >> --- a/libavformat/udp.c
> >> +++ b/libavformat/udp.c
> >> @@ -96,7 +96,7 @@ static int udp_join_multicast_group(int sockfd, struct sockaddr *addr)
> >> ? ? ? ? ?}
> >> ? ? ?}
> >> ?#endif
> >> -#if HAVE_STRUCT_IPV6_MREQ
> >> +#if HAVE_STRUCT_IPV6_MREQ && defined(IPPROTO_IPV6)
> >> ? ? ?if (addr->sa_family == AF_INET6) {
> >> ? ? ? ? ?struct ipv6_mreq mreq6;
> >>
> >> @@ -125,7 +125,7 @@ static int udp_leave_multicast_group(int sockfd, struct sockaddr *addr)
> >> ? ? ? ? ?}
> >> ? ? ?}
> >> ?#endif
> >> -#if HAVE_STRUCT_IPV6_MREQ
> >> +#if HAVE_STRUCT_IPV6_MREQ && defined(IPPROTO_IPV6)
> >> ? ? ?if (addr->sa_family == AF_INET6) {
> >> ? ? ? ? ?struct ipv6_mreq mreq6;
> >
> > I don't really like disabling something that is supported, just hidden
> > by retarded system headers.
> 
> +0.5, it'd be nice if we could somehow work around BSD brokenness
> without too much hackiness...

Yes, I agree that disabling stuff when it could be enabled isn't nice. The 
patch in itself still is quite correct, I think - if that define doesn't 
exist, we can't compile the code within the #if either. Then it's up to 
the user (from the perspective of this piece of code, whoever that is) to 
make sure the system headers provides the stuff the user wants to be 
enabled.

// Martin



More information about the ffmpeg-devel mailing list