[SERVER-80231] INVALID_SOCKET declaration conflict Created: 10/Jul/23  Updated: 05/Feb/24

Status: Open
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Minor - P4
Reporter: Eduard Rius Assignee: Patrick Freed
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Assigned Teams:
Service Arch
Backwards Compatibility: Minor Change
Sprint: Service Arch 2023-11-13, Service Arch 2023-11-27, Service Arch 2023-12-11, Service Arch 2023-12-25, Service Arch 2024-01-08, Service Arch 2024-01-22, Service Arch 2024-02-05, Service Arch 2024-02-19
Participants:

 Description   

Summary

The following error outputs when including mongo dependencies on the code:

error: expected unqualified-id before '-' token

const int INVALID_SOCKET = -1;

Environment

Found on Ubuntu 20.04 using gcc 9.3.

How to Reproduce

 

#include <httplib.h>
#include <mongo/util/net/sock.h>
 
int main(int argc, char **argv)
{ 
  return 0;
} 

The error appears because both used libraries define INVALID_SOCKET but mongo does not check if it exists. Just adding an if statement solves the issue.

 



 Comments   
Comment by Rishabh Bisht [ 18/Aug/23 ]

Good to know the fix is found. I have moved this to SERVER however I am unable to change its status to "In Code Review".

Could someone from server team help fix the Jira status please, perhaps chris.kelly@mongodb.com?

Comment by Eduard Rius [ 18/Aug/23 ]

Sorry for the late response. I've seen I made a mistake as the error does not come from driver but from server. I hope maybe it can be moved. Also, in this PR the issue has been solved. 

Comment by PM Bot [ 04/Aug/23 ]

There hasn't been any recent activity on this ticket, so we're resolving it. Thanks for reaching out! Please feel free to reopen this ticket if you're still experiencing the issue, and add a comment if you're able to provide more information.

Comment by PM Bot [ 24/Jul/23 ]

Hi eduard.rius.martinez@gmail.com! CXX-2708 is awaiting your response.

If this is still an issue for you, please open Jira to review the latest status and provide your feedback. Thanks!

Comment by Rishabh Bisht [ 12/Jul/23 ]

Hi eduard.rius.martinez@gmail.com, Could you please confirm the driver version? The file you mention is present only in the legacy driver (not under development), and not in the 3.6 release.

It is recommended to update to latest release of the driver to receive latest features, improvements and bug fixes. 

Comment by Eduard Rius [ 11/Jul/23 ]

Sorry for the confusion rishabh.bisht@mongodb.com , the driver version is 3.6.

Comment by Rishabh Bisht [ 11/Jul/23 ]

eduard.rius.martinez@gmail.com I think you shared the version of MongoDB.
I meant to ask the version of MongoDB C++ driver (mongocxx) - https://github.com/mongodb/mongo-cxx-driver/releases

 

Comment by Eduard Rius [ 11/Jul/23 ]

Hi rishabh.bisht@mongodb.com, I am using db version v6.0.7

Comment by Rishabh Bisht [ 10/Jul/23 ]

Hi eduard.rius.martinez@gmail.com , what's the version of C++ driver that you are using?

Comment by PM Bot [ 10/Jul/23 ]

Hi eduard.rius.martinez@gmail.com, thank you for reporting this issue! The team will look into it and get back to you soon.

Generated at Thu Feb 08 06:43:01 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.