Skip to content

Add <stdexcept>.#14299

Merged
Nir-Az merged 1 commit into
realsenseai:developmentfrom
BillyONeal:stdexcept
Sep 25, 2025
Merged

Add <stdexcept>.#14299
Nir-Az merged 1 commit into
realsenseai:developmentfrom
BillyONeal:stdexcept

Conversation

@BillyONeal

Copy link
Copy Markdown
Contributor

For use of std::runtime_error.

This resolves build failures on Ubuntu 24.04 like the following:

/usr/bin/c++ -DCOM_MULTITHREADED -DEASYLOGGINGPP_ASYNC -DELPP_THREAD_SAFE -DENFORCE_METADATA -DHWM_OVER_XU -DRS2_USE_V4L2_BACKEND -DUNICODE -DUSING_UDEV -I/vcpkg/buildtrees/realsense2/src/v2.56.3-fa124c44e5.clean -I/vcpkg/buildtrees/realsense2/src/v2.56.3-fa124c44e5.clean/src -I/vcpkg/buildtrees/realsense2/src/v2.56.3-fa124c44e5.clean/third-party/realsense-file/rosbag/console_bridge/include -I/vcpkg/buildtrees/realsense2/src/v2.56.3-fa124c44e5.clean/third-party/realsense-file/rosbag/cpp_common/include -I/vcpkg/buildtrees/realsense2/src/v2.56.3-fa124c44e5.clean/third-party/realsense-file/rosbag/rosbag_storage/include -I/vcpkg/buildtrees/realsense2/src/v2.56.3-fa124c44e5.clean/third-party/realsense-file/rosbag/roscpp_serialization/include -I/vcpkg/buildtrees/realsense2/src/v2.56.3-fa124c44e5.clean/third-party/realsense-file/rosbag/rostime/include -I/vcpkg/buildtrees/realsense2/src/v2.56.3-fa124c44e5.clean/third-party/realsense-file/rosbag/roscpp_traits/include -I/vcpkg/buildtrees/realsense2/src/v2.56.3-fa124c44e5.clean/third-party/realsense-file/rosbag/roslz4/include -I/vcpkg/buildtrees/realsense2/src/v2.56.3-fa124c44e5.clean/third-party/realsense-file/rosbag/msgs -I/vcpkg/buildtrees/realsense2/src/v2.56.3-fa124c44e5.clean/third-party/realsense-file/lz4/lib -I/vcpkg/buildtrees/realsense2/src/v2.56.3-fa124c44e5.clean/include -I/vcpkg/installed/x64-linux/debug/lib/pkgconfig/../../../include/libusb-1.0 -I/vcpkg/buildtrees/realsense2/src/v2.56.3-fa124c44e5.clean/third-party/rsutils/include -isystem /vcpkg/installed/x64-linux/include -fPIC -pedantic -Wno-missing-field-initializers -Wno-switch -Wno-multichar -Wsequence-point -Wformat -Wformat-security -mssse3 -pthread  -g -fPIC -MD -MT CMakeFiles/realsense2.dir/src/core/options-registry.cpp.o -MF CMakeFiles/realsense2.dir/src/core/options-registry.cpp.o.d -o CMakeFiles/realsense2.dir/src/core/options-registry.cpp.o -c /vcpkg/buildtrees/realsense2/src/v2.56.3-fa124c44e5.clean/src/core/options-registry.cpp
/vcpkg/buildtrees/realsense2/src/v2.56.3-fa124c44e5.clean/src/core/options-registry.cpp: In function ‘size_t librealsense::by_name::new_index()’:
/vcpkg/buildtrees/realsense2/src/v2.56.3-fa124c44e5.clean/src/core/options-registry.cpp:59:20: error: ‘runtime_error’ is not a member of ‘std’
   59 |         throw std::runtime_error( "reached option limit of 1000" );
      |                    ^~~~~~~~~~~~~
/vcpkg/buildtrees/realsense2/src/v2.56.3-fa124c44e5.clean/src/core/options-registry.cpp:10:1: note: ‘std::runtime_error’ is defined in header ‘<stdexcept>’; did you forget to ‘#include <stdexcept>’?
    9 | #include <map>
  +++ |+#include <stdexcept>
   10 | 

For use of std::runtime_error.
@sysrsbuild

Copy link
Copy Markdown
Contributor

Can one of the admins verify this patch?

@Nir-Az

Nir-Az commented Sep 21, 2025

Copy link
Copy Markdown
Collaborator

@BillyONeal thanks for the PR,
Can you explain the need? we build on Ubuntu 24 on GitHub actions without issues as is.
Thanks

@BillyONeal

Copy link
Copy Markdown
Contributor Author

@BillyONeal thanks for the PR, Can you explain the need? we build on Ubuntu 24 on GitHub actions without issues as is. Thanks

Perhaps the version of the compiler or standard library you're using is different, or one of your other dependencies drags this header in ahead of you. std::runtime_error very much comes from <stdexcept> so if you aren't #include-ing that header somewhere else you're liable to experience this.

@BillyONeal

Copy link
Copy Markdown
Contributor Author

Ah, I also observe that vcpkg is still shipping 2.56.3 but this repo just shipped 2.57.3 so it's possible that it already got fixed somewhere else?

@BillyONeal

Copy link
Copy Markdown
Contributor Author

Hmmm I also see we have a lot of other patches similarly adding standard library headers but not sure if they ever got submitted upstream:

@Nir-Az

Nir-Az commented Sep 25, 2025

Copy link
Copy Markdown
Collaborator

OK, I don't mind adding it if it helps you.
About vcpkg, normally it takes some time as they take the versions from master branch which we update only on major releases.
2.57.X is still on minor releases

@Nir-Az Nir-Az merged commit 5d5ee70 into realsenseai:development Sep 25, 2025
25 checks passed
@BillyONeal

Copy link
Copy Markdown
Contributor Author

OK, I don't mind adding it if it helps you. About vcpkg, normally it takes some time as they take the versions from master branch which we update only on major releases. 2.57.X is still on minor releases

Sure, not asking to update our bits, just pointing it out in case I'm accidentally wasting your time 😅.

Our normal rule is that if we're going to patch something, we at a minimum notify upstream. Just adding standard includes we don't do the 30 day waiting period for so we've already patched this.

Thanks for your consideration!

@BillyONeal BillyONeal deleted the stdexcept branch September 30, 2025 18:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants