Skip to content

Commit 2d60145

Browse files
authored
Support loading of both the DDS and ROS2 plugins on all supported platforms (#407)
1 parent 1116f3d commit 2d60145

File tree

6 files changed

+56
-16
lines changed

6 files changed

+56
-16
lines changed

.github/workflows/ci.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,13 @@ jobs:
3838
if: startsWith(matrix.os,'ubuntu')
3939
run: sudo apt-get -y install libacl1-dev
4040

41+
- name: Install LLVM toolchain
42+
if: startsWith(matrix.os,'macos')
43+
run: |
44+
brew install llvm@19
45+
ls /opt/homebrew/opt/llvm@19/bin
46+
echo "/opt/homebrew/opt/llvm@19/bin" >> $GITHUB_PATH
47+
4148
- name: Install Rust toolchain
4249
run: |
4350
rustup show
@@ -55,16 +62,29 @@ jobs:
5562
if: ${{ ! startsWith(matrix.os,'windows') }}
5663
run: cargo build -p zenoh-plugin-dds --features dds_shm --verbose --all-targets
5764

65+
- name: Build zenoh-plugin-dds (with prefix_symbols)
66+
run: cargo build -p zenoh-plugin-dds --features prefix_symbols --verbose --all-targets
67+
5868
- name: Build zenoh-bridge-dds
5969
run: cargo build -p zenoh-bridge-dds --verbose --all-targets
6070

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

75+
- name: Build zenoh-bridge-dds (with prefix_symbols)
76+
run: cargo build -p zenoh-bridge-dds --features prefix_symbols --verbose --all-targets
77+
6578
- name: Run tests
6679
run: cargo test --verbose
6780

81+
- name: Run tests (with dds_shm)
82+
if: ${{ ! startsWith(matrix.os,'windows') }}
83+
run: cargo test --features dds_shm --verbose
84+
85+
- name: Run tests (with prefix_symbols)
86+
run: cargo test --features prefix_symbols --verbose
87+
6888
# NOTE: In GitHub repository settings, the "Require status checks to pass
6989
# before merging" branch protection rule ensures that commits are only merged
7090
# from branches where specific status checks have passed. These checks are

Cargo.lock

Lines changed: 15 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ async-trait = "0.1.66"
3434
bincode = "1.3.3"
3535
cdr = "0.2.4"
3636
clap = "3.2.23"
37-
cyclors = "=0.3.3"
37+
cyclors = "=0.3.4"
3838
derivative = "2.2.0"
3939
flume = "0.11.0"
4040
futures = "0.3.26"

README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,24 @@ The following limitations apply to Cyclone DDS shared memory support in the plug
146146
* 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.
147147
* 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.
148148

149+
### DDS Library Symbol Prefixing
150+
151+
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).
152+
153+
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.
154+
155+
- plugin library:
156+
```bash
157+
$ cargo build --release -p zenoh-plugin-dds --features prefix_symbols
158+
```
159+
160+
- standalone executable binary:
161+
```bash
162+
$ cargo build --release -p zenoh-bridge-dds --features prefix_symbols
163+
```
164+
165+
**Note:** The ```prefix_symbols``` feature cannot be used at the same time as the ```dds_shm``` feature.
166+
149167
## ROS 2 package
150168
:warning: **Please consider using [`zenoh-bridge-ros2dds`](https://github.com/eclipse-zenoh/zenoh-plugin-ros2dds) which is dedicated to ROS 2.**
151169

zenoh-bridge-dds/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ publish = false
2525

2626
[features]
2727
dds_shm = ["zenoh-plugin-dds/dds_shm"]
28+
prefix_symbols = ["zenoh-plugin-dds/prefix_symbols"]
2829

2930
[dependencies]
3031
async-liveliness-monitor = { workspace = true }

zenoh-plugin-dds/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ crate-type = ["cdylib", "rlib"]
3030
default = ["dynamic_plugin"]
3131
dynamic_plugin = []
3232
dds_shm = ["cyclors/iceoryx"]
33+
prefix_symbols = ["cyclors/prefix_symbols"]
3334
stats = ["zenoh/stats"]
3435

3536
[dependencies]

0 commit comments

Comments
 (0)