Skip to content

Upgrade boost - #3631

Open
donghaiwang wants to merge 4 commits into
hutbfrom
upgrade_boost
Open

Upgrade boost#3631
donghaiwang wants to merge 4 commits into
hutbfrom
upgrade_boost

Conversation

@donghaiwang

Copy link
Copy Markdown
Member

Description

Upgrade boost to 1.90.0

Where has this been tested?

  • Platform(s): win11
  • Python version(s): 3.10
  • Unreal Engine version(s): engine

Possible Drawbacks

…0 upgrade (#9670)

* fix(PythonAPI/examples): replace deprecated NumPy aliases for NumPy 2 compatibility

Replace np.bool with np.bool_ in DVS event dtype in V2XDemo.py,
manual_control_chrono.py, and manual_control_carsim.py (removed in
NumPy 1.24). Replace np.matrix with np.array in client_bounding_boxes.py
(deprecated in NumPy 1.x, removed in NumPy 2.x). All replacements are
backward-compatible with NumPy >= 1.18.4.

* fix(build): upgrade Boost to 1.89.0 for NumPy 2 ABI compatibility

Drop the in-tree dtype.cpp.patch against Boost 1.84.0 and upgrade to
Boost 1.89.0, which carries the upstream NumPy 2 C ABI fix from
boostorg/python#432 natively. libboost_numpy now compiles against both
NumPy 1.x (>=1.18.4) and NumPy 2.x headers without any vendored patches.

Boost 1.84 -> 1.89 removed several deprecated Asio and Filesystem APIs;
all call sites in LibCarla and the CarlaTools UE4 plugin updated:
- io_context::work -> executor_work_guard (removed 1.85)
- io_context::reset() -> restart() (removed 1.86)
- address::from_string() -> make_address() (removed 1.85)
- resolver::query/iterator -> range-based resolve() (removed 1.85)
- buffer_cast<T>() -> static_cast via streambuf::data().data() (removed 1.88)
- io_service typedef -> io_context (removed 1.85)
- boost/filesystem/operations.hpp no longer includes directory.hpp (1.85)

Windows installer (install_boost.bat) SHA256 updated to the 1.89.0 zip
digest. MSVC C4459 pragma guard added around boost/asio.hpp in
MapPreviewUserWidget.h to prevent warnings-as-errors failure.

New regression-guard tests: test_boost_deadline_timer.cpp (3 tests),
test_boost_rtree.cpp (4 tests), test_boost_version.py.

* docs(CHANGELOG): note NumPy 2 compatibility

* fix(build): bump Boost 1.89 -> 1.90 and migrate timers to steady_timer

Boost 1.90 added [[deprecated]] annotations to boost::asio::deadline_timer.
LibCarla's networking code is migrated to boost::asio::steady_timer across
Primary, Secondary, Client, and ServerSession.

steady_timer default-constructs with expiry() == time_point::min() (past),
whereas deadline_timer defaulted to pos_infin (far future). The recursive
StartTimer() guard in ServerSession::StartTimer and Primary::StartTimer
checks expiry() <= now() and would fire Close() before socket setup if left
at the new default, so both _deadline members are explicitly constructed
with time_point::max() to preserve the old semantics.

API migrations at the call sites:
  * expires_from_now(duration)          -> expires_after(duration)
  * expires_at()                        -> expiry()
  * deadline_timer::traits_type::now()  -> std::chrono::steady_clock::now()
  * boost::posix_time durations         -> std::chrono durations

Build scripts:
  * Util/BuildTools/Setup.sh:      BOOST_VERSION 1.89.0 -> 1.90.0, SHA256
  * Util/BuildTools/Setup.bat:     version bump (Windows)
  * Util/BuildTools/BuildOSMRenderer.bat: install path bump (Windows)
  * Util/InstallersWin/install_boost.bat: source-zip SHA256 bump

Tests:
  * test_boost_deadline_timer.cpp: test class BoostDeadlineTimer renamed
    to BoostAsioTimer and migrated to steady_timer; 3 new regression
    tests pin the contract that prevents future refactors from silently
    reintroducing the default-construction trap:
      - InitializedWithMaxIsInDistantFuture
      - DefaultConstructedExpiryIsInPast
      - CancelTriggersAbortedError
  * test_boost_rtree.cpp:          header comment 1.89 -> 1.90
  * test_boost_version.py:         EXPECTED_BOOST_VERSION 1.89.0 -> 1.90.0;
                                   stale-cache check rolled 1.84.0 -> 1.89.0
  * CHANGELOG.md:                  NumPy 2 entry references Boost 1.90.0

Verified: make LibCarla + full make check.LibCarla pass on server and
client, release and debug. All 6 BoostAsioTimer.* and 4 BoostRtree.* tests
pass on both suites.

* fix(build): guard against all pre-1.90 Boost installs

Address review on PR #9670. The previous test guarded only against the 1.89.0 intermediate install used during development, letting a direct
  1.84.0 -> 1.90.0 upgrade slips past undetected.

- Replace the negative-only LDD check with a positive assertion that libboost_*.so.1.90.0 is present in PythonAPI/carla/dependencies/lib/, plus an explicit guard over known stale baselines (1.84.0, 1.89.0). Boost is statically linked into libcarla.so, so ldd cannot observe it; the dependencies/lib symlinks are the authoritative record.
- Update two Linux build scripts still pinned to boost-1.84.0 that were missed in the 1.84->1.89->1.90 bumps (the Windows .bat was updated):
  - Util/BuildTools/BuildOSMRenderer.sh
  - Util/BuildTools/Ad-rss.sh
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.

1 participant