[CDRIVER-4673] bson-dsl.h needed by mongo-c-driver but not installed by libbson Created: 05/Jul/23  Updated: 28/Oct/23  Resolved: 31/Aug/23

Status: Closed
Project: C Driver
Component/s: BSON, Build
Affects Version/s: 1.24.1
Fix Version/s: 1.24.4

Type: Bug Priority: Major - P3
Reporter: Ryan Schmidt Assignee: Kevin Albertson
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: Text File bson-dsl.patch    
Epic Link: CDRIVER-4546
Quarter: FY24Q2

 Description   

Problem Statement/Rationale

mongo-c-driver 1.24.1 fails to build because it can't find bson/bson-dsl.h. libbson 1.24.1 didn't install it.

Steps to Reproduce

I've installed libbson 1.24.1 built with these cmake flags:

{{-DENABLE_AUTOMATIC_INIT_AND_CLEANUP=OFF
-DENABLE_EXAMPLES=OFF
-DENABLE_TESTS=OFF
-DENABLE_UNINSTALL=OFF
-DMONGO_USE_CCACHE=OFF
-DENABLE_BSON=ON
-DENABLE_MONGOC=OFF}}

Then I tried to build mongo-c-driver 1.24.1 with these cmake flags:

{{{}-DENABLE_AUTOMATIC_INIT_AND_CLEANUP=OFF
-DENABLE_EXAMPLES=OFF
{}}}{{{}-DENABLE_TESTS=OFF
-DENABLE_UNINSTALL=OFF
-DMONGO_USE_CCACHE=OFF-DENABLE_ICU=ON
-DENABLE_MONGOC=ON
-DENABLE_SASL=CYRUS
-DENABLE_SNAPPY=ON
-DENABLE_ZLIB=SYSTEM
-DUSE_SYSTEM_LIBBSON=TRUE{}}}

Expected Results

Successful build

Actual Results

Build failure:

src/libmongoc/src/mongoc/mongoc-aggregate.c:26:10: fatal error: 'bson/bson-dsl.h' file not found
#include <bson/bson-dsl.h>
         ^~~~~~~~~~~~~~~~~
1 error generated.

Additional Notes

Another user previously reported the problem here:

https://github.com/mongodb/mongo-c-driver/commit/40a64c2ffd6634021741e5435be15089d1f466f3#commitcomment-119488769

I'm on macOS 12.6.7 installing libbson and mongo-c-driver with MacPorts—I'm the maintainer of these in MacPorts, currently trying to update them from 1.23.5, which was fine, to 1.24.1.

For 1.24.1 I'm using -DUSE_SYSTEM_LIBBSON=TRUE instead of -DENABLE_BSON=SYSTEM; I hope I've correctly understood from the documentation that this is needed.

 



 Comments   
Comment by Githook User [ 31/Aug/23 ]

Author:

{'name': 'Kevin Albertson', 'email': 'kevin.albertson@mongodb.com', 'username': 'kevinAlbs'}

Message: CDRIVER-4673 fix include of bson-dsl.h (#1388)

  • move bson-dsl.h to src/common

bson-dsl.h is not installed, but shared between libmongoc and libbson.
Intended to resolve CDRIVER-4673.

  • format bson-dsl.h
  • add bson-dsl.h to dist tarball
  • remove bson-dsl.h from old dist list
Comment by Githook User [ 30/Aug/23 ]

Author:

{'name': 'Kevin Albertson', 'email': 'kevin.albertson@mongodb.com', 'username': 'kevinAlbs'}

Message: CDRIVER-4673 fix build of libmongoc using system libbson (#1387)

  • move bson-dsl.h to src/common

bson-dsl.h is not installed, but shared between libmongoc and libbson.
Intended to resolve CDRIVER-4673.

  • do not define `mongo::detail::c_platform` if using system libbson
  • add regression test
  • fix more includes
  • add include of common-prelude.h
Comment by Ryan Schmidt [ 05/Jul/23 ]

The attached patch works for me. Does that look like the correct solution?

Comment by PM Bot [ 05/Jul/23 ]

Hi ryandesign, thank you for reporting this issue! The team will look into it and get back to you soon.

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