From ef139c525f1b1e751f21cccf842982b4a2720dbd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Ladan?= Date: Wed, 15 Jan 2025 11:43:57 +0100 Subject: [PATCH] fix(build): fix build on FreeBSD (#1639) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Checklist - [x] I have read the [contribution guidelines](https://github.com/ooni/probe-cli/blob/master/CONTRIBUTING.md) - [x] reference issue for this pull request: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=270020 - [ ] if you changed anything related to how experiments work and you need to reflect these changes in the ooni/spec repository, please link to the related ooni/spec pull request: - [ ] if you changed code inside an experiment, make sure you bump its version number ## Description The build of ooni-probe currently fails on FreeBSD because the compiler cannot find some required symbols (C.SOCK_STREAM, C.AF_INET, C.AF_INET6 and C.AF_UNSPEC). This causes the package [net/ooni-probe-cli](https://www.freshports.org/net/ooni-probe-cli/) to be unavailable. Fix this by including sys/socket.h when building on FreeBSD. See also these FreeBSD bug reports (the second report also applies to Go 1.21 and Go 1.22): - [270020: net/ooni-probe-cli: update 3.21.1 → 3.22.0, fix build](https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=270020) - [272643: lang/go120: Build of one port fails with could not determine kind of name for C.AF_INET, etc](https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=272643) I took a bit of a shortcut for the fix in the first URL by omitting the #ifdef as that patch would only exist in the FreeBSD port anyway. Both URLs also discuss if this is a problem in OONI or Go itself. --------- Co-authored-by: René Ladan --- internal/netxlite/getaddrinfo_cgo.go | 1 + 1 file changed, 1 insertion(+) diff --git a/internal/netxlite/getaddrinfo_cgo.go b/internal/netxlite/getaddrinfo_cgo.go index 8e6f0416fc..fe7bd4301a 100644 --- a/internal/netxlite/getaddrinfo_cgo.go +++ b/internal/netxlite/getaddrinfo_cgo.go @@ -9,6 +9,7 @@ package netxlite #ifndef _WIN32 #include // for getaddrinfo +#include // for C.SOCK_STREAM and C.AF_* #else #include // for getaddrinfo #endif