Skip to content

tl_expected and libexpected-dev provide overlapping headers on Ubuntu 24.04 #311

@otamachan

Description

@otamachan

Hi, thanks for maintaining this great library!

Problem

Starting with Ubuntu 24.04 (Noble), the libexpected-dev package (v1.1.0) is available from the official Ubuntu repository. This package installs the header at /usr/include/tl/expected.hpp.

Meanwhile, generate_parameter_library depends on the ROS tl_expected package, which installs the same library at a different path: <prefix>/include/tl_expected/expected.hpp.

Both headers are from the same upstream project (TartanLlama/expected) but at different versions:

Package Version Include path
libexpected-dev (Ubuntu 24.04) 1.1.0 tl/expected.hpp
ros-jazzy-tl-expected (ROS) 1.0.1 tl_expected/expected.hpp

Both headers use the same header guard (TL_EXPECTED_HPP) and the same namespace (tl), so whichever is included first silently suppresses the other. This can cause subtle version mismatch issues and confuses tools like IWYU (include-what-you-use) about which path is canonical.

Since generate_parameter_library generates code that users include in their own packages, this issue affects all downstream consumers — not just this library itself. Any package using a generated parameter library will transitively pull in tl_expected/expected.hpp via rsl/parameter_validators.hpp and parameter_traits/parameter_traits.hpp, potentially clashing with the user's own tl/expected.hpp usage without them being aware of it.

The generated code template itself does not directly include tl_expected/expected.hpp. The dependency comes through rsl (via rsl/parameter_validators.hpp) and parameter_traits (via parameter_traits/parameter_traits.hpp). Since generate_parameter_library generates code that users include in their own packages, this transitively pulls in tl_expected/expected.hpp to all downstream consumers, potentially clashing with the user's own tl/expected.hpp usage without them being aware of it.

Suggestion

Consider migrating from the ROS tl_expected package to the Ubuntu system package libexpected-dev (rosdep key: libexpected-dev), at least for Jazzy and later (Ubuntu 24.04+). This would:

  • Eliminate the dual-installation conflict
  • Align with the system package that Ubuntu users may already have installed
  • Use a newer version (1.1.0 vs 1.0.1)

This would involve changing the include path from <tl_expected/expected.hpp> to <tl/expected.hpp> in rsl, parameter_traits, and generate_parameter_library.

Environment

  • ROS 2: Jazzy
  • Ubuntu: 24.04 (Noble)
  • libexpected-dev: 1.1.0-2
  • ros-jazzy-tl-expected: 1.0.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions