[CXX-2686] Fails to compile with GCC 13.0.1 Created: 28/Apr/23  Updated: 28/Oct/23  Resolved: 04/May/23

Status: Closed
Project: C++ Driver
Component/s: None
Affects Version/s: None
Fix Version/s: 3.7.2

Type: Bug Priority: Unknown
Reporter: Mark Benvenuto Assignee: Kyle Kloberdanz
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

Summary

Compilation of C++ driver fails with GCC 13.0.1

C++ driver is missing include headers for some C++ standard integers.
 

FAILED: src/mongocxx/CMakeFiles/mongocxx_shared.dir/events/heartbeat_started_event.cpp.o
/usr/bin/c++ -DMONGOCXX_EXPORTS -DMONGO_CXX_DRIVER_COMPILING -I/include -I/home/mark/src/mongo-cxx-driver/src/mongocxx/.. -I/home/mark/src/mongo-cxx-driver/cmake-build/src/mongocxx/.. -I/home/mark/src/mongo-cxx-driver/cmake-build/src/bsoncxx/third_party/EP_mnmlstc_core-prefix/src/EP_mnmlstc_core/include -I/home/mark/src/usr/include/bsoncxx/v_noabi -I/home/mark/src/mongo-cxx-driver/src/bsoncxx/.. -I/home/mark/src/mongo-cxx-driver/cmake-build/src/bsoncxx/.. -isystem /home/mark/src/usr/include/libmongoc-1.0 -isystem /home/mark/src/usr/include/libbson-1.0 -O2 -g -DNDEBUG -std=c++11 -fPIC -fvisibility=hidden -fvisibility-inlines-hidden -MD -MT src/mongocxx/CMakeFiles/mongocxx_shared.dir/events/heartbeat_started_event.cpp.o -MF src/mongocxx/CMakeFiles/mongocxx_shared.dir/events/heartbeat_started_event.cpp.o.d -o src/mongocxx/CMakeFiles/mongocxx_shared.dir/events/heartbeat_started_event.cpp.o -c /home/mark/src/mongo-cxx-driver/src/mongocxx/events/heartbeat_started_event.cpp
In file included from /home/mark/src/mongo-cxx-driver/src/mongocxx/events/heartbeat_started_event.cpp:15:
/home/mark/src/mongo-cxx-driver/src/mongocxx/../mongocxx/events/heartbeat_started_event.hpp:54:10: error: ‘uint16_t’ in namespace ‘std’ does not name a type; did you mean ‘wint_t’?
   54 |     std::uint16_t port() const;
      |          ^~~~~~~~
      |          wint_t
/home/mark/src/mongo-cxx-driver/src/mongocxx/events/heartbeat_started_event.cpp:33:15: error: no declaration matches ‘uint16_t mongocxx::v_noabi::events::heartbeat_started_event::port() const’
   33 | std::uint16_t heartbeat_started_event::port() const {
      |               ^~~~~~~~~~~~~~~~~~~~~~~
/home/mark/src/mongo-cxx-driver/src/mongocxx/events/heartbeat_started_event.cpp:33:15: note: no functions named ‘uint16_t mongocxx::v_noabi::events::heartbeat_started_event::port() const’
/home/mark/src/mongo-cxx-driver/src/mongocxx/../mongocxx/events/heartbeat_started_event.hpp:33:20: note: ‘class mongocxx::v_noabi::events::heartbeat_started_event’ defined here
   33 | class MONGOCXX_API heartbeat_started_event {
      |                    ^~~~~~~~~~~~~~~~~~~~~~~
...
 

Environment

Please provide the version of the C / CXX driver.

commit 52a1150d6fcb8211a6fe6652813441551da3a63e (HEAD -> master, origin/master)
Author: Kevin Albertson <kevin.albertson@mongodb.com>
Date: Fri Apr 28 14:38:28 2023 +0000

Please provide the host OS, version, and architecture (example: Windows 10 64-bit x86).

Fedora 38

Please provide the C / CXX compiler and version.

$ gcc --version
gcc (GCC) 13.0.1 20230401 (Red Hat 13.0.1-0)
Copyright (C) 2023 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

If applicable, please attach the full output of the cmake command used to configure the C / CXX driver.

 

How to Reproduce

Steps to reproduce. If possible, please include a Short, Self Contained, Correct (Compilable), Example

mkdir cmake-build
cd cmake-build
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=/home/mark/src/usr -GNinja ..
ninja

Additional Background

Please provide any additional background information that may be helpful in diagnosing the bug.



 Comments   
Comment by Githook User [ 06/Jun/23 ]

Author:

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

Message: Fix compilation for GCC 13 (#961)

CXX-2686
Branch: releases/stable
https://github.com/mongodb/mongo-cxx-driver/commit/29aa3401173c7ce59ecf8e9715a2f69f831cf2cd

Comment by Githook User [ 04/May/23 ]

Author:

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

Message: Fix compilation for GCC 13 (#961)

CXX-2686
Branch: releases/v3.7
https://github.com/mongodb/mongo-cxx-driver/commit/29aa3401173c7ce59ecf8e9715a2f69f831cf2cd

Comment by Githook User [ 04/May/23 ]

Author:

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

Message: Fix compilation for GCC 13 (#961)

CXX-2686
Branch: master
https://github.com/mongodb/mongo-cxx-driver/commit/cbc7b162d00b5ecc0101efb27b91aa0a604a0f23

Generated at Wed Feb 07 22:06:42 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.