[CDRIVER-4465] Cannot build libmongoc with SRV support on FreeBSD Created: 30/Aug/22  Updated: 28/Apr/23  Resolved: 28/Apr/23

Status: Closed
Project: C Driver
Component/s: Initial DNS Seedlist Discovery
Affects Version/s: 1.22.1
Fix Version/s: 1.24.0

Type: Bug Priority: Major - P3
Reporter: Jeremy Mikola Assignee: Kyle Kloberdanz
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
is depended on by PHPC-2133 Cannot build driver with SRV support ... Closed
Related
is related to MONGOCRYPT-470 Build fails on FreeBSD. Error: Don't ... Closed
is related to CDRIVER-2257 Initial DNS Seedlist discovery Closed
Epic Link: CDRIVER-4551

 Description   

Summary

User in mongodb/mongo-php-driver#1343 reported that they cannot compile libmongoc (either PHPC's bundled copy using Autotools or as a separate system library using CMake) with support for SRV resolution.

Support for mongodb+srv URIs was introduced in 1.9 with CDRIVER-2257. roberto.sanchez@mongodb.com pointed out that FreeBSD ports has a package for libmongoc 1.8.1, which would predate that. Additionally, kevin.albertson@mongodb.com noted that libmongoc does not explicitly support FreeBSD, nor is it tested on Evergreen.

I've cross-referenced this issue with another FreeBSD compat issue the same user reported in libmongocrypt, although that's not related to SRV resolution.

Environment

User compiled libmongoc 1.22.0 through PHPC and libmongoc 1.22.1 as a separate system library. Both failed to properly detect necessary resolution functions (i.e. MONGOC_HAVE_RES_SEARCH and MONGOC_HAVE_RES_NSEARCH were both 0).

FreeBSD version in use is 12.3.

Additionally configure output (from PHPC's build process) is available in the linked GitHub issue above. The relevant Autotools checks for that output comes from CheckResolv.m4.



 Comments   
Comment by Githook User [ 28/Apr/23 ]

Author:

{'name': 'Kyle Kloberdanz', 'email': 'kyle.kloberdanz@mongodb.com', 'username': 'kkloberdanz'}

Message: Fix build for FreeBSD (#625)

CDRIVER-4465

Comment by Githook User [ 27/Apr/23 ]

Author:

{'name': 'Kyle Kloberdanz', 'email': 'kyle.kloberdanz@mongodb.com', 'username': 'kkloberdanz'}

Message: Fix build for FreeBSD (#1243)

CDRIVER-4465

  • Some standard library features need __BSD_VISIBLE set to 1 to be enabled on FreeBSD
  • Cmake does not properly detect res_search on FreeBSD. Since res_search has existed since 4.3 BSD (which is the predecessor of FreeBSD), it is safe to assume that this function will exist in libc on any version of FreeBSD.

Co-authored-by: Kevin Albertson <kevin.albertson@10gen.com>
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/4a0e816e637cda37925c32db15b78b7cdf1c87b1

Comment by Kevin Albertson [ 14/Sep/22 ]

The suggested change to add #include <netinet/in.h> seems OK to me.

Generated at Wed Feb 07 21:21:00 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.