From 017f5dea0cb16ec550e629d25c37698194810443 Mon Sep 17 00:00:00 2001 From: Geoff Martin Date: Thu, 31 Oct 2024 10:05:32 +0000 Subject: [PATCH 01/61] Added support for mangling C library symbols on Windows. --- Cross.toml | 17 +++++ build.rs | 144 +++++++++++++++++++++++++++++++++++------ nm/CMakeLists.txt | 8 ++- objcopy/CMakeLists.txt | 8 ++- 4 files changed, 152 insertions(+), 25 deletions(-) create mode 100644 Cross.toml diff --git a/Cross.toml b/Cross.toml new file mode 100644 index 0000000..8f0ad31 --- /dev/null +++ b/Cross.toml @@ -0,0 +1,17 @@ +[target.x86_64-unknown-linux-musl] +image = "jenoch/rust-cross:x86_64-unknown-linux-musl" + +[target.arm-unknown-linux-gnueabi] +image = "jenoch/rust-cross:arm-unknown-linux-gnueabi" + +[target.arm-unknown-linux-gnueabihf] +image = "jenoch/rust-cross:arm-unknown-linux-gnueabihf" + +[target.armv7-unknown-linux-gnueabihf] +image = "jenoch/rust-cross:armv7-unknown-linux-gnueabihf" + +[target.aarch64-unknown-linux-gnu] +image = "jenoch/rust-cross:aarch64-unknown-linux-gnu" + +[target.aarch64-unknown-linux-musl] +image = "jenoch/rust-cross:aarch64-unknown-linux-musl" diff --git a/build.rs b/build.rs index af0e5bf..d3682f6 100644 --- a/build.rs +++ b/build.rs @@ -15,11 +15,27 @@ fn main() { let mut dir_builder = std::fs::DirBuilder::new(); dir_builder.recursive(true); + // Symbol Prefix to add to C symbols + #[allow(unused)] + let mut prefix = String::new(); + #[cfg(all( + any(target_os = "linux", target_os = "windows"), + not(feature = "iceoryx") + ))] + { + // Prefix = cyclors_ + prefix = env::var("CARGO_PKG_VERSION").unwrap().replace('.', "_"); + prefix.insert_str(0, "cyclors_"); + prefix.push('_'); + } + + let cyclonedds_src_dir = prepare_cyclonedds_src("cyclonedds", &out_dir, &prefix); + // Create Cyclone DDS build directory and initial config let cyclonedds_dir = out_dir.join("cyclonedds-build"); dir_builder.create(&cyclonedds_dir).unwrap(); - let mut cyclonedds = cmake::Config::new("cyclonedds"); + let mut cyclonedds = cmake::Config::new(cyclonedds_src_dir); let mut cyclonedds = cyclonedds.out_dir(cyclonedds_dir); // Create initial bindings builder @@ -150,28 +166,21 @@ fn main() { .clang_arg(format!("-I{}", cyclocut_include.to_str().unwrap())) .generate_comments(false); - #[allow(unused)] - let mut prefix = String::from(""); - // Prefix symbols in Cyclone DDS and Cyclocut libraries to ensure uniqueness - #[cfg(all(target_os = "linux", not(feature = "iceoryx")))] - { - // Prefix = cyclors_ - prefix = env::var("CARGO_PKG_VERSION").unwrap().replace('.', "_"); - prefix.insert_str(0, "cyclors_"); - prefix.push('_'); - + if !prefix.is_empty() { let mut symbols = HashSet::new(); + let ddsc_lib_name = get_library_name("ddsc").unwrap(); + let cdds_lib_name = get_library_name("cdds-util").unwrap(); - let cyclone_symbols = get_defined_symbols(&cyclonedds_lib, "libddsc.a") - .expect("Failed to get symbols from libddsc.a!"); + let cyclone_symbols = get_defined_symbols(&cyclonedds_lib, &ddsc_lib_name) + .expect("Failed to get symbols from ddsc library!"); symbols.extend(cyclone_symbols); - prefix_symbols(&cyclonedds_lib, "libddsc.a", &prefix, &symbols).unwrap(); + prefix_symbols(&cyclonedds_lib, &ddsc_lib_name, &prefix, &symbols).unwrap(); - let cyclocut_symbols = get_defined_symbols(&cyclocut_lib, "libcdds-util.a") - .expect("Failed to get symbols from libcdds-util.a!"); + let cyclocut_symbols = get_defined_symbols(&cyclocut_lib, &cdds_lib_name) + .expect("Failed to get symbols from cdds-util library!"); symbols.extend(cyclocut_symbols); - prefix_symbols(&cyclocut_lib, "libcdds-util.a", &prefix, &symbols).unwrap(); + prefix_symbols(&cyclocut_lib, &cdds_lib_name, &prefix, &symbols).unwrap(); #[derive(Debug)] struct PrefixLinkNameCallback { @@ -219,7 +228,96 @@ fn main() { .expect("Couldn't write bindings!"); } -#[cfg(all(target_os = "linux", not(feature = "iceoryx")))] +#[allow(unused_variables)] +fn prepare_cyclonedds_src(src_dir: &str, out_dir: &Path, prefix: &str) -> PathBuf { + #[cfg(target_os = "windows")] + if !prefix.is_empty() { + let mut dst_dir = src_dir.to_string(); + dst_dir.push_str("-src"); + let dst_dir = out_dir.join(dst_dir); + + // Delete copied source directory if it already exists + if dst_dir.exists() { + fs::remove_dir_all(dst_dir.clone()).unwrap(); + } + copy_dir_recursive(&PathBuf::from(src_dir), &dst_dir).unwrap(); + + // Prefix tls_callback_func in cyclonedds-src/src/ddsrt/src/cdtors.c + let mut prefixed_func = prefix.to_string(); + prefixed_func.push_str("tls_callback_func"); + let cdtors = dst_dir + .join("src") + .join("ddsrt") + .join("src") + .join("cdtors.c"); + replace_in_file(&cdtors, "tls_callback_func", &prefixed_func).unwrap(); + + return dst_dir; + } + PathBuf::from(src_dir) +} + +#[allow(unused)] +fn copy_dir_recursive(src: &Path, dst: &Path) -> std::io::Result<()> { + println!( + "src = {}, dir = {}", + src.to_str().unwrap(), + dst.to_str().unwrap() + ); + if !dst.exists() { + fs::create_dir_all(dst)?; + } + + for entry in fs::read_dir(src)? { + let entry = entry?; + let path = entry.path(); + let dest_path = dst.join(entry.file_name()); + + if path.is_dir() { + copy_dir_recursive(&path, &dest_path)?; + } else { + fs::copy(&path, &dest_path)?; + } + } + Ok(()) +} + +#[allow(unused)] +fn replace_in_file(file_path: &Path, from: &str, to: &str) -> std::io::Result<()> { + // Read the file content into a string + let content = fs::read_to_string(file_path)?; + + // Replace all occurrences of `from` with `to` + let new_content = content.replace(from, to); + + // Write the modified content back to the file + let mut file = fs::OpenOptions::new() + .write(true) + .truncate(true) // Clear the file before writing + .open(file_path)?; + + file.write_all(new_content.as_bytes())?; + Ok(()) +} + +fn get_library_name(lib_name: &str) -> Option { + #[cfg(target_os = "linux")] + { + let mut file_name = String::from("lib"); + file_name.push_str(lib_name); + file_name.push_str(".a"); + Some(file_name) + } + #[cfg(target_os = "windows")] + { + let mut file_name = String::from(lib_name); + file_name.push_str(".lib"); + Some(file_name) + } + #[cfg(not(any(target_os = "linux", target_os = "windows")))] + None +} + fn get_defined_symbols(lib_dir: &Path, lib_name: &str) -> Result, String> { use std::io::{BufRead, BufReader}; @@ -229,7 +327,7 @@ fn get_defined_symbols(lib_dir: &Path, lib_name: &str) -> Result let symbol_file_path = lib_dir.to_path_buf().join(nm_file_name); let mut nm = cmake::Config::new("nm"); - nm.build_target("all") + nm.build_target("read_symbols") .define("LIB_PATH", lib_path.clone()) .build(); @@ -243,6 +341,11 @@ fn get_defined_symbols(lib_dir: &Path, lib_name: &str) -> Result Ok(line) => { let tokens: Vec<&str> = line.split_whitespace().collect(); let symbol = *tokens.last().unwrap(); + #[cfg(target_os = "windows")] + if !symbol.ends_with("tls_callback_func") { + result.insert(String::from(symbol)); + } + #[cfg(not(target_os = "windows"))] result.insert(String::from(symbol)); } Err(_) => return Err(format!("Failed to run nm on library {}", lib_name)), @@ -260,7 +363,6 @@ fn get_defined_symbols(lib_dir: &Path, lib_name: &str) -> Result } } -#[cfg(all(target_os = "linux", not(feature = "iceoryx")))] fn prefix_symbols( lib_dir: &Path, lib_name: &str, @@ -300,7 +402,7 @@ fn prefix_symbols( let mut objcopy = cmake::Config::new("objcopy"); objcopy - .build_target("all") + .build_target("mangle_library") .define("LIB_PATH", lib_file_path.clone()) .define("SYMBOL_FILE_PATH", symbol_file_path.clone()) .build(); diff --git a/nm/CMakeLists.txt b/nm/CMakeLists.txt index 300d5ce..f47d634 100644 --- a/nm/CMakeLists.txt +++ b/nm/CMakeLists.txt @@ -1,8 +1,12 @@ cmake_minimum_required(VERSION 3.12) project(NM) -# Include the CMakeFindBinUtils module to find nm -include(CMakeFindBinUtils) +if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux") + # Include the CMakeFindBinUtils module to find nm + include(CMakeFindBinUtils) +else() + find_program(CMAKE_NM llvm-nm) +endif() # Ensure nm is available if(NOT CMAKE_NM) diff --git a/objcopy/CMakeLists.txt b/objcopy/CMakeLists.txt index 5589699..86f7de8 100644 --- a/objcopy/CMakeLists.txt +++ b/objcopy/CMakeLists.txt @@ -1,8 +1,12 @@ cmake_minimum_required(VERSION 3.12) project(Objcopy) -# Include the CMakeFindBinUtils module to find objcopy -include(CMakeFindBinUtils) +if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux") + # Include the CMakeFindBinUtils module to find objcopy + include(CMakeFindBinUtils) +else() + find_program(CMAKE_OBJCOPY llvm-objcopy) +endif() # Ensure objcopy is available if(NOT CMAKE_OBJCOPY) From 7650eb28c900d1f13303c9784cf5e6739d67d823 Mon Sep 17 00:00:00 2001 From: Geoff Martin Date: Thu, 31 Oct 2024 10:08:50 +0000 Subject: [PATCH 02/61] Allow unused variables in get_library_name(). --- build.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/build.rs b/build.rs index d3682f6..4be1adc 100644 --- a/build.rs +++ b/build.rs @@ -300,6 +300,7 @@ fn replace_in_file(file_path: &Path, from: &str, to: &str) -> std::io::Result<() Ok(()) } +#[allow(unused_variables)] fn get_library_name(lib_name: &str) -> Option { #[cfg(target_os = "linux")] { From b34e3822fbc3fda679fd3dbde755106b7aa4a534 Mon Sep 17 00:00:00 2001 From: Geoff Martin Date: Thu, 31 Oct 2024 10:50:35 +0000 Subject: [PATCH 03/61] Bumping version number to 0.3.4. --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 947cfc2..e2f6c78 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cyclors" -version = "0.3.3" +version = "0.3.4" authors = ["kydos "] license = "Apache-2.0" readme = "README.md" From 3ca4682016b260d9bdda828e0ab6bff99dbc72a3 Mon Sep 17 00:00:00 2001 From: Geoff Martin Date: Mon, 4 Nov 2024 10:47:24 +0000 Subject: [PATCH 04/61] Installing Rust toolchain as part of CI run to ensure fmt is available. --- .github/workflows/rust.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index ab3f9c3..5376b12 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -24,6 +24,10 @@ jobs: - name: Install ACL if: startsWith(matrix.os,'ubuntu') run: sudo apt-get -y install acl-dev + - name: Install Rust toolchain + run: | + rustup show + rustup component add rustfmt clippy - name: Code format check uses: actions-rs/cargo@v1 with: From 645f300d649b827cc5cbb534ed7f8132164c22ea Mon Sep 17 00:00:00 2001 From: Geoff Martin Date: Thu, 5 Dec 2024 18:30:07 +0000 Subject: [PATCH 05/61] Support for symbol mangling on all operating systems. --- .github/workflows/rust.yml | 6 + Cargo.toml | 5 + build.rs | 440 ++++++++++++++++++++++++------------- examples/disco.rs | 2 +- nm/CMakeLists.txt | 13 +- nm/check_errors.sh | 10 - objcopy/CMakeLists.txt | 10 +- objcopy/check_errors.sh | 10 - 8 files changed, 303 insertions(+), 193 deletions(-) delete mode 100755 nm/check_errors.sh delete mode 100755 objcopy/check_errors.sh diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 5376b12..572d5cc 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -24,6 +24,12 @@ jobs: - name: Install ACL if: startsWith(matrix.os,'ubuntu') run: sudo apt-get -y install acl-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 diff --git a/Cargo.toml b/Cargo.toml index e2f6c78..680e583 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -27,6 +27,11 @@ serde_json = "1.0.94" [build-dependencies] bindgen = "0.69" cmake = "0.1" +regex = "1.11" [features] iceoryx = [] +default = [ + "prefix_symbols", +] +prefix_symbols = [] diff --git a/build.rs b/build.rs index 4be1adc..ce34954 100644 --- a/build.rs +++ b/build.rs @@ -2,101 +2,210 @@ extern crate bindgen; #[allow(unused_imports)] use std::collections::HashSet; -use std::fs::File; #[allow(unused_imports)] -use std::io::{LineWriter, Write}; +use std::io::{BufRead, BufReader, LineWriter, Write}; use std::path::{Path, PathBuf}; #[allow(unused_imports)] use std::process::Command; use std::{env, fs}; +use std::{ffi::OsStr, fs::metadata, fs::File}; fn main() { let out_dir = PathBuf::from(env::var("OUT_DIR").unwrap()); let mut dir_builder = std::fs::DirBuilder::new(); dir_builder.recursive(true); - // Symbol Prefix to add to C symbols - #[allow(unused)] - let mut prefix = String::new(); - #[cfg(all( - any(target_os = "linux", target_os = "windows"), - not(feature = "iceoryx") - ))] - { - // Prefix = cyclors_ - prefix = env::var("CARGO_PKG_VERSION").unwrap().replace('.', "_"); - prefix.insert_str(0, "cyclors_"); - prefix.push('_'); + // Check features + let iceoryx_enabled = is_iceoryx_enabled(); + let prefix_symbols_enabled = is_prefix_symbols_enabled(); + + if iceoryx_enabled && prefix_symbols_enabled { + print!("cargo:warning=iceoryx and prefix_symbols features cannot both be enabled!"); + std::process::exit(1); } + // Determine symbol prefix + let prefix = match prefix_symbols_enabled { + true => { + let mut prefix = env::var("CARGO_PKG_VERSION").unwrap().replace('.', "_"); + prefix.insert_str(0, "cyclors_"); + prefix.push('_'); + prefix + } + false => String::new(), + }; + + // Build Iceoryx (if enabled) + let mut iceoryx = PathBuf::new(); + if iceoryx_enabled { + let iceoryx_src_dir = Path::new("iceoryx/iceoryx_meta"); + let iceoryx_out_dir = out_dir.join("iceoryx-build"); + dir_builder.create(&iceoryx_out_dir).unwrap(); + iceoryx = build_iceoryx(iceoryx_src_dir, &iceoryx_out_dir); + } + + // Build Cyclone DDS let cyclonedds_src_dir = prepare_cyclonedds_src("cyclonedds", &out_dir, &prefix); + let cyclonedds_out_dir = out_dir.join("cyclonedds-build"); + dir_builder.create(&cyclonedds_out_dir).unwrap(); + let cyclonedds = build_cyclonedds( + &cyclonedds_src_dir, + &cyclonedds_out_dir, + iceoryx.as_os_str(), + ); - // Create Cyclone DDS build directory and initial config - let cyclonedds_dir = out_dir.join("cyclonedds-build"); - dir_builder.create(&cyclonedds_dir).unwrap(); + // Prefix Cyclone DDS library symbols if enabled + let mut symbols = HashSet::new(); + if prefix_symbols_enabled { + let cyclonedds_lib = cyclonedds.join("lib"); + let ddsc_lib_name = get_library_name("ddsc").unwrap(); + let cyclone_symbols = get_defined_symbols(&cyclonedds_lib, &ddsc_lib_name) + .expect("Failed to get symbols from ddsc library!"); + symbols.extend(cyclone_symbols); + prefix_symbols(&cyclonedds_lib, &ddsc_lib_name, &prefix, &symbols).unwrap(); + } - let mut cyclonedds = cmake::Config::new(cyclonedds_src_dir); - let mut cyclonedds = cyclonedds.out_dir(cyclonedds_dir); + // Build cyclocut + let cyclocut_src_dir = Path::new("cyclocut"); + let cyclocut_out_dir = out_dir.join("cyclocut-build"); + dir_builder.create(&cyclocut_out_dir).unwrap(); + let cyclocut = build_cyclocut(cyclocut_src_dir, &cyclocut_out_dir, &cyclonedds); + + // Prefix Cyclocut library symbols if enabled + if prefix_symbols_enabled { + let cyclocut_lib = cyclocut.join("lib"); + let cyclocut_lib_name = get_library_name("cdds-util").unwrap(); + let cyclocut_symbols = get_defined_symbols(&cyclocut_lib, &cyclocut_lib_name) + .expect("Failed to get symbols from cdds-util library!"); + symbols.extend(cyclocut_symbols); + prefix_symbols(&cyclocut_lib, &cyclocut_lib_name, &prefix, &symbols).unwrap(); + } + + // Configure bindings build + let cyclonedds_include = cyclonedds.join("include"); + let cyclocut_include = cyclocut.join("include"); - // Create initial bindings builder let mut bindings = bindgen::Builder::default(); + bindings = bindings + .header("wrapper.h") + .clang_arg(format!("-I{}", cyclonedds_include.to_str().unwrap())) + .clang_arg(format!("-I{}", cyclocut_include.to_str().unwrap())) + .generate_comments(false); + + // Set link name if prefix enabled + if prefix_symbols_enabled { + #[derive(Debug)] + struct PrefixLinkNameCallback { + prefix: String, + symbols: HashSet, + } + + impl bindgen::callbacks::ParseCallbacks for PrefixLinkNameCallback { + fn generated_link_name_override( + &self, + item_info: bindgen::callbacks::ItemInfo<'_>, + ) -> Option { + let mut item = String::from(""); + #[cfg(target_os = "macos")] + item.push('_'); + item.push_str(item_info.name); + match self.symbols.contains(&item) { + true => { + let mut prefix = String::from(""); + #[cfg(target_os = "macos")] + prefix.push('_'); + prefix.push_str(&self.prefix); + prefix.push_str(item_info.name); + Some(prefix) + } + false => None, + } + } + } + + bindings = bindings.parse_callbacks(Box::new(PrefixLinkNameCallback { + prefix: prefix.clone(), + symbols: symbols.clone(), + })); + } + // Add *IMAGE_TLS_DIRECTORY* to blocklist on Windows due to + // https://github.com/rust-lang/rust-bindgen/issues/2179 + #[cfg(target_os = "windows")] + let bindings = bindings + .clang_arg("-Wno-invalid-token-paste") + .blocklist_type("^(.*IMAGE_TLS_DIRECTORY.*)$"); + + // Set link name prefix on additional wrapper functions + generate_template_src(&prefix, &out_dir).unwrap(); + + // Generate bindings + let bindings = bindings.generate().expect("Unable to generate bindings"); + + bindings + .write_to_file(out_dir.join("bindings.rs")) + .expect("Couldn't write bindings!"); +} + +fn is_iceoryx_enabled() -> bool { #[cfg(feature = "iceoryx")] { - let supported; #[cfg(target_os = "windows")] { print!("cargo:warning=Cyclone DDS Iceoryx PSMX plugin is not supported on Windows!"); - supported = false; - } - #[cfg(not(target_os = "windows"))] - { - supported = true; - } - - if !supported { std::process::exit(1); } + true + } + #[cfg(not(feature = "iceoryx"))] + { + false + } +} - // Build iceoryx - let iceoryx_dir = out_dir.join("iceoryx-build"); - dir_builder.create(&iceoryx_dir).unwrap(); - let mut iceoryx = cmake::Config::new("iceoryx/iceoryx_meta"); +fn is_prefix_symbols_enabled() -> bool { + #[cfg(feature = "prefix_symbols")] + { + true + } + #[cfg(not(feature = "prefix_symbols"))] + { + false + } +} - let iceoryx = iceoryx - .define("BUILD_SHARED_LIBS", "OFF") - .out_dir(iceoryx_dir) - .build(); +fn build_iceoryx(src_dir: &Path, out_dir: &Path) -> PathBuf { + let mut iceoryx = cmake::Config::new(src_dir); + let iceoryx_path = iceoryx + .define("BUILD_SHARED_LIBS", "OFF") + .out_dir(out_dir) + .build(); - let iceoryx_install_path = iceoryx.as_os_str(); - let iceoryx_lib = iceoryx.join("lib"); + // Add iceoryx lib to link + let iceoryx_lib = iceoryx_path.join("lib"); + println!("cargo:rustc-link-search=native={}", iceoryx_lib.display()); + println!("cargo:rustc-link-lib=static=iceoryx_hoofs"); + println!("cargo:rustc-link-lib=static=iceoryx_posh"); + println!("cargo:rustc-link-lib=static=iceoryx_platform"); - // Add iceoryx lib to link - println!("cargo:rustc-link-search=native={}", iceoryx_lib.display()); - println!("cargo:rustc-link-lib=static=iceoryx_hoofs"); - println!("cargo:rustc-link-lib=static=iceoryx_posh"); - println!("cargo:rustc-link-lib=static=iceoryx_platform"); + #[cfg(target_os = "linux")] + println!("cargo:rustc-link-lib=acl"); - cyclonedds = cyclonedds - .env("iceoryx_hoofs_DIR", iceoryx_install_path) - .env("iceoryx_posh_DIR", iceoryx_install_path) - .define("ENABLE_ICEORYX", "YES"); + #[cfg(not(any(target_os = "windows", target_os = "macos")))] + println!("cargo:rustc-link-lib=stdc++"); - #[cfg(target_os = "linux")] - println!("cargo:rustc-link-lib=acl"); + #[cfg(target_os = "macos")] + println!("cargo:rustc-link-lib=c++"); - #[cfg(not(any(target_os = "windows", target_os = "macos")))] - println!("cargo:rustc-link-lib=stdc++"); + iceoryx_path +} - #[cfg(target_os = "macos")] - println!("cargo:rustc-link-lib=c++"); - } - #[cfg(not(feature = "iceoryx"))] - { - cyclonedds = cyclonedds.define("ENABLE_ICEORYX", "NO"); - } +fn build_cyclonedds(src_dir: &Path, out_dir: &Path, iceoryx_path: &OsStr) -> PathBuf { + // Create Cyclone DDS build initial config + let mut cyclonedds = cmake::Config::new(src_dir); + let mut cyclonedds = cyclonedds.out_dir(out_dir); - // Finish configuration of cyclonedds build + // Configure cyclonedds build cyclonedds = cyclonedds .define("BUILD_SHARED_LIBS", "OFF") .define("BUILD_IDLC", "OFF") @@ -106,18 +215,25 @@ fn main() { .define("ENABLE_SECURITY", "NO") .define("CMAKE_INSTALL_LIBDIR", "lib"); + if !iceoryx_path.is_empty() { + cyclonedds = cyclonedds + .env("iceoryx_hoofs_DIR", iceoryx_path) + .env("iceoryx_posh_DIR", iceoryx_path) + .define("ENABLE_ICEORYX", "YES"); + } else { + cyclonedds = cyclonedds.define("ENABLE_ICEORYX", "NO"); + } + // Force compilation of Cyclone DDS in release mode on Windows due to // https://github.com/rust-lang/rust/issues/39016 #[cfg(all(debug_assertions, target_os = "windows"))] let cyclonedds = cyclonedds.profile("Release"); // Build cyclonedds - let cyclonedds = cyclonedds.build(); - - let cyclonedds_include = cyclonedds.join("include"); - let cyclonedds_lib = cyclonedds.join("lib"); + let cyclonedds_path = cyclonedds.build(); // Add cyclonedds lib to link + let cyclonedds_lib = cyclonedds_path.join("lib"); println!( "cargo:rustc-link-search=native={}", cyclonedds_lib.display() @@ -126,106 +242,42 @@ fn main() { // Add Windows libraries required by Cyclone to link #[cfg(target_os = "windows")] - println!("cargo:rustc-link-lib=Iphlpapi"); - #[cfg(target_os = "windows")] - println!("cargo:rustc-link-lib=DbgHelp"); - #[cfg(target_os = "windows")] - println!("cargo:rustc-link-lib=Bcrypt"); + { + println!("cargo:rustc-link-lib=Iphlpapi"); + println!("cargo:rustc-link-lib=DbgHelp"); + println!("cargo:rustc-link-lib=Bcrypt"); + } - // Build cyclocut - let cyclocut_dir = out_dir.join("cyclocut-build"); - dir_builder.create(&cyclocut_dir).unwrap(); - let mut cyclocut = cmake::Config::new("cyclocut"); + cyclonedds_path +} + +fn build_cyclocut(src_dir: &Path, out_dir: &Path, cyclonedds_dir: &Path) -> PathBuf { + let mut cyclocut = cmake::Config::new(src_dir); // Force compilation of Cyclocut in release mode on Windows due to // https://github.com/rust-lang/rust/issues/39016 #[cfg(all(debug_assertions, target_os = "windows"))] let cyclocut = cyclocut.profile("Release"); - let cyclocut = cyclocut + let cyclonedds_include = cyclonedds_dir.join("include"); + let cyclonedds_lib = cyclonedds_dir.join("lib"); + + let cyclocut_path = cyclocut .env("CYCLONE_INCLUDE", &cyclonedds_include) .env("CYCLONE_LIB", &cyclonedds_lib) .define("CYCLONE_INCLUDE", cyclonedds_include.clone()) .define("CYCLONE_LIB", cyclonedds_lib.clone()) .define("BUILD_SHARED_LIBS", "OFF") .define("CMAKE_INSTALL_LIBDIR", "lib") - .out_dir(cyclocut_dir) + .out_dir(out_dir) .build(); - let cyclocut_include = cyclocut.join("include"); - let cyclocut_lib = cyclocut.join("lib"); - // Add cyclocut lib to link + let cyclocut_lib = cyclocut_path.join("lib"); println!("cargo:rustc-link-search=native={}", cyclocut_lib.display()); println!("cargo:rustc-link-lib=static=cdds-util"); - // Finish configuration of bindings build - bindings = bindings - .header("wrapper.h") - .clang_arg(format!("-I{}", cyclonedds_include.to_str().unwrap())) - .clang_arg(format!("-I{}", cyclocut_include.to_str().unwrap())) - .generate_comments(false); - - // Prefix symbols in Cyclone DDS and Cyclocut libraries to ensure uniqueness - if !prefix.is_empty() { - let mut symbols = HashSet::new(); - let ddsc_lib_name = get_library_name("ddsc").unwrap(); - let cdds_lib_name = get_library_name("cdds-util").unwrap(); - - let cyclone_symbols = get_defined_symbols(&cyclonedds_lib, &ddsc_lib_name) - .expect("Failed to get symbols from ddsc library!"); - symbols.extend(cyclone_symbols); - prefix_symbols(&cyclonedds_lib, &ddsc_lib_name, &prefix, &symbols).unwrap(); - - let cyclocut_symbols = get_defined_symbols(&cyclocut_lib, &cdds_lib_name) - .expect("Failed to get symbols from cdds-util library!"); - symbols.extend(cyclocut_symbols); - prefix_symbols(&cyclocut_lib, &cdds_lib_name, &prefix, &symbols).unwrap(); - - #[derive(Debug)] - struct PrefixLinkNameCallback { - prefix: String, - symbols: HashSet, - } - - impl bindgen::callbacks::ParseCallbacks for PrefixLinkNameCallback { - fn generated_link_name_override( - &self, - item_info: bindgen::callbacks::ItemInfo<'_>, - ) -> Option { - match self.symbols.contains(item_info.name) { - true => { - let mut prefix = self.prefix.clone(); - prefix.push_str(item_info.name); - Some(prefix) - } - false => None, - } - } - } - - bindings = bindings.parse_callbacks(Box::new(PrefixLinkNameCallback { - prefix: prefix.clone(), - symbols: symbols.clone(), - })); - } - - // Add *IMAGE_TLS_DIRECTORY* to blocklist on Windows due to - // https://github.com/rust-lang/rust-bindgen/issues/2179 - #[cfg(target_os = "windows")] - let bindings = bindings - .clang_arg("-Wno-invalid-token-paste") - .blocklist_type("^(.*IMAGE_TLS_DIRECTORY.*)$"); - - // Set link name prefix on additional wrapStringper functions - generate_template_src(&prefix, &out_dir).unwrap(); - - // Generate bindings - let bindings = bindings.generate().expect("Unable to generate bindings"); - - bindings - .write_to_file(out_dir.join("bindings.rs")) - .expect("Couldn't write bindings!"); + cyclocut_path } #[allow(unused_variables)] @@ -302,7 +354,7 @@ fn replace_in_file(file_path: &Path, from: &str, to: &str) -> std::io::Result<() #[allow(unused_variables)] fn get_library_name(lib_name: &str) -> Option { - #[cfg(target_os = "linux")] + #[cfg(any(target_os = "linux", target_os = "macos"))] { let mut file_name = String::from("lib"); file_name.push_str(lib_name); @@ -315,13 +367,11 @@ fn get_library_name(lib_name: &str) -> Option { file_name.push_str(".lib"); Some(file_name) } - #[cfg(not(any(target_os = "linux", target_os = "windows")))] + #[cfg(not(any(target_os = "linux", target_os = "windows", target_os = "macos")))] None } fn get_defined_symbols(lib_dir: &Path, lib_name: &str) -> Result, String> { - use std::io::{BufRead, BufReader}; - let lib_path = lib_dir.to_path_buf().join(lib_name); let mut nm_file_name = lib_name.to_owned(); nm_file_name.push_str(".nm"); @@ -332,6 +382,12 @@ fn get_defined_symbols(lib_dir: &Path, lib_name: &str) -> Result .define("LIB_PATH", lib_path.clone()) .build(); + // Check for unexpected errors in stderr.txt + let mut stderr_file_name = lib_name.to_owned(); + stderr_file_name.push_str(".nm.stderr"); + let stderr_file_path = lib_dir.to_path_buf().join(stderr_file_name); + check_nm_stderr(&stderr_file_path).unwrap(); + match File::open(symbol_file_path.clone()) { Ok(symbol_file) => { let reader = BufReader::new(symbol_file); @@ -364,6 +420,41 @@ fn get_defined_symbols(lib_dir: &Path, lib_name: &str) -> Result } } +fn check_nm_stderr(stderr: &Path) -> Result<(), String> { + match File::open(stderr) { + Ok(file) => { + let reader = BufReader::new(file); + + for line in reader.lines() { + match line { + Ok(line) => { + // Some object files within the library may report no symbols - this is okay + if !line.ends_with(": no symbols") { + return Err(format!( + "nm completed with errors - see {} for details", + stderr.to_str().unwrap() + )); + } + } + Err(_) => { + return Err(format!( + "Failed to read nm stderr file: {}", + stderr.to_str().unwrap() + )) + } + } + } + } + Err(_) => { + return Err(format!( + "Failed to open nm stderr file: {}", + stderr.to_str().unwrap() + )); + } + } + Ok(()) +} + fn prefix_symbols( lib_dir: &Path, lib_name: &str, @@ -382,9 +473,22 @@ fn prefix_symbols( for symbol in symbols { let mut symbol_arg = symbol.clone(); - symbol_arg.push(' '); - symbol_arg.push_str(prefix); - symbol_arg.push_str(symbol); + + #[cfg(target_os = "macos")] + { + let mut symbol_stripped = symbol.clone(); + symbol_stripped.remove(0); + symbol_arg.push(' '); + symbol_arg.push('_'); + symbol_arg.push_str(prefix); + symbol_arg.push_str(&symbol_stripped); + } + #[cfg(not(target_os = "macos"))] + { + symbol_arg.push(' '); + symbol_arg.push_str(prefix); + symbol_arg.push_str(symbol); + } symbol_arg.push('\n'); if symbol_file.write_all(symbol_arg.as_bytes()).is_err() { return Err(format!( @@ -407,6 +511,12 @@ fn prefix_symbols( .define("LIB_PATH", lib_file_path.clone()) .define("SYMBOL_FILE_PATH", symbol_file_path.clone()) .build(); + + // Check for unexpected errors in stderr.txt + let mut stderr_file_name = lib_name.to_owned(); + stderr_file_name.push_str(".objcopy.stderr"); + let stderr_file_path = lib_dir.to_path_buf().join(stderr_file_name); + check_objcopy_stderr(&stderr_file_path).unwrap(); Ok(()) } Err(_) => Err(format!( @@ -416,6 +526,32 @@ fn prefix_symbols( } } +fn check_objcopy_stderr(stderr: &Path) -> Result<(), String> { + if let Ok(metadata) = metadata(stderr) { + if metadata.is_file() { + if metadata.len() > 0 { + println!("File exists and has a size greater than 0."); + Err(format!( + "Objcopy command failed with errors - see {} for details", + stderr.to_str().unwrap() + )) + } else { + Ok(()) + } + } else { + Err(format!( + "Objcopy stderr file is not a file: {}", + stderr.to_str().unwrap() + )) + } + } else { + Err(format!( + "Failed to read objcopy stderr file metadata: {}", + stderr.to_str().unwrap() + )) + } +} + fn generate_template_src(prefix: &str, out_dir: &Path) -> Result<(), String> { let src_path = Path::new("src/functions.template"); let dst_path = out_dir.join("functions.rs"); diff --git a/examples/disco.rs b/examples/disco.rs index b6c768d..378ad3f 100644 --- a/examples/disco.rs +++ b/examples/disco.rs @@ -151,7 +151,7 @@ unsafe extern "C" fn on_data(dr: dds_entity_t, arg: *mut std::os::raw::c_void) { samples.as_mut_ptr() as *mut *mut libc::c_void, MAX_SAMPLES as i32, ); - Box::into_raw(btx); + let _ = Box::into_raw(btx); } fn main() { unsafe { diff --git a/nm/CMakeLists.txt b/nm/CMakeLists.txt index f47d634..e0ff6cd 100644 --- a/nm/CMakeLists.txt +++ b/nm/CMakeLists.txt @@ -28,16 +28,7 @@ endif() # Custom target to run nm on the library add_custom_target(read_symbols ALL - COMMAND ${CMAKE_COMMAND} -E echo "Running nm on ${LIB_PATH}..." - # Run nm and redirect stderr to a file - COMMAND ${CMAKE_NM} --defined-only --print-file-name ${LIB_PATH} 1> ${LIB_PATH}.nm 2> ${LIB_PATH}.stderr - - # Check if stderr is empty (i.e., no errors were produced) - COMMAND ${CMAKE_COMMAND} -E echo "Checking for nm errors..." - COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/check_errors.sh ${LIB_PATH}.stderr - - # Clean up stderr.txt after checking for errors - COMMAND ${CMAKE_COMMAND} -E remove ${LIB_PATH}.stderr - COMMENT "Reading library symbols with nm..." + COMMAND ${CMAKE_COMMAND} -E echo "Running nm on ${LIB_PATH}..." + COMMAND ${CMAKE_NM} --defined-only --print-file-name ${LIB_PATH} 1> ${LIB_PATH}.nm 2> ${LIB_PATH}.nm.stderr ) diff --git a/nm/check_errors.sh b/nm/check_errors.sh deleted file mode 100755 index f5b1166..0000000 --- a/nm/check_errors.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh - -if [ ! -s $1 ]; then - echo 'Command succeeded with no stderr output.' - exit 0 -else - echo 'Command failed with errors:' - cat stderr.txt - exit 1 -fi diff --git a/objcopy/CMakeLists.txt b/objcopy/CMakeLists.txt index 86f7de8..ac452a5 100644 --- a/objcopy/CMakeLists.txt +++ b/objcopy/CMakeLists.txt @@ -42,13 +42,5 @@ add_custom_target(mangle_library ALL COMMAND ${CMAKE_COMMAND} -E echo "Running objcopy --redefine-syms on ${LIB_PATH} with symbols from ${SYMBOL_FILE_PATH}..." # Run objcopy and redirect stderr to a file - COMMAND ${CMAKE_OBJCOPY} --redefine-syms=${SYMBOL_FILE_PATH} ${LIB_PATH} 2> ${LIB_PATH}.stderr - - # Check if stderr is empty (i.e., no errors were produced) - COMMAND ${CMAKE_COMMAND} -E echo "Checking for objcopy errors..." - COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/check_errors.sh ${LIB_PATH}.stderr - - # Clean up stderr.txt after checking for errors - COMMAND ${CMAKE_COMMAND} -E remove ${LIB_PATH}.stderr - COMMENT "Mangling library with objcopy..." + COMMAND ${CMAKE_OBJCOPY} --redefine-syms=${SYMBOL_FILE_PATH} ${LIB_PATH} 2> ${LIB_PATH}.objcopy.stderr ) diff --git a/objcopy/check_errors.sh b/objcopy/check_errors.sh deleted file mode 100755 index f5b1166..0000000 --- a/objcopy/check_errors.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh - -if [ ! -s $1 ]; then - echo 'Command succeeded with no stderr output.' - exit 0 -else - echo 'Command failed with errors:' - cat stderr.txt - exit 1 -fi From 1399b5c4373bd7a42b6dd21d1a27cfb1423c46b0 Mon Sep 17 00:00:00 2001 From: Geoff Martin Date: Fri, 6 Dec 2024 10:23:58 +0000 Subject: [PATCH 06/61] Fixing CI build. --- .github/workflows/rust.yml | 9 +++++++-- Cargo.toml | 3 --- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 572d5cc..34ed625 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -44,10 +44,15 @@ jobs: with: command: clippy args: -- -D warnings - - name: Build (without Iceoryx) + - name: Build (default features) run: cargo build --verbose - name: Build (with Iceoryx) if: ${{ ! startsWith(matrix.os,'window') }} run: cargo build --features iceoryx --verbose - - name: Run tests (without Iceoryx) + - name: Build (with symbol prefixing) + if: ${{ ! startsWith(matrix.os,'window') }} + run: cargo build --features prefix_symbols --verbose + - name: Run tests (default features) run: cargo test --verbose + - name: Run tests (with symbol prefixing) + run: cargo test --features prefix_symbols --verbose diff --git a/Cargo.toml b/Cargo.toml index 680e583..037a5b0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -31,7 +31,4 @@ regex = "1.11" [features] iceoryx = [] -default = [ - "prefix_symbols", -] prefix_symbols = [] From f53b8088ac2515345a30ad6556706f9e0a7bb992 Mon Sep 17 00:00:00 2001 From: Geoff Martin Date: Fri, 6 Dec 2024 11:15:41 +0000 Subject: [PATCH 07/61] Enable symbol mangling in CI on Windows. --- .github/workflows/rust.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 34ed625..62e901d 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -50,7 +50,6 @@ jobs: if: ${{ ! startsWith(matrix.os,'window') }} run: cargo build --features iceoryx --verbose - name: Build (with symbol prefixing) - if: ${{ ! startsWith(matrix.os,'window') }} run: cargo build --features prefix_symbols --verbose - name: Run tests (default features) run: cargo test --verbose From 7715145b9ce16daae045d98c4ab34ad64d1d2625 Mon Sep 17 00:00:00 2001 From: Geoff Martin Date: Fri, 6 Dec 2024 15:35:05 +0000 Subject: [PATCH 08/61] Removed regex from Cargo manifest. --- Cargo.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 037a5b0..408279b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -27,7 +27,6 @@ serde_json = "1.0.94" [build-dependencies] bindgen = "0.69" cmake = "0.1" -regex = "1.11" [features] iceoryx = [] From 4f045043cdaa3669111569699bf7657147f22dcd Mon Sep 17 00:00:00 2001 From: Geoff Martin Date: Fri, 6 Dec 2024 15:54:33 +0000 Subject: [PATCH 09/61] Run tests with iceoryx feature enabled. --- .github/workflows/rust.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 62e901d..49feba5 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -53,5 +53,8 @@ jobs: run: cargo build --features prefix_symbols --verbose - name: Run tests (default features) run: cargo test --verbose + - name: Run tests (with Iceoryx) + if: ${{ ! startsWith(matrix.os,'window') }} + run: cargo test --features iceoryx --verbose - name: Run tests (with symbol prefixing) run: cargo test --features prefix_symbols --verbose From 1b40cb2b54e996d92efca5976bc1d6bc814ad01c Mon Sep 17 00:00:00 2001 From: Geoff Martin Date: Fri, 6 Dec 2024 16:06:18 +0000 Subject: [PATCH 10/61] Run tests with iceoryx feature enabled. --- .github/workflows/rust.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 49feba5..e38318f 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -24,6 +24,9 @@ jobs: - name: Install ACL if: startsWith(matrix.os,'ubuntu') run: sudo apt-get -y install acl-dev + - name: Install libstdc++ + if: startsWith(matrix.os,'ubuntu') + run: sudo apt-get -y install g++-multilib - name: Install LLVM toolchain if: startsWith(matrix.os,'macos') run: | From 9c26f2bbeb7dcf09c895a37a9e422b4e315ca019 Mon Sep 17 00:00:00 2001 From: Geoff Martin Date: Fri, 6 Dec 2024 16:08:04 +0000 Subject: [PATCH 11/61] Run tests with iceoryx feature enabled. --- .github/workflows/rust.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index e38318f..5a63279 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -25,7 +25,7 @@ jobs: if: startsWith(matrix.os,'ubuntu') run: sudo apt-get -y install acl-dev - name: Install libstdc++ - if: startsWith(matrix.os,'ubuntu') + if: startsWith(matrix.os,'[ubuntu') run: sudo apt-get -y install g++-multilib - name: Install LLVM toolchain if: startsWith(matrix.os,'macos') From be497c268c520e78da642c66ff16feb1402c5d3f Mon Sep 17 00:00:00 2001 From: Geoff Martin Date: Fri, 6 Dec 2024 16:18:06 +0000 Subject: [PATCH 12/61] Run tests with iceoryx feature enabled. --- .github/workflows/rust.yml | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 5a63279..dddefa7 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -14,21 +14,22 @@ jobs: strategy: fail-fast: true matrix: - os: [ubuntu-latest, windows-11, macos-ventura, [ubuntu-22.04, ARM64]] - runs-on: [self-hosted, "${{ matrix.os }}"] + os-arch: + - { os: "ubuntu-latest", arch: "x86_64" } + - { os: "windows-11", arch: "x86_64" } + - { os: "macos-ventura", arch: "x86_64" } + - { os: "ubuntu-22.04", arch: "ARM64" } + runs-on: [self-hosted, "${{ matrix.os-arch.os }}"] steps: - uses: actions/checkout@v2 with: submodules: recursive - - name: Install ACL - if: startsWith(matrix.os,'ubuntu') - run: sudo apt-get -y install acl-dev - - name: Install libstdc++ - if: startsWith(matrix.os,'[ubuntu') - run: sudo apt-get -y install g++-multilib + - name: Install apt dependencies + if: startsWith(matrix.os-arch.os,'ubuntu') + run: sudo apt-get -y install acl-dev g++-multilib - name: Install LLVM toolchain - if: startsWith(matrix.os,'macos') + if: startsWith(matrix.os-arch.os,'macos') run: | brew install llvm@19 ls /opt/homebrew/opt/llvm@19/bin @@ -50,14 +51,14 @@ jobs: - name: Build (default features) run: cargo build --verbose - name: Build (with Iceoryx) - if: ${{ ! startsWith(matrix.os,'window') }} + if: ${{ ! startsWith(matrix.os-arch.os,'window') }} run: cargo build --features iceoryx --verbose - name: Build (with symbol prefixing) run: cargo build --features prefix_symbols --verbose - name: Run tests (default features) run: cargo test --verbose - name: Run tests (with Iceoryx) - if: ${{ ! startsWith(matrix.os,'window') }} + if: ${{ ! startsWith(matrix.os-arch.os,'window') }} run: cargo test --features iceoryx --verbose - name: Run tests (with symbol prefixing) run: cargo test --features prefix_symbols --verbose From c6d5cfd1bf4594bb928b9811a13498ed5b072d78 Mon Sep 17 00:00:00 2001 From: Geoff Martin Date: Fri, 6 Dec 2024 16:31:22 +0000 Subject: [PATCH 13/61] Run tests with iceoryx feature enabled. --- .github/workflows/rust.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index dddefa7..a33f1bf 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -27,7 +27,7 @@ jobs: submodules: recursive - name: Install apt dependencies if: startsWith(matrix.os-arch.os,'ubuntu') - run: sudo apt-get -y install acl-dev g++-multilib + run: sudo apt-get -y install acl-dev - name: Install LLVM toolchain if: startsWith(matrix.os-arch.os,'macos') run: | From b939dfc4dbe15e08687d62d53022ab1cff238ee4 Mon Sep 17 00:00:00 2001 From: Geoff Martin Date: Fri, 6 Dec 2024 16:40:42 +0000 Subject: [PATCH 14/61] Run tests with iceoryx feature enabled. --- .github/workflows/rust.yml | 2 +- build.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index a33f1bf..dddefa7 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -27,7 +27,7 @@ jobs: submodules: recursive - name: Install apt dependencies if: startsWith(matrix.os-arch.os,'ubuntu') - run: sudo apt-get -y install acl-dev + run: sudo apt-get -y install acl-dev g++-multilib - name: Install LLVM toolchain if: startsWith(matrix.os-arch.os,'macos') run: | diff --git a/build.rs b/build.rs index ce34954..6e56996 100644 --- a/build.rs +++ b/build.rs @@ -185,7 +185,7 @@ fn build_iceoryx(src_dir: &Path, out_dir: &Path) -> PathBuf { let iceoryx_lib = iceoryx_path.join("lib"); println!("cargo:rustc-link-search=native={}", iceoryx_lib.display()); println!("cargo:rustc-link-lib=static=iceoryx_hoofs"); - println!("cargo:rustc-link-lib=static=iceoryx_posh"); + //println!("cargo:rustc-link-lib=static=iceoryx_posh"); println!("cargo:rustc-link-lib=static=iceoryx_platform"); #[cfg(target_os = "linux")] From 775f9856304dd1f9e04186644d8d09d3d2d11a3f Mon Sep 17 00:00:00 2001 From: Geoff Martin Date: Fri, 6 Dec 2024 16:43:37 +0000 Subject: [PATCH 15/61] Run tests with iceoryx feature enabled. --- build.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.rs b/build.rs index 6e56996..ce34954 100644 --- a/build.rs +++ b/build.rs @@ -185,7 +185,7 @@ fn build_iceoryx(src_dir: &Path, out_dir: &Path) -> PathBuf { let iceoryx_lib = iceoryx_path.join("lib"); println!("cargo:rustc-link-search=native={}", iceoryx_lib.display()); println!("cargo:rustc-link-lib=static=iceoryx_hoofs"); - //println!("cargo:rustc-link-lib=static=iceoryx_posh"); + println!("cargo:rustc-link-lib=static=iceoryx_posh"); println!("cargo:rustc-link-lib=static=iceoryx_platform"); #[cfg(target_os = "linux")] From 54cdc9797772059dafaad3e02b54955a2df0cb78 Mon Sep 17 00:00:00 2001 From: Geoff Martin Date: Fri, 6 Dec 2024 16:48:35 +0000 Subject: [PATCH 16/61] Run tests with iceoryx feature enabled. --- .github/workflows/rust.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index dddefa7..013dcb4 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -57,8 +57,8 @@ jobs: run: cargo build --features prefix_symbols --verbose - name: Run tests (default features) run: cargo test --verbose - - name: Run tests (with Iceoryx) - if: ${{ ! startsWith(matrix.os-arch.os,'window') }} - run: cargo test --features iceoryx --verbose + #- name: Run tests (with Iceoryx) + # if: ${{ ! startsWith(matrix.os-arch.os,'window') }} + # run: cargo test --features iceoryx --verbose - name: Run tests (with symbol prefixing) run: cargo test --features prefix_symbols --verbose From ae09f162546c61ddd14aebf373c4d62c172d7f13 Mon Sep 17 00:00:00 2001 From: Geoff Martin Date: Fri, 6 Dec 2024 16:55:59 +0000 Subject: [PATCH 17/61] Run tests with iceoryx feature enabled. --- .github/workflows/rust.yml | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 013dcb4..1258f95 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -14,22 +14,18 @@ jobs: strategy: fail-fast: true matrix: - os-arch: - - { os: "ubuntu-latest", arch: "x86_64" } - - { os: "windows-11", arch: "x86_64" } - - { os: "macos-ventura", arch: "x86_64" } - - { os: "ubuntu-22.04", arch: "ARM64" } - runs-on: [self-hosted, "${{ matrix.os-arch.os }}"] + os: [ubuntu-latest, windows-11, macos-ventura, ubu22-arm-1] + runs-on: [self-hosted, "${{ matrix.os }}"] steps: - uses: actions/checkout@v2 with: submodules: recursive - name: Install apt dependencies - if: startsWith(matrix.os-arch.os,'ubuntu') + if: startsWith(matrix.os,'ubu') run: sudo apt-get -y install acl-dev g++-multilib - name: Install LLVM toolchain - if: startsWith(matrix.os-arch.os,'macos') + if: startsWith(matrix.os,'macos') run: | brew install llvm@19 ls /opt/homebrew/opt/llvm@19/bin @@ -51,14 +47,14 @@ jobs: - name: Build (default features) run: cargo build --verbose - name: Build (with Iceoryx) - if: ${{ ! startsWith(matrix.os-arch.os,'window') }} + if: ${{ ! startsWith(matrix.os,'window') }} run: cargo build --features iceoryx --verbose - name: Build (with symbol prefixing) run: cargo build --features prefix_symbols --verbose - name: Run tests (default features) run: cargo test --verbose - #- name: Run tests (with Iceoryx) - # if: ${{ ! startsWith(matrix.os-arch.os,'window') }} - # run: cargo test --features iceoryx --verbose + - name: Run tests (with Iceoryx) + if: ${{ ! startsWith(matrix.os,'window') }} + run: cargo test --features iceoryx --verbose - name: Run tests (with symbol prefixing) run: cargo test --features prefix_symbols --verbose From 9aa96cb5819070cb36318536bbff7e29c3d1c530 Mon Sep 17 00:00:00 2001 From: Geoff Martin Date: Fri, 6 Dec 2024 17:00:32 +0000 Subject: [PATCH 18/61] Run tests with iceoryx feature enabled. --- .github/workflows/rust.yml | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 1258f95..66ed494 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -14,15 +14,19 @@ jobs: strategy: fail-fast: true matrix: - os: [ubuntu-latest, windows-11, macos-ventura, ubu22-arm-1] - runs-on: [self-hosted, "${{ matrix.os }}"] + os-arch: + - { os: "ubuntu-latest", arch: "x64" } + - { os: "windows-11", arch: "x64" } + - { os: "macos-ventura", arch: "ARM64" } + - { os: "ubuntu-22.04", arch: "ARM64" } + runs-on: [self-hosted, "[${{ matrix.os-arch.os }}, ${{ matrix.os-arch.arch }}"] steps: - uses: actions/checkout@v2 with: submodules: recursive - name: Install apt dependencies - if: startsWith(matrix.os,'ubu') + if: startsWith(matrix.os,'ubuntu') run: sudo apt-get -y install acl-dev g++-multilib - name: Install LLVM toolchain if: startsWith(matrix.os,'macos') @@ -53,8 +57,8 @@ jobs: run: cargo build --features prefix_symbols --verbose - name: Run tests (default features) run: cargo test --verbose - - name: Run tests (with Iceoryx) - if: ${{ ! startsWith(matrix.os,'window') }} - run: cargo test --features iceoryx --verbose + #- name: Run tests (with Iceoryx) + # if: ${{ ! startsWith(matrix.os,'window') }} + # run: cargo test --features iceoryx --verbose - name: Run tests (with symbol prefixing) run: cargo test --features prefix_symbols --verbose From 3c222657db24872c178b8b1cca5c967c7f826877 Mon Sep 17 00:00:00 2001 From: Geoff Martin Date: Fri, 6 Dec 2024 17:01:05 +0000 Subject: [PATCH 19/61] Run tests with iceoryx feature enabled. --- .github/workflows/rust.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 66ed494..9c30fd6 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -19,7 +19,7 @@ jobs: - { os: "windows-11", arch: "x64" } - { os: "macos-ventura", arch: "ARM64" } - { os: "ubuntu-22.04", arch: "ARM64" } - runs-on: [self-hosted, "[${{ matrix.os-arch.os }}, ${{ matrix.os-arch.arch }}"] + runs-on: [self-hosted, "[${{ matrix.os-arch.os }}, ${{ matrix.os-arch.arch }}]"] steps: - uses: actions/checkout@v2 From d079ff9f176aa0190c5db96ac9059bc402d31baf Mon Sep 17 00:00:00 2001 From: Geoff Martin Date: Fri, 6 Dec 2024 17:07:16 +0000 Subject: [PATCH 20/61] Run tests with iceoryx feature enabled. --- .github/workflows/rust.yml | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 9c30fd6..596f2bc 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -14,19 +14,15 @@ jobs: strategy: fail-fast: true matrix: - os-arch: - - { os: "ubuntu-latest", arch: "x64" } - - { os: "windows-11", arch: "x64" } - - { os: "macos-ventura", arch: "ARM64" } - - { os: "ubuntu-22.04", arch: "ARM64" } - runs-on: [self-hosted, "[${{ matrix.os-arch.os }}, ${{ matrix.os-arch.arch }}]"] + os: ["ubuntu-latest", "windows-11", "macos-ventura", ["ubuntu-22.04", "ARM64"]] + runs-on: [self-hosted, "${{ matrix.os }}"] steps: - uses: actions/checkout@v2 with: submodules: recursive - name: Install apt dependencies - if: startsWith(matrix.os,'ubuntu') + if: ${{ matrix.os == 'ubuntu-latest' || matrix.os == '["ubuntu-22.04","ARM64"]' }} run: sudo apt-get -y install acl-dev g++-multilib - name: Install LLVM toolchain if: startsWith(matrix.os,'macos') From 7b261d702a31f122bfefa01aaf2f398e6d3b176a Mon Sep 17 00:00:00 2001 From: Geoff Martin Date: Fri, 6 Dec 2024 17:09:09 +0000 Subject: [PATCH 21/61] Run tests with iceoryx feature enabled. --- .github/workflows/rust.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 596f2bc..9ac4edf 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -22,7 +22,7 @@ jobs: with: submodules: recursive - name: Install apt dependencies - if: ${{ matrix.os == 'ubuntu-latest' || matrix.os == '["ubuntu-22.04","ARM64"]' }} + if: ${{ matrix.os == 'ubuntu-latest' || matrix.os == '["ubuntu-22.04", "ARM64"]' }} run: sudo apt-get -y install acl-dev g++-multilib - name: Install LLVM toolchain if: startsWith(matrix.os,'macos') From 3b10a0be39e5fc6ee13e37ff60e23da3f28b0e9b Mon Sep 17 00:00:00 2001 From: Geoff Martin Date: Fri, 6 Dec 2024 17:10:56 +0000 Subject: [PATCH 22/61] Run tests with iceoryx feature enabled. --- .github/workflows/rust.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 9ac4edf..7b9a27f 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -24,6 +24,8 @@ jobs: - name: Install apt dependencies if: ${{ matrix.os == 'ubuntu-latest' || matrix.os == '["ubuntu-22.04", "ARM64"]' }} run: sudo apt-get -y install acl-dev g++-multilib + - name: Print OS + run: echo "Matrix OS is: ${{ matrix.os }}" - name: Install LLVM toolchain if: startsWith(matrix.os,'macos') run: | From 8304c60c5c0485d5707480cf3a9e0c7d93f92952 Mon Sep 17 00:00:00 2001 From: Geoff Martin Date: Fri, 6 Dec 2024 17:11:57 +0000 Subject: [PATCH 23/61] Run tests with iceoryx feature enabled. --- .github/workflows/rust.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 7b9a27f..c7c651f 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -25,7 +25,8 @@ jobs: if: ${{ matrix.os == 'ubuntu-latest' || matrix.os == '["ubuntu-22.04", "ARM64"]' }} run: sudo apt-get -y install acl-dev g++-multilib - name: Print OS - run: echo "Matrix OS is: ${{ matrix.os }}" + run: | + echo "Matrix OS is: ${{ matrix.os }}" - name: Install LLVM toolchain if: startsWith(matrix.os,'macos') run: | From 383864ba27dd6a892c7edde11207d4b1d8301f7e Mon Sep 17 00:00:00 2001 From: Geoff Martin Date: Fri, 6 Dec 2024 17:15:31 +0000 Subject: [PATCH 24/61] Run tests with iceoryx feature enabled. --- .github/workflows/rust.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index c7c651f..596f2bc 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -22,11 +22,8 @@ jobs: with: submodules: recursive - name: Install apt dependencies - if: ${{ matrix.os == 'ubuntu-latest' || matrix.os == '["ubuntu-22.04", "ARM64"]' }} + if: ${{ matrix.os == 'ubuntu-latest' || matrix.os == '["ubuntu-22.04","ARM64"]' }} run: sudo apt-get -y install acl-dev g++-multilib - - name: Print OS - run: | - echo "Matrix OS is: ${{ matrix.os }}" - name: Install LLVM toolchain if: startsWith(matrix.os,'macos') run: | From 26139f15474e8712824ad2695131260443ed2f26 Mon Sep 17 00:00:00 2001 From: Geoff Martin Date: Fri, 6 Dec 2024 17:18:13 +0000 Subject: [PATCH 25/61] Run tests with iceoryx feature enabled. --- .github/workflows/rust.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 596f2bc..abb3c6f 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -21,8 +21,12 @@ jobs: - uses: actions/checkout@v2 with: submodules: recursive + - name: Print OS + run: | + os="${{ toJson(matrix.os) }}" + echo "$os" - name: Install apt dependencies - if: ${{ matrix.os == 'ubuntu-latest' || matrix.os == '["ubuntu-22.04","ARM64"]' }} + if: ${{ matrix.os == 'ubuntu-latest' || toJson(matrix.os) == '["ubuntu-22.04","ARM64"]' }} run: sudo apt-get -y install acl-dev g++-multilib - name: Install LLVM toolchain if: startsWith(matrix.os,'macos') From da7c1ecac7ca2cea304bcc1cd2e3cfb90f309fee Mon Sep 17 00:00:00 2001 From: Geoff Martin Date: Fri, 6 Dec 2024 17:21:59 +0000 Subject: [PATCH 26/61] Run tests with iceoryx feature enabled. --- .github/workflows/rust.yml | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index abb3c6f..666c6a9 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -21,13 +21,9 @@ jobs: - uses: actions/checkout@v2 with: submodules: recursive - - name: Print OS - run: | - os="${{ toJson(matrix.os) }}" - echo "$os" - name: Install apt dependencies - if: ${{ matrix.os == 'ubuntu-latest' || toJson(matrix.os) == '["ubuntu-22.04","ARM64"]' }} - run: sudo apt-get -y install acl-dev g++-multilib + if: startsWith(matrix.os,'ubuntu') + run: sudo apt-get -y install acl-dev - name: Install LLVM toolchain if: startsWith(matrix.os,'macos') run: | From 53218311271959f0c94de5fa1cb064444fa92c1d Mon Sep 17 00:00:00 2001 From: Geoff Martin Date: Fri, 6 Dec 2024 17:27:41 +0000 Subject: [PATCH 27/61] Run tests with iceoryx feature enabled. --- .github/workflows/rust.yml | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 666c6a9..cb37b81 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -14,18 +14,23 @@ jobs: strategy: fail-fast: true matrix: - os: ["ubuntu-latest", "windows-11", "macos-ventura", ["ubuntu-22.04", "ARM64"]] - runs-on: [self-hosted, "${{ matrix.os }}"] + os-arch: + - { os: "ubuntu-latest", arch: "X64" } + - { os: "windows-11", arch: "X64" } + - { os: "macos-ventura", arch: "ARM64" } + - { os: "ubuntu-22.04", arch: "ARM64" } + runs-on: [${{ matrix.os-arch.os }}, ${{ matrix.os-arch.arch }}] + steps: - uses: actions/checkout@v2 with: submodules: recursive - name: Install apt dependencies - if: startsWith(matrix.os,'ubuntu') + if: startsWith(matrix.os-arch.os,'ubuntu') run: sudo apt-get -y install acl-dev - name: Install LLVM toolchain - if: startsWith(matrix.os,'macos') + if: startsWith(matrix.os-arch.os,'macos') run: | brew install llvm@19 ls /opt/homebrew/opt/llvm@19/bin @@ -47,14 +52,14 @@ jobs: - name: Build (default features) run: cargo build --verbose - name: Build (with Iceoryx) - if: ${{ ! startsWith(matrix.os,'window') }} + if: ${{ ! startsWith(matrix.os-arch.os,'window') }} run: cargo build --features iceoryx --verbose - name: Build (with symbol prefixing) run: cargo build --features prefix_symbols --verbose - name: Run tests (default features) run: cargo test --verbose - #- name: Run tests (with Iceoryx) - # if: ${{ ! startsWith(matrix.os,'window') }} - # run: cargo test --features iceoryx --verbose + - name: Run tests (with Iceoryx) + if: ${{ ! startsWith(matrix.os-arch.os,'window') }} + run: cargo test --features iceoryx --verbose - name: Run tests (with symbol prefixing) run: cargo test --features prefix_symbols --verbose From 80dc4f5147efd9bd58b2321b5fe334c4d599699c Mon Sep 17 00:00:00 2001 From: Geoff Martin Date: Fri, 6 Dec 2024 17:30:00 +0000 Subject: [PATCH 28/61] Run tests with iceoryx feature enabled. --- .github/workflows/rust.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index cb37b81..5a7f605 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -19,8 +19,7 @@ jobs: - { os: "windows-11", arch: "X64" } - { os: "macos-ventura", arch: "ARM64" } - { os: "ubuntu-22.04", arch: "ARM64" } - runs-on: [${{ matrix.os-arch.os }}, ${{ matrix.os-arch.arch }}] - + runs-on: ${{ matrix.os-arch.os }}, ${{ matrix.os-arch.arch }} steps: - uses: actions/checkout@v2 From 40610a3b5abb086176c5ffa2a86f5f30768923a4 Mon Sep 17 00:00:00 2001 From: Geoff Martin Date: Fri, 6 Dec 2024 17:32:06 +0000 Subject: [PATCH 29/61] Run tests with iceoryx feature enabled. --- .github/workflows/rust.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 5a7f605..02d9861 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -19,7 +19,7 @@ jobs: - { os: "windows-11", arch: "X64" } - { os: "macos-ventura", arch: "ARM64" } - { os: "ubuntu-22.04", arch: "ARM64" } - runs-on: ${{ matrix.os-arch.os }}, ${{ matrix.os-arch.arch }} + runs-on: ["${{ matrix.os-arch.os }}", "${{ matrix.os-arch.arch }}"] steps: - uses: actions/checkout@v2 From 1fc334268785fb0897c5499670b5fc18479a224a Mon Sep 17 00:00:00 2001 From: Geoff Martin Date: Fri, 6 Dec 2024 17:33:48 +0000 Subject: [PATCH 30/61] Run tests with iceoryx feature enabled. --- .github/workflows/rust.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 02d9861..f3960c7 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -27,7 +27,7 @@ jobs: submodules: recursive - name: Install apt dependencies if: startsWith(matrix.os-arch.os,'ubuntu') - run: sudo apt-get -y install acl-dev + run: sudo apt-get -y install acl-dev g++-multilib - name: Install LLVM toolchain if: startsWith(matrix.os-arch.os,'macos') run: | From fc4d222ab9cc42d45576750559ad43e51a1b8eb0 Mon Sep 17 00:00:00 2001 From: Geoff Martin Date: Fri, 6 Dec 2024 17:35:20 +0000 Subject: [PATCH 31/61] Run tests with iceoryx feature enabled. --- .github/workflows/rust.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index f3960c7..c330b19 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -27,7 +27,7 @@ jobs: submodules: recursive - name: Install apt dependencies if: startsWith(matrix.os-arch.os,'ubuntu') - run: sudo apt-get -y install acl-dev g++-multilib + run: sudo apt-get -y install acl-dev libstdc++6 - name: Install LLVM toolchain if: startsWith(matrix.os-arch.os,'macos') run: | From 3d3d6c2f3a3b82cae7e9cf6cc49141ad29f38f30 Mon Sep 17 00:00:00 2001 From: Geoff Martin Date: Fri, 6 Dec 2024 17:43:58 +0000 Subject: [PATCH 32/61] Run tests with iceoryx feature enabled. --- .github/workflows/rust.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index c330b19..f3960c7 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -27,7 +27,7 @@ jobs: submodules: recursive - name: Install apt dependencies if: startsWith(matrix.os-arch.os,'ubuntu') - run: sudo apt-get -y install acl-dev libstdc++6 + run: sudo apt-get -y install acl-dev g++-multilib - name: Install LLVM toolchain if: startsWith(matrix.os-arch.os,'macos') run: | From 8e03c0e4bd63ee8e459e793240ebee1e4dca5e06 Mon Sep 17 00:00:00 2001 From: Geoff Martin Date: Fri, 6 Dec 2024 17:47:55 +0000 Subject: [PATCH 33/61] Run tests with iceoryx feature enabled. --- .github/workflows/rust.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index f3960c7..42c2e2a 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -27,7 +27,7 @@ jobs: submodules: recursive - name: Install apt dependencies if: startsWith(matrix.os-arch.os,'ubuntu') - run: sudo apt-get -y install acl-dev g++-multilib + run: sudo apt-get -y install acl-dev g++ - name: Install LLVM toolchain if: startsWith(matrix.os-arch.os,'macos') run: | From b2b4267efae0ac5e83158ff9ff6ffe71df65613a Mon Sep 17 00:00:00 2001 From: Geoff Martin Date: Fri, 6 Dec 2024 17:58:36 +0000 Subject: [PATCH 34/61] Run tests with iceoryx feature enabled. --- build.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/build.rs b/build.rs index ce34954..dfa45bc 100644 --- a/build.rs +++ b/build.rs @@ -189,10 +189,10 @@ fn build_iceoryx(src_dir: &Path, out_dir: &Path) -> PathBuf { println!("cargo:rustc-link-lib=static=iceoryx_platform"); #[cfg(target_os = "linux")] - println!("cargo:rustc-link-lib=acl"); - - #[cfg(not(any(target_os = "windows", target_os = "macos")))] - println!("cargo:rustc-link-lib=stdc++"); + { + println!("cargo:rustc-link-lib=acl"); + println!("cargo:rustc-link-lib=stdc++"); + } #[cfg(target_os = "macos")] println!("cargo:rustc-link-lib=c++"); From 2c57daba437451513c9f9a98cce2e120dbc74bd5 Mon Sep 17 00:00:00 2001 From: Geoff Martin Date: Fri, 6 Dec 2024 18:01:58 +0000 Subject: [PATCH 35/61] Run tests with iceoryx feature enabled. --- .github/workflows/rust.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 42c2e2a..8d6f506 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -59,6 +59,6 @@ jobs: run: cargo test --verbose - name: Run tests (with Iceoryx) if: ${{ ! startsWith(matrix.os-arch.os,'window') }} - run: cargo test --features iceoryx --verbose + run: cargo test --features iceoryx --verbose --verbose - name: Run tests (with symbol prefixing) run: cargo test --features prefix_symbols --verbose From 1a62c4f0312bad4dca1eb50ca8eb35519abf8be3 Mon Sep 17 00:00:00 2001 From: Geoff Martin Date: Fri, 6 Dec 2024 18:05:06 +0000 Subject: [PATCH 36/61] Run tests with iceoryx feature enabled. --- .github/workflows/rust.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 8d6f506..d8411dd 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -27,7 +27,7 @@ jobs: submodules: recursive - name: Install apt dependencies if: startsWith(matrix.os-arch.os,'ubuntu') - run: sudo apt-get -y install acl-dev g++ + run: sudo apt-get -y install acl-dev libc++-dev - name: Install LLVM toolchain if: startsWith(matrix.os-arch.os,'macos') run: | @@ -59,6 +59,6 @@ jobs: run: cargo test --verbose - name: Run tests (with Iceoryx) if: ${{ ! startsWith(matrix.os-arch.os,'window') }} - run: cargo test --features iceoryx --verbose --verbose + run: cargo test --features iceoryx --verbose - name: Run tests (with symbol prefixing) run: cargo test --features prefix_symbols --verbose From ccfddeac6e99bddb5566f6825b08de5333bd7b94 Mon Sep 17 00:00:00 2001 From: Geoff Martin Date: Fri, 6 Dec 2024 18:08:30 +0000 Subject: [PATCH 37/61] Run tests with iceoryx feature enabled. --- build.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/build.rs b/build.rs index dfa45bc..52f4067 100644 --- a/build.rs +++ b/build.rs @@ -15,6 +15,9 @@ fn main() { let mut dir_builder = std::fs::DirBuilder::new(); dir_builder.recursive(true); + #[cfg(target_os = "linux")] + println!("cargo:rustc-link-lib=stdc++"); + // Check features let iceoryx_enabled = is_iceoryx_enabled(); let prefix_symbols_enabled = is_prefix_symbols_enabled(); From ec3050273b118d92743630ed942f5068b5287328 Mon Sep 17 00:00:00 2001 From: Geoff Martin Date: Fri, 6 Dec 2024 18:10:47 +0000 Subject: [PATCH 38/61] Run tests with iceoryx feature enabled. --- .github/workflows/rust.yml | 7 ++----- build.rs | 3 --- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index d8411dd..0395964 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -25,9 +25,9 @@ jobs: - uses: actions/checkout@v2 with: submodules: recursive - - name: Install apt dependencies + - name: Install ACL if: startsWith(matrix.os-arch.os,'ubuntu') - run: sudo apt-get -y install acl-dev libc++-dev + run: sudo apt-get -y install acl-dev - name: Install LLVM toolchain if: startsWith(matrix.os-arch.os,'macos') run: | @@ -57,8 +57,5 @@ jobs: run: cargo build --features prefix_symbols --verbose - name: Run tests (default features) run: cargo test --verbose - - name: Run tests (with Iceoryx) - if: ${{ ! startsWith(matrix.os-arch.os,'window') }} - run: cargo test --features iceoryx --verbose - name: Run tests (with symbol prefixing) run: cargo test --features prefix_symbols --verbose diff --git a/build.rs b/build.rs index 52f4067..dfa45bc 100644 --- a/build.rs +++ b/build.rs @@ -15,9 +15,6 @@ fn main() { let mut dir_builder = std::fs::DirBuilder::new(); dir_builder.recursive(true); - #[cfg(target_os = "linux")] - println!("cargo:rustc-link-lib=stdc++"); - // Check features let iceoryx_enabled = is_iceoryx_enabled(); let prefix_symbols_enabled = is_prefix_symbols_enabled(); From 3b3b899e2544516559da65387c3415b7a931993e Mon Sep 17 00:00:00 2001 From: Geoff Martin Date: Fri, 6 Dec 2024 18:20:55 +0000 Subject: [PATCH 39/61] Run tests with iceoryx feature enabled. --- .github/workflows/rust.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 0395964..6219e0e 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -18,7 +18,7 @@ jobs: - { os: "ubuntu-latest", arch: "X64" } - { os: "windows-11", arch: "X64" } - { os: "macos-ventura", arch: "ARM64" } - - { os: "ubuntu-22.04", arch: "ARM64" } +# - { os: "ubuntu-22.04", arch: "ARM64" } runs-on: ["${{ matrix.os-arch.os }}", "${{ matrix.os-arch.arch }}"] steps: @@ -57,5 +57,8 @@ jobs: run: cargo build --features prefix_symbols --verbose - name: Run tests (default features) run: cargo test --verbose + - name: Run tests (with Iceoryx) + if: ${{ ! startsWith(matrix.os-arch.os,'window') }} + run: cargo test --features iceoryx --verbose - name: Run tests (with symbol prefixing) run: cargo test --features prefix_symbols --verbose From b65554f7c939e0897033ba898e3215d7997df6aa Mon Sep 17 00:00:00 2001 From: Geoff Martin Date: Fri, 6 Dec 2024 18:26:22 +0000 Subject: [PATCH 40/61] Run tests with iceoryx feature enabled. --- .github/workflows/rust.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 6219e0e..f49201f 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -18,7 +18,7 @@ jobs: - { os: "ubuntu-latest", arch: "X64" } - { os: "windows-11", arch: "X64" } - { os: "macos-ventura", arch: "ARM64" } -# - { os: "ubuntu-22.04", arch: "ARM64" } + - { os: "ubuntu-22.04", arch: "ARM64" } runs-on: ["${{ matrix.os-arch.os }}", "${{ matrix.os-arch.arch }}"] steps: @@ -50,15 +50,15 @@ jobs: args: -- -D warnings - name: Build (default features) run: cargo build --verbose + - name: Run tests (default features) + run: cargo test --verbose - name: Build (with Iceoryx) if: ${{ ! startsWith(matrix.os-arch.os,'window') }} run: cargo build --features iceoryx --verbose - - name: Build (with symbol prefixing) - run: cargo build --features prefix_symbols --verbose - - name: Run tests (default features) - run: cargo test --verbose - name: Run tests (with Iceoryx) if: ${{ ! startsWith(matrix.os-arch.os,'window') }} run: cargo test --features iceoryx --verbose + - name: Build (with symbol prefixing) + run: cargo build --features prefix_symbols --verbose - name: Run tests (with symbol prefixing) run: cargo test --features prefix_symbols --verbose From bff6ddd0437354f0ca8d62ec733883408e1dfd16 Mon Sep 17 00:00:00 2001 From: Geoff Martin Date: Fri, 6 Dec 2024 18:29:20 +0000 Subject: [PATCH 41/61] Run tests with iceoryx feature enabled. --- .github/workflows/rust.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index f49201f..a209bbb 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -18,7 +18,7 @@ jobs: - { os: "ubuntu-latest", arch: "X64" } - { os: "windows-11", arch: "X64" } - { os: "macos-ventura", arch: "ARM64" } - - { os: "ubuntu-22.04", arch: "ARM64" } + #- { os: "ubuntu-22.04", arch: "ARM64" } runs-on: ["${{ matrix.os-arch.os }}", "${{ matrix.os-arch.arch }}"] steps: From fd72e3db0f8ad9bfb9b9b65b1eb7b0da0c9c2e44 Mon Sep 17 00:00:00 2001 From: Geoff Martin Date: Fri, 6 Dec 2024 18:32:48 +0000 Subject: [PATCH 42/61] Run tests with iceoryx feature enabled. --- .github/workflows/rust.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index a209bbb..19b893a 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -18,7 +18,7 @@ jobs: - { os: "ubuntu-latest", arch: "X64" } - { os: "windows-11", arch: "X64" } - { os: "macos-ventura", arch: "ARM64" } - #- { os: "ubuntu-22.04", arch: "ARM64" } + - { os: "ubuntu-22.04", arch: "ARM64" } runs-on: ["${{ matrix.os-arch.os }}", "${{ matrix.os-arch.arch }}"] steps: @@ -50,15 +50,15 @@ jobs: args: -- -D warnings - name: Build (default features) run: cargo build --verbose - - name: Run tests (default features) - run: cargo test --verbose - name: Build (with Iceoryx) if: ${{ ! startsWith(matrix.os-arch.os,'window') }} run: cargo build --features iceoryx --verbose + - name: Build (with symbol prefixing) + run: cargo build --features prefix_symbols --verbose + - name: Run tests (default features) + run: cargo test --verbose - name: Run tests (with Iceoryx) if: ${{ ! startsWith(matrix.os-arch.os,'window') }} run: cargo test --features iceoryx --verbose - - name: Build (with symbol prefixing) - run: cargo build --features prefix_symbols --verbose - name: Run tests (with symbol prefixing) run: cargo test --features prefix_symbols --verbose From 3c002a473ef4b5e696be58a30dcd98d234e63335 Mon Sep 17 00:00:00 2001 From: Geoff Martin Date: Mon, 9 Dec 2024 12:16:20 +0000 Subject: [PATCH 43/61] Tidied CMake file. --- objcopy/CMakeLists.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/objcopy/CMakeLists.txt b/objcopy/CMakeLists.txt index ac452a5..e7fc699 100644 --- a/objcopy/CMakeLists.txt +++ b/objcopy/CMakeLists.txt @@ -39,8 +39,7 @@ endif() # Custom target to mangle the library add_custom_target(mangle_library ALL - COMMAND ${CMAKE_COMMAND} -E echo "Running objcopy --redefine-syms on ${LIB_PATH} with symbols from ${SYMBOL_FILE_PATH}..." - # Run objcopy and redirect stderr to a file + COMMAND ${CMAKE_COMMAND} -E echo "Running objcopy --redefine-syms on ${LIB_PATH} with symbols from ${SYMBOL_FILE_PATH}..." COMMAND ${CMAKE_OBJCOPY} --redefine-syms=${SYMBOL_FILE_PATH} ${LIB_PATH} 2> ${LIB_PATH}.objcopy.stderr ) From 2bb0fffe198002a4d129b328b6197df58cd73c4c Mon Sep 17 00:00:00 2001 From: Geoff Martin Date: Mon, 9 Dec 2024 12:30:17 +0000 Subject: [PATCH 44/61] Tidied build script and temporarily disabled failing tests in CI. --- .github/workflows/rust.yml | 6 +++--- build.rs | 4 ---- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 19b893a..a73cbdf 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -57,8 +57,8 @@ jobs: run: cargo build --features prefix_symbols --verbose - name: Run tests (default features) run: cargo test --verbose - - name: Run tests (with Iceoryx) - if: ${{ ! startsWith(matrix.os-arch.os,'window') }} - run: cargo test --features iceoryx --verbose +# - name: Run tests (with Iceoryx) +# if: ${{ ! startsWith(matrix.os-arch.os,'window') }} +# run: cargo test --features iceoryx --verbose - name: Run tests (with symbol prefixing) run: cargo test --features prefix_symbols --verbose diff --git a/build.rs b/build.rs index dfa45bc..b453198 100644 --- a/build.rs +++ b/build.rs @@ -1,12 +1,8 @@ extern crate bindgen; -#[allow(unused_imports)] use std::collections::HashSet; -#[allow(unused_imports)] use std::io::{BufRead, BufReader, LineWriter, Write}; use std::path::{Path, PathBuf}; -#[allow(unused_imports)] -use std::process::Command; use std::{env, fs}; use std::{ffi::OsStr, fs::metadata, fs::File}; From 698b4cfc6db60ec05322bd1de7344e4685387fa4 Mon Sep 17 00:00:00 2001 From: Geoff Martin Date: Mon, 9 Dec 2024 14:16:26 +0000 Subject: [PATCH 45/61] Correcting Windows build of Iceoryx. --- build.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/build.rs b/build.rs index b453198..8808699 100644 --- a/build.rs +++ b/build.rs @@ -172,6 +172,12 @@ fn is_prefix_symbols_enabled() -> bool { fn build_iceoryx(src_dir: &Path, out_dir: &Path) -> PathBuf { let mut iceoryx = cmake::Config::new(src_dir); + + // Force compilation of Iceoryx in release mode on Windows due to + // https://github.com/rust-lang/rust/issues/39016 + #[cfg(all(debug_assertions, target_os = "windows"))] + let iceoryx = iceoryx.profile("Release"); + let iceoryx_path = iceoryx .define("BUILD_SHARED_LIBS", "OFF") .out_dir(out_dir) From 4cc990c0647c5ad49dbb36ef663cc19ea2d6728b Mon Sep 17 00:00:00 2001 From: Geoff Martin Date: Mon, 9 Dec 2024 16:07:48 +0000 Subject: [PATCH 46/61] Enable failing Iceoryx tests. --- .github/workflows/rust.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index a73cbdf..19b893a 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -57,8 +57,8 @@ jobs: run: cargo build --features prefix_symbols --verbose - name: Run tests (default features) run: cargo test --verbose -# - name: Run tests (with Iceoryx) -# if: ${{ ! startsWith(matrix.os-arch.os,'window') }} -# run: cargo test --features iceoryx --verbose + - name: Run tests (with Iceoryx) + if: ${{ ! startsWith(matrix.os-arch.os,'window') }} + run: cargo test --features iceoryx --verbose - name: Run tests (with symbol prefixing) run: cargo test --features prefix_symbols --verbose From a6c636a7445ad40184f98cb52cd9c1ec04e675df Mon Sep 17 00:00:00 2001 From: Geoff Martin Date: Mon, 9 Dec 2024 17:36:01 +0000 Subject: [PATCH 47/61] Don't run tests when Iceoryx enabled on Ubuntu ARM CI build. --- .github/workflows/rust.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 19b893a..9b7d2c4 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -58,7 +58,7 @@ jobs: - name: Run tests (default features) run: cargo test --verbose - name: Run tests (with Iceoryx) - if: ${{ ! startsWith(matrix.os-arch.os,'window') }} + if: ${{ ! startsWith(matrix.os-arch.os,'window') }} && if: ${{ ! startsWith(matrix.os-arch.os,'ubuntu-22.04') }} run: cargo test --features iceoryx --verbose - name: Run tests (with symbol prefixing) run: cargo test --features prefix_symbols --verbose From b74ff6e11b9be13be655df0dccd066629badc1d4 Mon Sep 17 00:00:00 2001 From: Geoff Martin Date: Mon, 9 Dec 2024 17:37:16 +0000 Subject: [PATCH 48/61] Don't run tests when Iceoryx enabled on Ubuntu ARM CI build. --- .github/workflows/rust.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 9b7d2c4..73abfc7 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -58,7 +58,7 @@ jobs: - name: Run tests (default features) run: cargo test --verbose - name: Run tests (with Iceoryx) - if: ${{ ! startsWith(matrix.os-arch.os,'window') }} && if: ${{ ! startsWith(matrix.os-arch.os,'ubuntu-22.04') }} + if: ${{ ! startsWith(matrix.os-arch.os,'window') }} && ${{ ! startsWith(matrix.os-arch.os,'ubuntu-22.04') }} run: cargo test --features iceoryx --verbose - name: Run tests (with symbol prefixing) run: cargo test --features prefix_symbols --verbose From 50b2ddea61c7f2415ee9ccfe2ca8d79df1001597 Mon Sep 17 00:00:00 2001 From: Geoff Martin Date: Mon, 9 Dec 2024 17:40:34 +0000 Subject: [PATCH 49/61] Don't run tests when Iceoryx enabled on Ubuntu ARM CI build. --- .github/workflows/rust.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 73abfc7..e37dc0b 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -58,7 +58,7 @@ jobs: - name: Run tests (default features) run: cargo test --verbose - name: Run tests (with Iceoryx) - if: ${{ ! startsWith(matrix.os-arch.os,'window') }} && ${{ ! startsWith(matrix.os-arch.os,'ubuntu-22.04') }} + if: ! ( ${{ startsWith(matrix.os-arch.os,'window') }} || ${{ startsWith(matrix.os-arch.os,'ubuntu-22.04') }} ) run: cargo test --features iceoryx --verbose - name: Run tests (with symbol prefixing) run: cargo test --features prefix_symbols --verbose From fdb068becc60e70dfa044193d450d9a7b57a6a34 Mon Sep 17 00:00:00 2001 From: Geoff Martin Date: Mon, 9 Dec 2024 17:48:21 +0000 Subject: [PATCH 50/61] Don't run tests when Iceoryx enabled on Ubuntu ARM CI build. --- .github/workflows/rust.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index e37dc0b..dd43edf 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -58,7 +58,7 @@ jobs: - name: Run tests (default features) run: cargo test --verbose - name: Run tests (with Iceoryx) - if: ! ( ${{ startsWith(matrix.os-arch.os,'window') }} || ${{ startsWith(matrix.os-arch.os,'ubuntu-22.04') }} ) + if: ${{ ! (startsWith(matrix.os-arch.os,'window') || startsWith(matrix.os-arch.os,'ubuntu-22.04')) }} run: cargo test --features iceoryx --verbose - name: Run tests (with symbol prefixing) run: cargo test --features prefix_symbols --verbose From 0a7332537ef752fe1660dafe335e1ba5c7f4850f Mon Sep 17 00:00:00 2001 From: Geoff Martin Date: Mon, 9 Dec 2024 17:58:28 +0000 Subject: [PATCH 51/61] Don't run tests when Iceoryx enabled on Ubuntu ARM CI build. --- .github/workflows/rust.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index dd43edf..12e7c72 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -57,8 +57,10 @@ jobs: run: cargo build --features prefix_symbols --verbose - name: Run tests (default features) run: cargo test --verbose - - name: Run tests (with Iceoryx) - if: ${{ ! (startsWith(matrix.os-arch.os,'window') || startsWith(matrix.os-arch.os,'ubuntu-22.04')) }} - run: cargo test --features iceoryx --verbose + # Currently disabled as it fails on ubuntu-22.04 ARM and ubuntu-latest X86 builds with link errors + # Note links successfully when incorporated into Zenoh DDS plugin + # - name: Run tests (with Iceoryx) + # if: ${{ ! startsWith(matrix.os-arch.os,'window') }} + # run: cargo test --features iceoryx --verbose - name: Run tests (with symbol prefixing) run: cargo test --features prefix_symbols --verbose From fcdd7bf5bf88472314e6845a0076fbc48811de85 Mon Sep 17 00:00:00 2001 From: Geoff Martin Date: Mon, 9 Dec 2024 18:13:55 +0000 Subject: [PATCH 52/61] Documented optional features. --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index 4cd4038..c393c95 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,9 @@ # cyclors Low level RUST APIs for cyclone + +## Supported Features + +* ```iceoryx```: Enable support for the Iceoryx PSMX plugin in Cyclone DDS (Linux and macOS only). +* ```prefix_symbols```: Prefix the symbols in the Cyclone DDS and Cyclocut libraries with the version of the cyclors crate. This allows for different versions of the crate to be loaded together statically. On macOS and Windows platforms ```llvm-nm``` and ```llvm-objcopy``` are required. + +**Note:** The ```iceoryx``` and ```prefix_symbols features are optional and cannot be enabled at the same time. From 8acb012dd5e9acad27114873d6d1c775232e260c Mon Sep 17 00:00:00 2001 From: Geoff Martin Date: Mon, 9 Dec 2024 18:17:47 +0000 Subject: [PATCH 53/61] Documented optional features. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c393c95..7758952 100644 --- a/README.md +++ b/README.md @@ -6,4 +6,4 @@ Low level RUST APIs for cyclone * ```iceoryx```: Enable support for the Iceoryx PSMX plugin in Cyclone DDS (Linux and macOS only). * ```prefix_symbols```: Prefix the symbols in the Cyclone DDS and Cyclocut libraries with the version of the cyclors crate. This allows for different versions of the crate to be loaded together statically. On macOS and Windows platforms ```llvm-nm``` and ```llvm-objcopy``` are required. -**Note:** The ```iceoryx``` and ```prefix_symbols features are optional and cannot be enabled at the same time. +**Note:** The ```iceoryx``` and ```prefix_symbols``` features are optional and cannot be enabled at the same time. From 120d3bb2019670df0299718b26009707e538f34a Mon Sep 17 00:00:00 2001 From: Geoff Martin Date: Tue, 10 Dec 2024 17:05:47 +0000 Subject: [PATCH 54/61] Reordered link libs in build script to resolve build issue on Ubuntu 22.04 ARM. --- .github/workflows/rust.yml | 8 +++----- build.rs | 14 +++++++------- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 12e7c72..19b893a 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -57,10 +57,8 @@ jobs: run: cargo build --features prefix_symbols --verbose - name: Run tests (default features) run: cargo test --verbose - # Currently disabled as it fails on ubuntu-22.04 ARM and ubuntu-latest X86 builds with link errors - # Note links successfully when incorporated into Zenoh DDS plugin - # - name: Run tests (with Iceoryx) - # if: ${{ ! startsWith(matrix.os-arch.os,'window') }} - # run: cargo test --features iceoryx --verbose + - name: Run tests (with Iceoryx) + if: ${{ ! startsWith(matrix.os-arch.os,'window') }} + run: cargo test --features iceoryx --verbose - name: Run tests (with symbol prefixing) run: cargo test --features prefix_symbols --verbose diff --git a/build.rs b/build.rs index 8808699..81cea00 100644 --- a/build.rs +++ b/build.rs @@ -191,13 +191,7 @@ fn build_iceoryx(src_dir: &Path, out_dir: &Path) -> PathBuf { println!("cargo:rustc-link-lib=static=iceoryx_platform"); #[cfg(target_os = "linux")] - { - println!("cargo:rustc-link-lib=acl"); - println!("cargo:rustc-link-lib=stdc++"); - } - - #[cfg(target_os = "macos")] - println!("cargo:rustc-link-lib=c++"); + println!("cargo:rustc-link-lib=acl"); iceoryx_path } @@ -279,6 +273,12 @@ fn build_cyclocut(src_dir: &Path, out_dir: &Path, cyclonedds_dir: &Path) -> Path println!("cargo:rustc-link-search=native={}", cyclocut_lib.display()); println!("cargo:rustc-link-lib=static=cdds-util"); + #[cfg(target_os = "linux")] + println!("cargo:rustc-link-lib=stdc++"); + + #[cfg(target_os = "macos")] + println!("cargo:rustc-link-lib=c++"); + cyclocut_path } From 3a2d9c6e9a202850a84d7c91047a1f6dcdbdc9a5 Mon Sep 17 00:00:00 2001 From: Geoff Martin Date: Tue, 10 Dec 2024 17:08:46 +0000 Subject: [PATCH 55/61] Reordered link libs in build script to resolve build issue on Ubuntu 22.04 ARM. --- build.rs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/build.rs b/build.rs index 81cea00..228b813 100644 --- a/build.rs +++ b/build.rs @@ -81,6 +81,15 @@ fn main() { let cyclonedds_include = cyclonedds.join("include"); let cyclocut_include = cyclocut.join("include"); + // C++ library added here to avoid link line ordering issue on some platforms + if iceoryx_enabled { + #[cfg(target_os = "linux")] + println!("cargo:rustc-link-lib=stdc++"); + + #[cfg(target_os = "macos")] + println!("cargo:rustc-link-lib=c++"); + } + let mut bindings = bindgen::Builder::default(); bindings = bindings .header("wrapper.h") @@ -273,12 +282,6 @@ fn build_cyclocut(src_dir: &Path, out_dir: &Path, cyclonedds_dir: &Path) -> Path println!("cargo:rustc-link-search=native={}", cyclocut_lib.display()); println!("cargo:rustc-link-lib=static=cdds-util"); - #[cfg(target_os = "linux")] - println!("cargo:rustc-link-lib=stdc++"); - - #[cfg(target_os = "macos")] - println!("cargo:rustc-link-lib=c++"); - cyclocut_path } From 002aa711cefab2ee8817a0696592d49321048816 Mon Sep 17 00:00:00 2001 From: Geoff Martin Date: Tue, 10 Dec 2024 17:42:00 +0000 Subject: [PATCH 56/61] Attempting to fix CI tests. --- build.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/build.rs b/build.rs index 228b813..c45fc12 100644 --- a/build.rs +++ b/build.rs @@ -81,13 +81,17 @@ fn main() { let cyclonedds_include = cyclonedds.join("include"); let cyclocut_include = cyclocut.join("include"); - // C++ library added here to avoid link line ordering issue on some platforms + // Libraries required by Iceoryx added here to avoid link line ordering issue on some platforms if iceoryx_enabled { #[cfg(target_os = "linux")] println!("cargo:rustc-link-lib=stdc++"); #[cfg(target_os = "macos")] println!("cargo:rustc-link-lib=c++"); + + println!("cargo:rustc-link-lib=static=iceoryx_hoofs"); + println!("cargo:rustc-link-lib=static=iceoryx_posh"); + println!("cargo:rustc-link-lib=static=iceoryx_platform"); } let mut bindings = bindgen::Builder::default(); @@ -195,9 +199,6 @@ fn build_iceoryx(src_dir: &Path, out_dir: &Path) -> PathBuf { // Add iceoryx lib to link let iceoryx_lib = iceoryx_path.join("lib"); println!("cargo:rustc-link-search=native={}", iceoryx_lib.display()); - println!("cargo:rustc-link-lib=static=iceoryx_hoofs"); - println!("cargo:rustc-link-lib=static=iceoryx_posh"); - println!("cargo:rustc-link-lib=static=iceoryx_platform"); #[cfg(target_os = "linux")] println!("cargo:rustc-link-lib=acl"); From b31606143e2845a057ad06913d741bd351c79e15 Mon Sep 17 00:00:00 2001 From: Geoff Martin Date: Tue, 10 Dec 2024 17:46:49 +0000 Subject: [PATCH 57/61] Attempt to fix CI build issue. --- .github/workflows/rust.yml | 2 +- build.rs | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 19b893a..5601f28 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -15,7 +15,7 @@ jobs: fail-fast: true matrix: os-arch: - - { os: "ubuntu-latest", arch: "X64" } + - { os: "ubuntu-22.04", arch: "X64" } - { os: "windows-11", arch: "X64" } - { os: "macos-ventura", arch: "ARM64" } - { os: "ubuntu-22.04", arch: "ARM64" } diff --git a/build.rs b/build.rs index c45fc12..228b813 100644 --- a/build.rs +++ b/build.rs @@ -81,17 +81,13 @@ fn main() { let cyclonedds_include = cyclonedds.join("include"); let cyclocut_include = cyclocut.join("include"); - // Libraries required by Iceoryx added here to avoid link line ordering issue on some platforms + // C++ library added here to avoid link line ordering issue on some platforms if iceoryx_enabled { #[cfg(target_os = "linux")] println!("cargo:rustc-link-lib=stdc++"); #[cfg(target_os = "macos")] println!("cargo:rustc-link-lib=c++"); - - println!("cargo:rustc-link-lib=static=iceoryx_hoofs"); - println!("cargo:rustc-link-lib=static=iceoryx_posh"); - println!("cargo:rustc-link-lib=static=iceoryx_platform"); } let mut bindings = bindgen::Builder::default(); @@ -199,6 +195,9 @@ fn build_iceoryx(src_dir: &Path, out_dir: &Path) -> PathBuf { // Add iceoryx lib to link let iceoryx_lib = iceoryx_path.join("lib"); println!("cargo:rustc-link-search=native={}", iceoryx_lib.display()); + println!("cargo:rustc-link-lib=static=iceoryx_hoofs"); + println!("cargo:rustc-link-lib=static=iceoryx_posh"); + println!("cargo:rustc-link-lib=static=iceoryx_platform"); #[cfg(target_os = "linux")] println!("cargo:rustc-link-lib=acl"); From d569067db6850f6670f9b7ad9f4ad6d92dce53f0 Mon Sep 17 00:00:00 2001 From: Geoff Martin Date: Tue, 10 Dec 2024 17:52:17 +0000 Subject: [PATCH 58/61] Attempt to fix CI build issue. --- .github/workflows/rust.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 5601f28..30b6cce 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -15,7 +15,7 @@ jobs: fail-fast: true matrix: os-arch: - - { os: "ubuntu-22.04", arch: "X64" } + - { os: "ubu24-3", arch: "X64" } - { os: "windows-11", arch: "X64" } - { os: "macos-ventura", arch: "ARM64" } - { os: "ubuntu-22.04", arch: "ARM64" } From 6129209b92e8632ce6b7a8f26c0c29d6b410cb62 Mon Sep 17 00:00:00 2001 From: Geoff Martin Date: Tue, 10 Dec 2024 17:59:02 +0000 Subject: [PATCH 59/61] Attempt to fix CI build issue. --- .github/workflows/rust.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 30b6cce..3426988 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -12,10 +12,13 @@ env: jobs: build: strategy: - fail-fast: true + fail-fast: false matrix: os-arch: + - { os: "ubu24-1", arch: "X64" } + - { os: "ubu24-2", arch: "X64" } - { os: "ubu24-3", arch: "X64" } + - { os: "ubu24-4", arch: "X64" } - { os: "windows-11", arch: "X64" } - { os: "macos-ventura", arch: "ARM64" } - { os: "ubuntu-22.04", arch: "ARM64" } From ef74dc2044aa4481b24d326db4d1a72c1b24f5b8 Mon Sep 17 00:00:00 2001 From: Geoff Martin Date: Tue, 10 Dec 2024 18:06:44 +0000 Subject: [PATCH 60/61] Attempt to fix CI build issue. --- .github/workflows/rust.yml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 3426988..5601f28 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -12,13 +12,10 @@ env: jobs: build: strategy: - fail-fast: false + fail-fast: true matrix: os-arch: - - { os: "ubu24-1", arch: "X64" } - - { os: "ubu24-2", arch: "X64" } - - { os: "ubu24-3", arch: "X64" } - - { os: "ubu24-4", arch: "X64" } + - { os: "ubuntu-22.04", arch: "X64" } - { os: "windows-11", arch: "X64" } - { os: "macos-ventura", arch: "ARM64" } - { os: "ubuntu-22.04", arch: "ARM64" } From 7b712cea284206bd5c757887f6e30a78d5ee1eb4 Mon Sep 17 00:00:00 2001 From: Geoff Martin Date: Tue, 10 Dec 2024 19:06:25 +0000 Subject: [PATCH 61/61] Fix Iceoryx tests in CI. --- .github/workflows/rust.yml | 2 +- rust-toolchain.toml | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 rust-toolchain.toml diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 5601f28..19b893a 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -15,7 +15,7 @@ jobs: fail-fast: true matrix: os-arch: - - { os: "ubuntu-22.04", arch: "X64" } + - { os: "ubuntu-latest", arch: "X64" } - { os: "windows-11", arch: "X64" } - { os: "macos-ventura", arch: "ARM64" } - { os: "ubuntu-22.04", arch: "ARM64" } diff --git a/rust-toolchain.toml b/rust-toolchain.toml new file mode 100644 index 0000000..292fe49 --- /dev/null +++ b/rust-toolchain.toml @@ -0,0 +1,2 @@ +[toolchain] +channel = "stable"