Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOS/Android support #242

Open
jakobturftank opened this issue Feb 6, 2024 · 6 comments
Open

iOS/Android support #242

jakobturftank opened this issue Feb 6, 2024 · 6 comments

Comments

@jakobturftank
Copy link

Describe the feature

We are a robotics company that have considering migrating our communication channels to Zenoh, especially after it was announced as a new rmw for ROS2.

However, we have decided against it, after we found that we could not build the C bindings for iOS and Android. We are using flutter and dart so we typically use C libraries with dart ffi.

I hope that we could have the C bindings buildable from Android and iOS sometime in the future.

Thank you.

@Mallets Mallets transferred this issue from eclipse-zenoh/zenoh Feb 6, 2024
@Mallets
Copy link
Member

Mallets commented Feb 6, 2024

Hello @jakobturftank ,

Would you mind describing more in details what didn't work out in your attempt to build the C bindings for iOS and Android?
It would be great if you could provide some guidance on how to setup the environment and reproduce the issue.

@jakobturftank
Copy link
Author

Thank you for getting back to me. I am having my colleague provide you all the information regarding the issue

@andreasturftank
Copy link

Hello,
As we are using Flutter for some UI, we would like to interface with Zenoh from Dart. We imagine the easiest way to do so, is to use the c-interopability of Dart to call the functions of zenoh-c from a dynamic library compiled for the specific platform (iOS/Android). The actual calling of the dynamic library occurs via bindings (Dart:FFI) which are generated from the zenoh-c header files.

To this end, I have been following this tutorial and by extension this one to build an android library which contains both the C library and the corresponding Dart bindings.

I have run into issues when building from the CMakeLists from Gradle. Specificially, I run into an ld error, claiming that the .../app/.cxx/Debug/694h3a66/arm64-v8a/debug/target/debug/libzenohcd.so is incompatible with aarch64linux, but I suspect that something else is wrong. I can see from this roadmap discussion that you haven't tried to build zenoh-c for Android possibly due to Android NDK issues - did you ever get further than this?

I have not attempted to build for iOS, yet. Do you have this use case on your roadmap or a iOS friendly Zenoh implementation such as in Swift or Objective-C?

@Mallets
Copy link
Member

Mallets commented Feb 7, 2024

Chiming in @milyin and @p-avital

@uupks
Copy link

uupks commented Feb 19, 2024

With my attempt to cross-compile zenoh-c to the Android system, the biggest problem is that Android system does not support POSIX shared memory. But shared-memory enabled for zenoh even if zenoh-c "shared-memory" feature is disabled. This is to make "std::mem::transmute" work for ZSLice..

@uupks
Copy link

uupks commented Feb 19, 2024

When I try to cross-compile zenoh-c to aarch64-linux-android, the following error will be reported:

   Compiling shared_memory v0.12.4
error: shared_memory isnt implemented for this platform...
  --> /home/r22052/.cargo/registry/src/index.crates.io-6f17d22bba15001f/shared_memory-0.12.4/src/lib.rs:43:9
   |
43 |         compile_error!("shared_memory isnt implemented for this platform...");
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0433]: failed to resolve: use of undeclared crate or module `os_impl`
   --> /home/r22052/.cargo/registry/src/index.crates.io-6f17d22bba15001f/shared_memory-0.12.4/src/lib.rs:121:27
    |
121 |                     match os_impl::create_mapping(&cur_id, self.size) {
    |                           ^^^^^^^ use of undeclared crate or module `os_impl`

error[E0433]: failed to resolve: use of undeclared crate or module `os_impl`
   --> /home/r22052/.cargo/registry/src/index.crates.io-6f17d22bba15001f/shared_memory-0.12.4/src/lib.rs:130:38
    |
130 |             Some(ref specific_id) => os_impl::create_mapping(specific_id, self.size)?,
    |                                      ^^^^^^^ use of undeclared crate or module `os_impl`

error[E0433]: failed to resolve: use of undeclared crate or module `os_impl`
   --> /home/r22052/.cargo/registry/src/index.crates.io-6f17d22bba15001f/shared_memory-0.12.4/src/lib.rs:207:19
    |
207 |             match os_impl::open_mapping(unique_id, self.size, &self.ext) {
    |                   ^^^^^^^ use of undeclared crate or module `os_impl`

error[E0433]: failed to resolve: use of undeclared crate or module `os_impl`
  --> /home/r22052/.cargo/registry/src/index.crates.io-6f17d22bba15001f/shared_memory-0.12.4/src/lib.rs:55:10
   |
55 |     ext: os_impl::ShmemConfExt,
   |          ^^^^^^^ use of undeclared crate or module `os_impl`

error[E0433]: failed to resolve: use of undeclared crate or module `os_impl`
   --> /home/r22052/.cargo/registry/src/index.crates.io-6f17d22bba15001f/shared_memory-0.12.4/src/lib.rs:232:14
    |
232 |     mapping: os_impl::MapData,
    |              ^^^^^^^ use of undeclared crate or module `os_impl`

For more information about this error, try `rustc --explain E0433`.
error: could not compile `shared_memory` (lib) due to 6 previous errors
warning: build failed, waiting for other jobs to finish...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants