From 71c743f9b240b3284e4d24cbdbb7a7299fe632c2 Mon Sep 17 00:00:00 2001 From: Martin Dahl Date: Thu, 29 Apr 2021 13:26:06 +0200 Subject: [PATCH] fix build on arm64 --- msg_gen/build.rs | 1 + rcl/build.rs | 7 +++---- rcl/src/lib.rs | 6 ++++++ tests/threads.rs | 5 ++++- 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/msg_gen/build.rs b/msg_gen/build.rs index ded050b..7813151 100644 --- a/msg_gen/build.rs +++ b/msg_gen/build.rs @@ -100,6 +100,7 @@ fn main() { .blacklist_type("rosidl_runtime_c__uint64__Sequence") .blacklist_type("rosidl_runtime_c__int64__Sequence") .size_t_is_usize(true) + .no_debug("_OSUnaligned.*") .default_enum_style(bindgen::EnumVariation::Rust { non_exhaustive: false, }); diff --git a/rcl/build.rs b/rcl/build.rs index 2222807..2020cfd 100644 --- a/rcl/build.rs +++ b/rcl/build.rs @@ -23,17 +23,16 @@ fn main() { } println!("cargo:rustc-link-lib=dylib=rcl"); - // println!("cargo:rustc-link-lib=dylib=rcl_logging_noop"); - // default logging seem to be changed to spdlog println!("cargo:rustc-link-lib=dylib=rcl_logging_spdlog"); println!("cargo:rustc-link-lib=dylib=rcl_yaml_param_parser"); println!("cargo:rustc-link-lib=dylib=rcutils"); println!("cargo:rustc-link-lib=dylib=rmw"); - println!("cargo:rustc-link-lib=dylib=rmw_implementation"); println!("cargo:rustc-link-lib=dylib=rosidl_typesupport_c"); println!("cargo:rustc-link-lib=dylib=rosidl_runtime_c"); - let bindings = builder.generate().expect("Unable to generate bindings"); + let bindings = builder + .no_debug("_OSUnaligned.*") + .generate().expect("Unable to generate bindings"); let out_path = PathBuf::from(env::var("OUT_DIR").unwrap()); bindings diff --git a/rcl/src/lib.rs b/rcl/src/lib.rs index a662e41..c651cca 100644 --- a/rcl/src/lib.rs +++ b/rcl/src/lib.rs @@ -135,7 +135,13 @@ macro_rules! primitive_sequence { primitive_sequence!(rosidl_runtime_c__float32, f32); primitive_sequence!(rosidl_runtime_c__float64, f64); + +#[cfg(target_arch = "aarch64")] +primitive_sequence!(rosidl_runtime_c__long_double, f64); + +#[cfg(not(target_arch = "aarch64"))] primitive_sequence!(rosidl_runtime_c__long_double, u128); + primitive_sequence!(rosidl_runtime_c__char, i8); primitive_sequence!(rosidl_runtime_c__wchar, u16); primitive_sequence!(rosidl_runtime_c__boolean, bool); diff --git a/tests/threads.rs b/tests/threads.rs index 5bd655e..b293a80 100644 --- a/tests/threads.rs +++ b/tests/threads.rs @@ -12,7 +12,10 @@ fn doesnt_crash() -> Result<(), Error> { for c in 0..10 { let mut ths = Vec::new(); - for i in 0..30 { + // I have lowered this from 30 to 10 because cyclonedds can only handle a hard-coded number of + // publishers in threads. See + // https://github.com/eclipse-cyclonedds/cyclonedds/blob/cd2136d9321212bd52fdc613f07bbebfddd90dec/src/core/ddsc/src/dds_init.c#L115 + for i in 0..10 { // create concurrent nodes that max out the cpu let ctx = ctx.clone(); ths.push(thread::spawn(move || {