diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e1ce4fb..4c87631 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 @@ -46,7 +53,7 @@ jobs: - name: Code format check run: cargo fmt --check -- --config "unstable_features=true,imports_granularity=Crate,group_imports=StdExternalCrate" - name: Clippy - run: cargo clippy --workspace --all-targets --all-features -- --deny warnings + run: cargo clippy --workspace --all-targets --features stats,dynamic_plugin,dds_shm -- --deny warnings - name: Build zenoh-plugin-ros2dds run: cargo build -p zenoh-plugin-ros2dds --verbose --all-targets @@ -54,15 +61,27 @@ jobs: - name: Build zenoh-plugin-ros2dds (with dds_shm) run: cargo build -p zenoh-plugin-ros2dds --features dds_shm --verbose --all-targets + - name: Build zenoh-plugin-ros2dds (with prefix_symbols) + run: cargo build -p zenoh-plugin-ros2dds --features prefix_symbols --verbose --all-targets + - name: Build zenoh-bridge-ros2dds run: cargo build -p zenoh-bridge-ros2dds --verbose --all-targets - name: Build zenoh-bridge-ros2dds (with dds_shm) run: cargo build -p zenoh-bridge-ros2dds --features dds_shm --verbose --all-targets + - name: Build zenoh-bridge-ros2dds (with prefix_symbols) + run: cargo build -p zenoh-bridge-ros2dds --features prefix_symbols --verbose --all-targets + - name: Run tests run: cargo test --verbose + - name: Run tests (with dds_shm) + run: cargo test --features dds_shm --verbose + + - name: Run tests (with prefix_symbols) + run: cargo test --features prefix_symbols --verbose + system_tests_with_ros2_humble: name: System tests with ROS 2 Humble runs-on: ubuntu-latest diff --git a/Cargo.lock b/Cargo.lock index 4ea4b73..7b383e9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1003,9 +1003,9 @@ dependencies = [ [[package]] name = "cyclors" -version = "0.2.3" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e085999238629d13a7a19e4dc7a6e61505bcb2033f6a1bed24bff35035c47c4" +checksum = "47550a633d59df47867351d41dd348fc08e3b164303d21d82481998207f09732" dependencies = [ "bincode", "bindgen", diff --git a/Cargo.toml b/Cargo.toml index d534709..c3b4eab 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -29,7 +29,7 @@ async-trait = "0.1.66" bincode = "1.3.3" cdr = "0.2.4" clap = "4.4.11" -cyclors = "=0.2.3" +cyclors = "=0.2.5" derivative = "2.2.0" flume = "0.11.0" futures = "0.3.26" diff --git a/README.md b/README.md index 4a1e6af..c7ad457 100644 --- a/README.md +++ b/README.md @@ -117,6 +117,18 @@ cargo build --release The standalone executable binary `zenoh-bridge-ros2dds` and a plugin shared library (`*.so` on Linux, `*.dylib` on Mac OS, `*.dll` on Windows) to be dynamically loaded by the zenoh router `zenohd` will be generated in the `target/release` subdirectory. +### 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-dds``` 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 ROS2 plugin with prefixed DDS library symbols. e.g. + +```bash +$ cargo build --features prefix_symbols +``` + +**Note:** The ```prefix_symbols``` feature cannot be used at the same time as the ```dds_shm``` feature. + ## ROS 2 package You can also build `zenoh-bridge-ros2dds` as a ROS package running: diff --git a/zenoh-bridge-ros2dds/Cargo.toml b/zenoh-bridge-ros2dds/Cargo.toml index 9c6ec98..ef3187c 100644 --- a/zenoh-bridge-ros2dds/Cargo.toml +++ b/zenoh-bridge-ros2dds/Cargo.toml @@ -25,6 +25,7 @@ publish = false [features] dds_shm = ["zenoh-plugin-ros2dds/dds_shm"] +prefix_symbols = ["zenoh-plugin-ros2dds/prefix_symbols"] [dependencies] async-liveliness-monitor = { workspace = true } diff --git a/zenoh-plugin-ros2dds/Cargo.toml b/zenoh-plugin-ros2dds/Cargo.toml index 67b671a..86341d2 100644 --- a/zenoh-plugin-ros2dds/Cargo.toml +++ b/zenoh-plugin-ros2dds/Cargo.toml @@ -31,6 +31,7 @@ default = ["dynamic_plugin"] stats = ["zenoh/stats"] dynamic_plugin = [] dds_shm = ["cyclors/iceoryx"] +prefix_symbols = ["cyclors/prefix_symbols"] [dependencies] async-trait = { workspace = true }