Skip to content

Commit

Permalink
Support loading of both the DDS and ROS2 plugins on all supported pla…
Browse files Browse the repository at this point in the history
…tforms (#407)
  • Loading branch information
gmartin82 authored Dec 16, 2024
1 parent 1116f3d commit 2d60145
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 16 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,13 @@ jobs:
if: startsWith(matrix.os,'ubuntu')
run: sudo apt-get -y install libacl1-dev

- name: Install LLVM toolchain
if: startsWith(matrix.os,'macos')
run: |
brew install llvm@19
ls /opt/homebrew/opt/llvm@19/bin
echo "/opt/homebrew/opt/llvm@19/bin" >> $GITHUB_PATH
- name: Install Rust toolchain
run: |
rustup show
Expand All @@ -55,16 +62,29 @@ jobs:
if: ${{ ! startsWith(matrix.os,'windows') }}
run: cargo build -p zenoh-plugin-dds --features dds_shm --verbose --all-targets

- name: Build zenoh-plugin-dds (with prefix_symbols)
run: cargo build -p zenoh-plugin-dds --features prefix_symbols --verbose --all-targets

- name: Build zenoh-bridge-dds
run: cargo build -p zenoh-bridge-dds --verbose --all-targets

- name: Build zenoh-bridge-dds (with dds_shm)
if: ${{ ! startsWith(matrix.os,'windows') }}
run: cargo build -p zenoh-bridge-dds --features dds_shm --verbose --all-targets

- name: Build zenoh-bridge-dds (with prefix_symbols)
run: cargo build -p zenoh-bridge-dds --features prefix_symbols --verbose --all-targets

- name: Run tests
run: cargo test --verbose

- name: Run tests (with dds_shm)
if: ${{ ! startsWith(matrix.os,'windows') }}
run: cargo test --features dds_shm --verbose

- name: Run tests (with prefix_symbols)
run: cargo test --features prefix_symbols --verbose

# NOTE: In GitHub repository settings, the "Require status checks to pass
# before merging" branch protection rule ensures that commits are only merged
# from branches where specific status checks have passed. These checks are
Expand Down
30 changes: 15 additions & 15 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ async-trait = "0.1.66"
bincode = "1.3.3"
cdr = "0.2.4"
clap = "3.2.23"
cyclors = "=0.3.3"
cyclors = "=0.3.4"
derivative = "2.2.0"
flume = "0.11.0"
futures = "0.3.26"
Expand Down
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,24 @@ The following limitations apply to Cyclone DDS shared memory support in the plug
* When DDS shared memory is enabled the Iceoryx PSMX plugin will be instantiated with the default configuration. If additional configuration is required the Iceoryx plugin should be configured via the `CYCLONEDDS_URI` instead.
* In forward discovery mode DDS samples will not be forwarded via Zenoh unless the DDS data type is memcpy safe. A data type is memcpy safe if it does not contain indirections.

### DDS Library Symbol Prefixing

DDS support is provided by the [cyclors crate](https://crates.io/crates/cyclors). As this crate contains C code, symbol clashes may occur when loading the plugin statically with other plugins which use a different version of the ```cyclors``` crate (e.g. the ```zenoh-plugin-ros2dds``` plugin).

To allow multiple versions of the ```cyclors``` crate to be loaded at the same time the symbols within the crate can be prefixed with the crate version. The optional ```prefix_symbols``` feature can be used to build the DDS plugin with prefixed DDS library symbols. e.g.

- plugin library:
```bash
$ cargo build --release -p zenoh-plugin-dds --features prefix_symbols
```

- standalone executable binary:
```bash
$ cargo build --release -p zenoh-bridge-dds --features prefix_symbols
```

**Note:** The ```prefix_symbols``` feature cannot be used at the same time as the ```dds_shm``` feature.

## ROS 2 package
:warning: **Please consider using [`zenoh-bridge-ros2dds`](https://github.com/eclipse-zenoh/zenoh-plugin-ros2dds) which is dedicated to ROS 2.**

Expand Down
1 change: 1 addition & 0 deletions zenoh-bridge-dds/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ publish = false

[features]
dds_shm = ["zenoh-plugin-dds/dds_shm"]
prefix_symbols = ["zenoh-plugin-dds/prefix_symbols"]

[dependencies]
async-liveliness-monitor = { workspace = true }
Expand Down
1 change: 1 addition & 0 deletions zenoh-plugin-dds/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ crate-type = ["cdylib", "rlib"]
default = ["dynamic_plugin"]
dynamic_plugin = []
dds_shm = ["cyclors/iceoryx"]
prefix_symbols = ["cyclors/prefix_symbols"]
stats = ["zenoh/stats"]

[dependencies]
Expand Down

0 comments on commit 2d60145

Please sign in to comment.