Skip to content

Commit ef139c5

Browse files
rene0René Ladan
andauthored
fix(build): fix build on FreeBSD (#1639)
## 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: <!-- add URL here --> - [ ] if you changed code inside an experiment, make sure you bump its version number <!-- Reminder: Location of the issue tracker: https://github.com/ooni/probe --> ## 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 <[email protected]>
1 parent 3bc4d0b commit ef139c5

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

internal/netxlite/getaddrinfo_cgo.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ package netxlite
99
1010
#ifndef _WIN32
1111
#include <netdb.h> // for getaddrinfo
12+
#include <sys/socket.h> // for C.SOCK_STREAM and C.AF_*
1213
#else
1314
#include <ws2tcpip.h> // for getaddrinfo
1415
#endif

0 commit comments

Comments
 (0)